settings: add an option to resize root.img (#699)

This commit is contained in:
Marek Marczykowski-Górecki 2014-03-21 18:40:23 +01:00
parent 9cc18228a0
commit 4f77108c5f
2 changed files with 49 additions and 10 deletions

View File

@ -306,6 +306,12 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
self.max_priv_storage.setMinimum(self.priv_img_size) self.max_priv_storage.setMinimum(self.priv_img_size)
self.max_priv_storage.setValue(self.priv_img_size) self.max_priv_storage.setValue(self.priv_img_size)
self.root_img_size = self.vm.get_root_img_sz()/1024/1024
self.root_resize.setValue(self.root_img_size)
self.root_resize.setMinimum(self.root_img_size)
self.root_resize.setEnabled(hasattr(self.vm, 'resize_root_img') and
not self.vm.template)
self.root_resize_label.setEnabled(self.root_resize.isEnabled())
def __apply_basic_tab__(self): def __apply_basic_tab__(self):
msg = [] msg = []
@ -398,6 +404,14 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
except Exception as ex: except Exception as ex:
msg.append(str(ex)) msg.append(str(ex))
#max sys storage
sys_size = self.root_resize.value()
if self.root_img_size != sys_size:
try:
self.vm.resize_root_img(sys_size*1024*1024)
self.anything_changed = True
except Exception as ex:
msg.append(str(ex))
return msg return msg

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>694</width> <width>704</width>
<height>483</height> <height>483</height>
</rect> </rect>
</property> </property>
@ -183,13 +183,22 @@
<string>Disk storage</string> <string>Disk storage</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0"> <item row="1" column="1">
<widget class="QLabel" name="label_3"> <widget class="QSpinBox" name="root_resize">
<property name="text"> <property name="enabled">
<string>Private storage max. size:</string> <bool>true</bool>
</property> </property>
<property name="buddy"> <property name="alignment">
<cstring>max_priv_storage</cstring> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix">
<string>MB</string>
</property>
<property name="maximum">
<number>1048576</number>
</property>
<property name="singleStep">
<number>1024</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -201,6 +210,9 @@
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
<property name="suffix">
<string>MB</string>
</property>
<property name="minimum"> <property name="minimum">
<number>0</number> <number>0</number>
</property> </property>
@ -215,10 +227,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>MB</string> <string>Private storage max. size:</string>
</property>
<property name="buddy">
<cstring>max_priv_storage</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="root_resize_label">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>System storage max. size:</string>
</property> </property>
</widget> </widget>
</item> </item>