From 8ff423dc9a7c5c25c00d07391caa727b29ac5d8b Mon Sep 17 00:00:00 2001 From: Wojciech Zygmunt Porczyk Date: Wed, 25 Jun 2014 16:00:32 +0200 Subject: [PATCH] Fix ignore-username-mismatch (#859) --- core/backup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/backup.py b/core/backup.py index fddd8cbb..9788be5a 100644 --- a/core/backup.py +++ b/core/backup.py @@ -1227,6 +1227,8 @@ def backup_restore_set_defaults(options): options['dom0-home'] = True if 'replace-template' not in options: options['replace-template'] = [] + if 'ignore-username-mismatch' not in options: + options['ignore-username-mismatch'] = False return options @@ -1506,7 +1508,9 @@ def backup_restore_prepare(backup_location, passphrase, options = {}, vms_to_restore['dom0']['username'] = os.path.basename(dom0_home) if vms_to_restore['dom0']['username'] != local_user: vms_to_restore['dom0']['username-mismatch'] = True - if not options['ignore-dom0-username-mismatch']: + if options['ignore-username-mismatch']: + vms_to_restore['dom0']['ignore-username-mismatch'] = True + else: vms_to_restore['dom0']['good-to-go'] = False if 'good-to-go' not in vms_to_restore['dom0']: @@ -1613,6 +1617,8 @@ def backup_restore_print_summary(restore_info, print_callback = print_stdout): s += fmt.format("") if 'username-mismatch' in restore_info['dom0']: s += " <-- username in backup and dom0 mismatch" + if 'ignore-username-mismatch' in restore_info['dom0']: + s += " (ignored)" print_callback(s)