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 "
|
"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):
|
||||||
|
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user