Make sure that new value of uses_default_kernel persists

Prior to this commit, whenever the user selected the default kernel in
a VM's "Advanced Settings" dialog in Qubes Manager, the
"uses_default_kernel" flag would not be saved as expected. Instead of
the intent to use the default kernel version for the VM in the future,
the VM would be stuck with the specific kernel version and not any new
future default kernel versions.

This issue occurs because the "kernel" property setter for the QubesVm
class resets the "uses_default_kernel" member variable to False, and
Qubes Manager sets the "uses_default_kernel" property before setting the
"kernel" property.

Resolve this issue by making sure that the "uses_default_kernel"
member variable of the VM in question is set after the "kernel" member
variable.
This commit is contained in:
M. Vefa Bicakci 2017-05-26 01:40:14 -04:00
parent d551bdc3fa
commit a2d0b128b7
No known key found for this signature in database
GPG Key ID: 1DF87CE3B3A5DFAF

View File

@ -630,17 +630,21 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
if self.kernel.currentIndex() != self.kernel_idx:
new_kernel = str(self.kernel.currentText())
new_kernel = new_kernel.split(' ')[0]
uses_default_kernel = False
if new_kernel == "default":
kernel = self.qvm_collection.get_default_kernel()
self.vm.uses_default_kernel = True
uses_default_kernel = True
elif new_kernel == "none":
kernel = None
self.vm.uses_default_kernel = False
else:
kernel = new_kernel
self.vm.uses_default_kernel = False
self.vm.kernel = kernel
# Set self.vm.uses_default_kernel after self.vm.kernel to ensure that
# the correct value persists after QubesVm.kernel resets self.vm.uses_default_kernel
# to False.
self.vm.uses_default_kernel = uses_default_kernel
self.anything_changed = True
except Exception as ex:
msg.append(str(ex))