qubes/backup: better handle restoring kernel=None case

It makes sense for HVM domains, so allow such configuration.
This commit is contained in:
Marek Marczykowski-Górecki 2016-08-17 01:18:11 +02:00
parent 5d8ecd60de
commit bbbe045b62
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1844,9 +1844,12 @@ class BackupRestore(object):
installed_kernels = os.listdir(os.path.join( installed_kernels = os.listdir(os.path.join(
qubes.config.qubes_base_dir, qubes.config.qubes_base_dir,
qubes.config.system_path['qubes_kernels_base_dir'])) qubes.config.system_path['qubes_kernels_base_dir']))
if not vm_info.vm.property_is_default('kernel') \ # if uses default kernel - do not validate it
and vm_info.vm.kernel \ # allow kernel=None only for HVM,
and vm_info.vm.kernel not in installed_kernels: # otherwise require valid kernel
if not (vm_info.vm.property_is_default('kernel')
or (not vm_info.vm.kernel and vm_info.vm.hvm)
or vm_info.vm.kernel in installed_kernels):
if self.options.use_default_kernel: if self.options.use_default_kernel:
vm_info.vm.kernel = qubes.property.DEFAULT vm_info.vm.kernel = qubes.property.DEFAULT
else: else: