From 540fe3f55286782bdc756cbe4b627bfe29bfccb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 10 Nov 2015 17:07:57 +0100 Subject: [PATCH] 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 --- core-modules/000QubesVm.py | 1 + qvm-tools/qvm-prefs | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index f5513520..90413bb2 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -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): diff --git a/qvm-tools/qvm-prefs b/qvm-tools/qvm-prefs index 96cb164d..dea3aa4f 100755 --- a/qvm-tools/qvm-prefs +++ b/qvm-tools/qvm-prefs @@ -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):