Improved cinder and nova backups ui
Simplified ui for linux snapshots Change-Id: I18c6350a217327c6fe924373ab104441cf82dc0c
This commit is contained in:
parent
1435d33732
commit
2cc46f5886
|
@ -96,6 +96,7 @@ class ActionsTable(tables.DataTable):
|
|||
path_to_backup = tables.Column('path_to_backup',
|
||||
verbose_name=_("Path To Backup or Restore"))
|
||||
storage = tables.Column('storage', verbose_name=_("Storage"))
|
||||
mode = tables.Column('mode', verbose_name=_("Mode"))
|
||||
|
||||
class Meta:
|
||||
name = "actions_table"
|
||||
|
|
|
@ -159,6 +159,12 @@ class ActionConfigurationAction(workflows.Action):
|
|||
cleaned_data = super(ActionConfigurationAction, self).clean()
|
||||
|
||||
if cleaned_data.get('action') == 'backup':
|
||||
if cleaned_data.get('mode') == 'cinder' \
|
||||
or cleaned_data.get('mode') == 'nova':
|
||||
self._check_container(cleaned_data)
|
||||
self._check_backup_name(cleaned_data)
|
||||
return cleaned_data
|
||||
|
||||
self._check_container(cleaned_data)
|
||||
self._check_backup_name(cleaned_data)
|
||||
self._check_path_to_backup(cleaned_data)
|
||||
|
@ -268,46 +274,6 @@ class SnapshotConfigurationAction(workflows.Action):
|
|||
widget=forms.CheckboxInput(),
|
||||
required=False)
|
||||
|
||||
lvm_auto_snap = forms.CharField(
|
||||
label=_("LVM Auto Snapshot"),
|
||||
help_text=_("Automatically guess the volume group and "
|
||||
"volume name for given PATH."),
|
||||
required=False)
|
||||
|
||||
lvm_srcvol = forms.CharField(
|
||||
label=_("Set The Volume For Snapshot"),
|
||||
help_text=_("Set the lvm volume you want to take a "
|
||||
"snapshot from. Default no volume"),
|
||||
required=False)
|
||||
|
||||
lvm_snapname = forms.CharField(
|
||||
label=_("Set A Snapshot Name"),
|
||||
help_text=_("Set the lvm snapshot name to use. "
|
||||
"If the snapshot name already exists, "
|
||||
"the old one will be used a no new one "
|
||||
"will be created. Default freezer_backup_snap."),
|
||||
required=False)
|
||||
|
||||
lvm_snapsize = forms.CharField(
|
||||
label=_("Snapshot Size"),
|
||||
help_text=_("Set the lvm snapshot size when creating "
|
||||
"a new snapshot. Please add G for Gigabytes "
|
||||
"or M for Megabytes, i.e. 500M or 8G. Default 5G."),
|
||||
required=False)
|
||||
|
||||
lvm_dirmount = forms.CharField(
|
||||
label=_("Snapshot Directory"),
|
||||
help_text=_("Set the directory you want to mount "
|
||||
"the lvm snapshot to. Default not set"),
|
||||
required=False)
|
||||
|
||||
lvm_volgroup = forms.CharField(
|
||||
label=_("Volume Group"),
|
||||
help_text=_("Specify the volume group of your logical volume."
|
||||
"This is important to mount your snapshot volume."
|
||||
"Default not set"),
|
||||
required=False)
|
||||
|
||||
class Meta(object):
|
||||
name = _("Snapshot")
|
||||
help_text_template = "disaster_recovery/jobs" \
|
||||
|
@ -318,12 +284,7 @@ class SnapshotConfiguration(workflows.Step):
|
|||
action_class = SnapshotConfigurationAction
|
||||
contributes = ('use_snapshot',
|
||||
'is_windows',
|
||||
'lvm_auto_snap',
|
||||
'lvm_srcvol',
|
||||
'lvm_snapname',
|
||||
'lvm_snapsize',
|
||||
'lvm_dirmount',
|
||||
'lvm_volgroup',)
|
||||
'is_linux')
|
||||
|
||||
|
||||
class AdvancedConfigurationAction(workflows.Action):
|
||||
|
@ -582,16 +543,16 @@ class ActionWorkflow(workflows.Workflow):
|
|||
try:
|
||||
if context['is_windows']:
|
||||
client_os = 'Windows'
|
||||
context.pop('is_windows')
|
||||
else:
|
||||
client_os = 'Linux'
|
||||
context.pop('is_windows')
|
||||
|
||||
if context['use_snapshot'] and client_os == 'Windows':
|
||||
context['vssadmin'] = True
|
||||
context.pop('use_snapshot')
|
||||
elif context['use_snapshot'] and client_os == 'Linux':
|
||||
context['snapshot'] = True
|
||||
context.pop('use_snapshot')
|
||||
else:
|
||||
context['vssadmin'] = False
|
||||
context.pop('use_snapshot')
|
||||
|
||||
if context['action_id'] == '':
|
||||
|
|
|
@ -391,6 +391,10 @@ class Action(object):
|
|||
utils.assign_and_remove(action, action_rules, 'mandatory')
|
||||
action = utils.create_dict(**action)
|
||||
action.pop('action_id', None)
|
||||
# if the backup name has spaces the tar metadata file cannot be found
|
||||
# so we replace " " for "_"
|
||||
backup_name = action.pop('backup_name', None)
|
||||
action['backup_name'] = backup_name.replace(' ', '_')
|
||||
action = {'freezer_action': action}
|
||||
return self.client.actions.create(action)
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ class InfoAction(workflows.Action):
|
|||
job_id = forms.CharField(label=_("Job ID"), required=False,
|
||||
widget=forms.HiddenInput(),)
|
||||
actions = forms.CharField(label=_("Actions"), required=False,
|
||||
widget=forms.HiddenInput(),)
|
||||
widget=forms.TextInput(
|
||||
attrs={'readonly': 'readonly'}))
|
||||
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(InfoAction, self).__init__(request, *args, **kwargs)
|
||||
|
@ -68,7 +69,7 @@ class ConfigureActions(workflows.Workflow):
|
|||
success_message = _('Actions saved correctly.')
|
||||
failure_message = _('Unable to save actions.')
|
||||
success_url = "horizon:disaster_recovery:jobs:index"
|
||||
default_steps = (ActionsConfiguration, Info,)
|
||||
default_steps = (ActionsConfiguration, Info)
|
||||
|
||||
def handle(self, request, context):
|
||||
try:
|
||||
|
|
|
@ -21,12 +21,7 @@
|
|||
function hideOptions() {
|
||||
// Snapshot specific controls
|
||||
$("#id_is_windows").closest(".form-group").hide();
|
||||
$("#id_lvm_auto_snap").closest(".form-group").hide();
|
||||
$("#id_lvm_srcvol").closest(".form-group").hide();
|
||||
$("#id_lvm_snapname").closest(".form-group").hide();
|
||||
$("#id_lvm_snapsize").closest(".form-group").hide();
|
||||
$("#id_lvm_dirmount").closest(".form-group").hide();
|
||||
$("#id_lvm_volgroup").closest(".form-group").hide();
|
||||
$("#id_is_linux").closest(".form-group").hide();
|
||||
}
|
||||
|
||||
function is_windows() {
|
||||
|
@ -39,36 +34,20 @@ function showWindowsSnapshotOptions() {
|
|||
$("#id_vssadmin").closest(".form-group").show();
|
||||
}
|
||||
|
||||
function showLinuxSnapshotOptions() {
|
||||
$("#id_lvm_auto_snap").closest(".form-group").show();
|
||||
$("#id_lvm_srcvol").closest(".form-group").show();
|
||||
$("#id_lvm_snapname").closest(".form-group").show();
|
||||
$("#id_lvm_snapsize").closest(".form-group").show();
|
||||
$("#id_lvm_dirmount").closest(".form-group").show();
|
||||
$("#id_lvm_volgroup").closest(".form-group").show();
|
||||
function hideWindowsSnapshotOptions() {
|
||||
$("#id_vssadmin").closest(".form-group").hide();
|
||||
}
|
||||
|
||||
function hideLinuxSnapshotOptions() {
|
||||
$("#id_lvm_srcvol").closest(".form-group").hide();
|
||||
$("#id_lvm_snapname").closest(".form-group").hide();
|
||||
$("#id_lvm_snapsize").closest(".form-group").hide();
|
||||
$("#id_lvm_dirmount").closest(".form-group").hide();
|
||||
$("#id_lvm_volgroup").closest(".form-group").hide();
|
||||
$("#id_lvm_auto_snap").closest(".form-group").hide();
|
||||
}
|
||||
|
||||
function hideSnapshotOptions() {
|
||||
hideLinuxSnapshotOptions();
|
||||
$("#id_is_windows").closest(".form-group").hide();
|
||||
}
|
||||
|
||||
function showSnapshotOptions() {
|
||||
$("#id_is_windows").closest(".form-group").show();
|
||||
if (is_windows()) {
|
||||
hideLinuxSnapshotOptions();
|
||||
showWindowsSnapshotOptions();
|
||||
} else {
|
||||
showLinuxSnapshotOptions();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,4 +67,4 @@ $("#id_is_windows").click(function () {
|
|||
} else {
|
||||
hideSnapshotOptions();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue