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 "
"file" % (new_value, f))
self._kernel = new_value
self.uses_default_kernel = False
@property
def updateable(self):

View File

@ -285,7 +285,7 @@ def set_dispvm_netvm(vms, vm, args):
return True
def set_kernel(vms, vm, args):
if len (args) != 1:
if len(args) != 1:
print >> sys.stderr, "Missing kernel version argument!"
print >> sys.stderr, "Possible values:"
print >> sys.stderr, "1) default"
@ -297,18 +297,16 @@ def set_kernel(vms, vm, args):
kernel = args[0]
if kernel == "default":
kernel = vms.get_default_kernel()
vm.kernel = vms.get_default_kernel()
vm.uses_default_kernel = True
elif kernel == "none":
kernel = None
vm.uses_default_kernel = False
vm.kernel = None
else:
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)
return False
vm.uses_default_kernel = False
vm.kernel = kernel
vm.kernel = kernel
return True
def set_template(vms, vm, args):