From bbe14f524db2a914efeab5840cbd76afe5d2a2ad Mon Sep 17 00:00:00 2001 From: Aras Ergus Date: Sat, 17 Aug 2019 15:42:36 +0200 Subject: [PATCH] Fix arithmetic in init/max mem ratio correction Qubes Manager seems to try to guarantee that 10*init_mem is at least max_mem by automatically adjusting init_mem to max_mem/10 if inappropriate values are set. However, this may not guarantee that 10*init_mem >= max_mem due to rounding errors. This change fixes these edge cases by basically rounding up the result of division by 10. --- qubesmanager/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index f7c8908..71c1be4 100644 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -551,7 +551,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): self.tr("Initial memory can not be less than one tenth " "Max memory.
Setting initial memory to the minimum " "allowed value.")) - self.init_mem.setValue(self.max_mem_size.value() / 10) + self.init_mem.setValue((self.max_mem_size.value() + 9) // 10) def check_warn_dispvmnetvm(self): if not hasattr(self.vm, 'default_dispvm'):