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:
parent
ba54792c83
commit
540fe3f552
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user