From 2987320b2f82eb316607e5b3b9835e1c3281af55 Mon Sep 17 00:00:00 2001 From: Agnieszka Kostrzewa Date: Tue, 13 Mar 2012 22:05:50 +0100 Subject: [PATCH] Advanced tab (mem/cpu) --- qubesmanager/settings.py | 26 ++++++++++++++++++++++++++ settingsdlg.ui | 16 ++++++++-------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 1895530..0969a20 100644 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -336,6 +336,18 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog): def __init_advanced_tab__(self): + #mem/cpu + self.mem_size.setText(str(self.vm.memory)) + + self.max_mem_size.setValue(int(self.vm.maxmem)) + self.max_mem_size.setMaximum(QubesHost().memory_total/1024) + + self.vcpus.setMinimum(1); + self.vcpus.setMaximum(QubesHost().no_cpus) + self.vcpus.setValue(int(self.vm.vcpus)) + + self.include_in_balancing.setChecked('meminfo-writer' in self.vm.services and self.vm.services['meminfo-writer']==True) + #kernel if self.vm.template is not None: text = self.vm.kernel @@ -379,6 +391,20 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog): def __apply_advanced_tab__(self): + #mem/cpu + if self.max_mem_size.value() != int(self.vm.maxmem): + self.vm.maxmem = self.max_mem_size.value() + self.anything_changed = True + + if self.vcpus.value() != int(self.vm.vcpus): + self.vm.vcpus = self.vcpus.value() + self.anything_changed = True + + balancing_was_checked = ('meminfo-writer' in self.vm.services and self.vm.services['meminfo-writer']==True) + if self.include_in_balancing.isChecked() != balancing_was_checked: + self.vm.services['meminfo-writer'] = self.include_in_balancing.isChecked() + self.anything_changed = True + #kernel changed if self.kernel.currentIndex() != self.kernel_idx: new_kernel = self.kernel.currentText() diff --git a/settingsdlg.ui b/settingsdlg.ui index 6a3ec84..9afafcc 100644 --- a/settingsdlg.ui +++ b/settingsdlg.ui @@ -29,7 +29,7 @@ - 3 + 1 @@ -297,7 +297,7 @@ - false + true Memory/CPU @@ -306,7 +306,7 @@ - false + true Initial memory: @@ -316,7 +316,7 @@ - false + true @@ -335,7 +335,7 @@ - false + true MB @@ -352,7 +352,7 @@ - false + true Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -388,7 +388,7 @@ - false + true Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -401,7 +401,7 @@ - false + true Include in memory balancing