Fixed incorrect memory checking in VM Settings

When a VM is not included in memory balancing, there is no point
(and it can be actively harmful via deception) in showing warnings
about init_mem and maxmem mismatch.

fixes QubesOS/qubes-issues#5306
This commit is contained in:
Marta Marczykowska-Górecka 2020-04-06 15:27:52 +02:00
parent f1ad829d71
commit b058db4ccf
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -519,6 +519,10 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
return msg return msg
def check_mem_changes(self): def check_mem_changes(self):
if not self.include_in_balancing.isChecked():
# do not interfere with settings if the VM is not included in memory
# balancing
return
if self.max_mem_size.value() < self.init_mem.value(): if self.max_mem_size.value() < self.init_mem.value():
QtWidgets.QMessageBox.warning( QtWidgets.QMessageBox.warning(
self, self,
@ -850,6 +854,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
self.dmm_warning_adv.hide() self.dmm_warning_adv.hide()
self.dmm_warning_dev.hide() self.dmm_warning_dev.hide()
self.max_mem_size.setEnabled(self.include_in_balancing.isChecked()) self.max_mem_size.setEnabled(self.include_in_balancing.isChecked())
if self.include_in_balancing.isChecked():
self.check_mem_changes()
def boot_from_cdrom_button_pressed(self): def boot_from_cdrom_button_pressed(self):
self.save_and_apply() self.save_and_apply()