From 50df2c8ca3e1083ea53a0937a83a35bb9ed1d499 Mon Sep 17 00:00:00 2001 From: Pengju Jiao Date: Fri, 11 Aug 2017 23:15:55 +0800 Subject: [PATCH] Fix backup nova instance with creating job error Currently, it will fail when doing nova backup with creating a backup job. It is because freezer-scheduler will call freezer-agent with '--config config-file', but the config opts in config-file (from job file) were not parsed to CONF, at the same time EngineManager uses the CONF.engine_name(now it is the default 'tar'), this will lead the code go into wrong branch, although it will not throw errors and show the backup is success, but when doing restore after this, we can find that the backup data can not be used and print EOF error in log file. This patch will fix the above issue. Change-Id: I826e4ed71dfd2cde6103e8432faba7adb4648c36 Closes-Bug: #1710238 --- freezer/common/config.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/freezer/common/config.py b/freezer/common/config.py index e6cf9127..d9bf3b76 100644 --- a/freezer/common/config.py +++ b/freezer/common/config.py @@ -20,6 +20,7 @@ import sys import tempfile from oslo_config import cfg +from oslo_config.cfg import NoSuchOptError from oslo_log import log from oslo_utils import encodeutils @@ -550,6 +551,12 @@ def get_backup_args(): defaults['log_config_append'] = None defaults.update(conf.default) + for config_key in conf.default.keys(): + try: + CONF.set_override(config_key, conf.default[config_key]) + except NoSuchOptError: + LOG.debug('No such opt, {0}, so set it'.format(config_key)) + setattr(CONF, config_key, conf.default[config_key]) if defaults['log_file']: CONF.set_override('log_file', defaults['log_file'])