core: set vm.uses_default_kernel=False when setting vm.kernel

Forgetting this leads to misterious errors (VM started with different
kernel than it was just set), so simplify the API.

Fixes QubesOS/qubes-issues#1400
This commit is contained in:
Marek Marczykowski-Górecki 2015-11-10 17:07:57 +01:00
parent ba54792c83
commit 540fe3f552
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 5 additions and 6 deletions

View File

@ -526,6 +526,7 @@ class QubesVm(object):
"Kernel '%s' not properly installed: missing %s " "Kernel '%s' not properly installed: missing %s "
"file" % (new_value, f)) "file" % (new_value, f))
self._kernel = new_value self._kernel = new_value
self.uses_default_kernel = False
@property @property
def updateable(self): def updateable(self):

View File

@ -297,18 +297,16 @@ def set_kernel(vms, vm, args):
kernel = args[0] kernel = args[0]
if kernel == "default": if kernel == "default":
kernel = vms.get_default_kernel() vm.kernel = vms.get_default_kernel()
vm.uses_default_kernel = True vm.uses_default_kernel = True
elif kernel == "none": elif kernel == "none":
kernel = None vm.kernel = None
vm.uses_default_kernel = False
else: else:
if not os.path.exists(os.path.join(system_path["qubes_kernels_base_dir"], kernel)): if not os.path.exists(os.path.join(system_path["qubes_kernels_base_dir"], kernel)):
print >> sys.stderr, "Kernel version {0} not installed.".format(kernel) print >> sys.stderr, "Kernel version {0} not installed.".format(kernel)
return False return False
vm.uses_default_kernel = False
vm.kernel = kernel vm.kernel = kernel
return True return True
def set_template(vms, vm, args): def set_template(vms, vm, args):