From 412bcfa88b9b4383ac1b71099f19998639dfd55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 15 Mar 2016 21:16:24 +0100 Subject: [PATCH] backup: fix hadling netvm property --- qubes/backup.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/qubes/backup.py b/qubes/backup.py index 9e182826..d58cff94 100644 --- a/qubes/backup.py +++ b/qubes/backup.py @@ -1851,8 +1851,11 @@ class BackupRestore(object): if not (netvm_name in restore_info.keys() and restore_info[netvm_name]['vm'].is_netvm()): if self.options.use_default_netvm: - vm_info['netvm'] = self.app.default_netvm.name - vm_info['vm'].uses_default_netvm = True + if self.app.default_netvm: + vm_info['netvm'] = self.app.default_netvm.name + else: + vm_info['netvm'] = None + vm_info['vm'].netvm = qubes.property.DEFAULT elif self.options.use_none_netvm: vm_info['netvm'] = None else: @@ -2236,13 +2239,19 @@ class BackupRestore(object): # TODO: add a setting for this? if not vm.property_is_default('kernel') and \ vm.kernel not in \ - os.listdir(qubes.config.system_path[ - 'qubes_kernels_base_dir']): - self.log.warning("WARNING: Kernel %s not installed, " + os.listdir(os.path.join(qubes.config.qubes_base_dir, + qubes.config.system_path[ + 'qubes_kernels_base_dir'])): + self.log.warning("Kernel %s not installed, " "using default one" % vm.kernel) vm.kernel = qubes.property.DEFAULT try: - new_vm.clone_properties(vm) + # exclude VM references - handled manually according to + # restore options + proplist = [prop for prop in new_vm.property_list() + if prop.clone and prop.__name__ not in + ['template', 'netvm', 'dispvm_netvm']] + new_vm.clone_properties(vm, proplist=proplist) except Exception as err: self.log.error("ERROR: {0}".format(err)) self.log.warning("*** Some VM property will not be "