Merge "Add 'swift_container' field into the Backup creation form"

This commit is contained in:
Zuul 2020-09-21 20:49:46 +00:00 committed by Gerrit Code Review
commit 9743646c0a
4 changed files with 19 additions and 6 deletions

View File

@ -246,9 +246,11 @@ def backup_delete(request, backup_id):
def backup_create(request, name, instance_id, description=None,
parent_id=None):
parent_id=None, swift_container=None):
return troveclient(request).backups.create(name, instance_id,
description, parent_id)
description=description,
parent_id=parent_id,
swift_container=swift_container)
def nova_client_client(request):

View File

@ -86,6 +86,7 @@ class DatabasesBackupsTests(test.TestCase):
backupName,
database.id,
backupDesc,
"",
"")
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, INDEX_URL)
@ -137,7 +138,8 @@ class DatabasesBackupsTests(test.TestCase):
backupName,
database.id,
backupDesc,
backupParent.id)
backupParent.id,
"")
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, INDEX_URL)

View File

@ -37,6 +37,13 @@ class BackupDetailsAction(workflows.Action):
parent = forms.ChoiceField(label=_("Parent Backup"),
required=False,
help_text=_("Optional parent backup"))
swift_container = forms.CharField(max_length=256,
widget=forms.TextInput(),
label=_("Swift Container Name"),
required=False,
help_text=_(
"User defined swift container name.")
)
class Meta(object):
name = _("Details")
@ -73,7 +80,8 @@ class BackupDetailsAction(workflows.Action):
class SetBackupDetails(workflows.Step):
action_class = BackupDetailsAction
contributes = ["name", "description", "instance", "parent"]
contributes = ["name", "description", "instance", "parent",
"swift_container"]
class CreateBackup(workflows.Workflow):
@ -100,7 +108,8 @@ class CreateBackup(workflows.Workflow):
context['name'],
context['instance'],
context['description'],
context['parent'])
context['parent'],
context['swift_container'])
return True
except Exception:
LOG.exception("Exception while creating backup")

View File

@ -33,7 +33,7 @@ from trove_dashboard.content.database_backups \
import tables as backup_tables
ACTIVE_STATES = ("ACTIVE",)
ACTIVE_STATES = ("ACTIVE", "HEALTHY",)
class DeleteInstance(tables.DeleteAction):