Advanced tab (mem/cpu)

This commit is contained in:
Agnieszka Kostrzewa 2012-03-13 22:05:50 +01:00
parent b9e361d468
commit 2987320b2f
2 changed files with 34 additions and 8 deletions

View File

@ -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()

View File

@ -29,7 +29,7 @@
<locale language="English" country="UnitedStates"/>
</property>
<property name="currentIndex">
<number>3</number>
<number>1</number>
</property>
<widget class="QWidget" name="basic_tab">
<property name="locale">
@ -297,7 +297,7 @@
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="title">
<string>Memory/CPU</string>
@ -306,7 +306,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_15">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Initial memory:</string>
@ -316,7 +316,7 @@
<item row="0" column="1">
<widget class="QLabel" name="mem_size">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="font">
<font>
@ -335,7 +335,7 @@
<item row="0" column="2">
<widget class="QLabel" name="label_16">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>MB</string>
@ -352,7 +352,7 @@
<item row="1" column="1">
<widget class="QSpinBox" name="max_mem_size">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -388,7 +388,7 @@
<item row="2" column="1">
<widget class="QSpinBox" name="vcpus">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -401,7 +401,7 @@
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="include_in_balancing">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Include in memory balancing</string>