settings: do not assume that kernel is the last setting

This commit is contained in:
Marek Marczykowski-Górecki 2014-02-17 00:40:28 +01:00
parent 95e9680e96
commit 8e0a441dfe

View File

@ -457,8 +457,8 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
#in case VM is HVM #in case VM is HVM
if not hasattr(self.vm, "kernel"): if not hasattr(self.vm, "kernel"):
self.kernel_groupbox.setVisible(False) self.kernel_groupbox.setVisible(False)
return; else:
self.kernel_groupbox.setVisible(True)
# construct available kernels list # construct available kernels list
text = "default (" + self.qvm_collection.get_default_kernel() +")" text = "default (" + self.qvm_collection.get_default_kernel() +")"
kernel_list = [text] kernel_list = [text]
@ -505,34 +505,28 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
#include_in_memory_balancing applied in services tab #include_in_memory_balancing applied in services tab
#in case VM is not Linux #in case VM is not Linux
if not hasattr(self.vm, "kernel"): if hasattr(self.vm, "kernel") and self.kernel_groupbox.isVisible():
return msg
#kernel changed
if not self.kernel_groupbox.isVisible():
return msg
try: try:
if self.kernel.currentIndex() != self.kernel_idx: if self.kernel.currentIndex() != self.kernel_idx:
new_kernel = self.kernel.currentText() new_kernel = self.kernel.currentText()
new_kernel = new_kernel.split(' ')[0] new_kernel = new_kernel.split(' ')[0]
if(new_kernel == "default"): if new_kernel == "default":
kernel = self.qvm_collection.get_default_kernel() kernel = self.qvm_collection.get_default_kernel()
self.vm.uses_default_kernel = True self.vm.uses_default_kernel = True
elif(new_kernel == "none"): elif new_kernel == "none":
kernel = None kernel = None
self.vm.uses_default_kernel = False; self.vm.uses_default_kernel = False
else: else:
kernel = new_kernel kernel = new_kernel
self.vm.uses_default_kernel = False; self.vm.uses_default_kernel = False
self.vm.kernel = kernel self.vm.kernel = kernel
self.anything_changed = True self.anything_changed = True
except Exception as ex: except Exception as ex:
msg.append(str(ex)) msg.append(str(ex))
return msg return msg
######## devices tab ######## devices tab