From 357117beff3df5e99960a23ed26817fd7c78e2d1 Mon Sep 17 00:00:00 2001 From: Jakub Jursa Date: Thu, 17 May 2018 13:05:12 +0200 Subject: [PATCH] Added engine_name parameter to action creation. With implementation of new engines (nova, rsync, ...) a regression was introduced - user is no longer able to create working action for nova instance backup because config generated by freezer-scheduler passed to freezer-agent doesn't contain 'engine_name' thus falling back to default value 'tar' even when 'mode' is set to 'nova'. This patch adds possibility to specify 'engine_name' in web UI which is then passed to freezer-scheduler job cfg. Change-Id: Ifc4ed728db369da54fecef3c2ecf4dfcbfe4fefb --- disaster_recovery/actions/workflows/action.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/disaster_recovery/actions/workflows/action.py b/disaster_recovery/actions/workflows/action.py index e42422e..44bb126 100644 --- a/disaster_recovery/actions/workflows/action.py +++ b/disaster_recovery/actions/workflows/action.py @@ -41,6 +41,18 @@ class ActionConfigurationAction(workflows.Action): storage = forms.ChoiceField( help_text=_("Set storage backend for a backup")) + engine_name = forms.ChoiceField( + help_text=_("Engine to be used for backup/restore. " + "With tar, the file inode will be checked for changes " + "amid backup execution. If the file inode changed, the " + "whole file will be backed up. With rsync, the data " + "blocks changes will be verified and only the changed " + "blocks will be backed up. Tar is faster, but is uses " + "more space and bandwidth. Rsync is slower, but uses " + "less space and bandwidth. Nova engine can be used to" + " backup/restore running instances. Backing up instances" + " and it's metadata.")) + mysql_conf = forms.CharField( label=_("MySQL Configuration File *"), help_text=_("Set the path where the MySQL configuration file " @@ -247,6 +259,15 @@ class ActionConfigurationAction(workflows.Action): ('ssh', _("SSH")), ] + def populate_engine_name_choices(self, request, context): + return [ + ('tar', _("tar")), + ('rsync', _("rsync")), + ('rsyncv2', _("rsyncv2")), + ('nova', _("nova")), + ('osbrick', _("osbrick")), + ] + def __init__(self, request, context, *args, **kwargs): self.request = request self.context = context @@ -265,6 +286,7 @@ class ActionConfiguration(workflows.Step): 'action', 'mode', 'storage', + 'engine_name', 'backup_name', 'mysql_conf', 'sql_server_conf',