Added an Advanced tab to Create New Qube dialog
Tab contains a warning, provides_network checkbox, install_system_after_creation checkbox, storage pool settings and initial RAM. references QubesOS/qubes-issues#5127 fixes QubeSOS/qubes-issues#5198
This commit is contained in:
parent
1ced452976
commit
d85940c5a5
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python2
|
#!/usr/bin/python3
|
||||||
#
|
#
|
||||||
# The Qubes OS Project, http://www.qubes-os.org
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
#
|
#
|
||||||
@ -37,7 +37,8 @@ from .ui_newappvmdlg import Ui_NewVMDlg # pylint: disable=import-error
|
|||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class CreateVMThread(QtCore.QThread):
|
class CreateVMThread(QtCore.QThread):
|
||||||
def __init__(self, app, vmclass, name, label, template, properties):
|
def __init__(self, app, vmclass, name, label, template, properties,
|
||||||
|
pool):
|
||||||
QtCore.QThread.__init__(self)
|
QtCore.QThread.__init__(self)
|
||||||
self.app = app
|
self.app = app
|
||||||
self.vmclass = vmclass
|
self.vmclass = vmclass
|
||||||
@ -45,6 +46,7 @@ class CreateVMThread(QtCore.QThread):
|
|||||||
self.label = label
|
self.label = label
|
||||||
self.template = template
|
self.template = template
|
||||||
self.properties = properties
|
self.properties = properties
|
||||||
|
self.pool = pool
|
||||||
self.msg = None
|
self.msg = None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@ -54,15 +56,29 @@ class CreateVMThread(QtCore.QThread):
|
|||||||
src_vm = self.app.default_template
|
src_vm = self.app.default_template
|
||||||
else:
|
else:
|
||||||
src_vm = self.template
|
src_vm = self.template
|
||||||
vm = self.app.clone_vm(src_vm, self.name, self.vmclass,
|
|
||||||
ignore_volumes=['private'])
|
args = {
|
||||||
|
'ignore_volumes': ['private']
|
||||||
|
}
|
||||||
|
if self.pool:
|
||||||
|
args['pool'] = self.pool
|
||||||
|
|
||||||
|
vm = self.app.clone_vm(src_vm, self.name, self.vmclass, **args)
|
||||||
|
|
||||||
vm.label = self.label
|
vm.label = self.label
|
||||||
for k, v in self.properties.items():
|
for k, v in self.properties.items():
|
||||||
setattr(vm, k, v)
|
setattr(vm, k, v)
|
||||||
else:
|
else:
|
||||||
vm = self.app.add_new_vm(
|
args = {
|
||||||
self.vmclass, name=self.name,
|
"name": self.name,
|
||||||
label=self.label, template=self.template)
|
"label": self.label,
|
||||||
|
"template": self.template
|
||||||
|
}
|
||||||
|
if self.pool:
|
||||||
|
args['pool'] = self.pool
|
||||||
|
|
||||||
|
vm = self.app.add_new_vm(self.vmclass, **args)
|
||||||
|
|
||||||
for k, v in self.properties.items():
|
for k, v in self.properties.items():
|
||||||
setattr(vm, k, v)
|
setattr(vm, k, v)
|
||||||
|
|
||||||
@ -107,6 +123,16 @@ class NewVmDlg(QtWidgets.QDialog, Ui_NewVMDlg):
|
|||||||
(lambda vm: vm.provides_network),
|
(lambda vm: vm.provides_network),
|
||||||
allow_internal=False, allow_default=True, allow_none=True)
|
allow_internal=False, allow_default=True, allow_none=True)
|
||||||
|
|
||||||
|
self.pool_list, self.pool_idx = utils.prepare_choice(
|
||||||
|
widget=self.storage_pool,
|
||||||
|
holder=None,
|
||||||
|
propname=None,
|
||||||
|
choice=self.app.pools.values(),
|
||||||
|
default=self.app.default_pool,
|
||||||
|
allow_default=True,
|
||||||
|
allow_none=False
|
||||||
|
)
|
||||||
|
|
||||||
self.name.setValidator(QtGui.QRegExpValidator(
|
self.name.setValidator(QtGui.QRegExpValidator(
|
||||||
QtCore.QRegExp("[a-zA-Z0-9_-]*", QtCore.Qt.CaseInsensitive), None))
|
QtCore.QRegExp("[a-zA-Z0-9_-]*", QtCore.Qt.CaseInsensitive), None))
|
||||||
self.name.selectAll()
|
self.name.selectAll()
|
||||||
@ -163,8 +189,17 @@ class NewVmDlg(QtWidgets.QDialog, Ui_NewVMDlg):
|
|||||||
properties['virt_mode'] = 'hvm'
|
properties['virt_mode'] = 'hvm'
|
||||||
properties['kernel'] = None
|
properties['kernel'] = None
|
||||||
|
|
||||||
|
if self.pool_list[self.storage_pool.currentIndex()] is not \
|
||||||
|
qubesadmin.DEFAULT:
|
||||||
|
pool = self.pool_list[self.storage_pool.currentIndex()]
|
||||||
|
else:
|
||||||
|
pool = None
|
||||||
|
|
||||||
|
if self.init_ram.value() > 0:
|
||||||
|
properties['memory'] = self.init_ram.value()
|
||||||
|
|
||||||
self.thread = CreateVMThread(
|
self.thread = CreateVMThread(
|
||||||
self.app, vmclass, name, label, template, properties)
|
self.app, vmclass, name, label, template, properties, pool)
|
||||||
self.thread.finished.connect(self.create_finished)
|
self.thread.finished.connect(self.create_finished)
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
||||||
|
@ -15,128 +15,231 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset theme="qubes-manager">
|
<iconset theme="qubes-manager">
|
||||||
<normaloff/>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="geometry">
|
<item row="1" column="0">
|
||||||
<rect>
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<x>450</x>
|
<property name="orientation">
|
||||||
<y>260</y>
|
<enum>Qt::Horizontal</enum>
|
||||||
<width>160</width>
|
</property>
|
||||||
<height>27</height>
|
<property name="standardButtons">
|
||||||
</rect>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
</widget>
|
||||||
<enum>Qt::Horizontal</enum>
|
</item>
|
||||||
</property>
|
<item row="0" column="0">
|
||||||
<property name="standardButtons">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||||
</widget>
|
<horstretch>0</horstretch>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<verstretch>0</verstretch>
|
||||||
<property name="geometry">
|
</sizepolicy>
|
||||||
<rect>
|
</property>
|
||||||
<x>0</x>
|
<property name="currentIndex">
|
||||||
<y>10</y>
|
<number>0</number>
|
||||||
<width>611</width>
|
</property>
|
||||||
<height>241</height>
|
<widget class="QWidget" name="tabWidgetPage1">
|
||||||
</rect>
|
<attribute name="title">
|
||||||
</property>
|
<string>Basic</string>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
</attribute>
|
||||||
<item row="2" column="0">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<widget class="QLabel" name="template_label">
|
<property name="leftMargin">
|
||||||
<property name="text">
|
<number>12</number>
|
||||||
<string>Template:</string>
|
</property>
|
||||||
</property>
|
<property name="topMargin">
|
||||||
<property name="buddy">
|
<number>12</number>
|
||||||
<cstring>template_vm</cstring>
|
</property>
|
||||||
</property>
|
<property name="rightMargin">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="netvm_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Networking:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="3">
|
||||||
|
<widget class="QComboBox" name="vm_type"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="3">
|
||||||
|
<widget class="QComboBox" name="template_vm"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="template_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Template:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="name_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name and label:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="name">
|
||||||
|
<property name="text">
|
||||||
|
<string>my-new-qube</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QComboBox" name="label">
|
||||||
|
<property name="frame">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1" colspan="3">
|
||||||
|
<widget class="QCheckBox" name="launch_settings">
|
||||||
|
<property name="text">
|
||||||
|
<string>launch settings after creation</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1" colspan="3">
|
||||||
|
<widget class="QComboBox" name="netvm"/>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
<widget class="QWidget" name="tab">
|
||||||
<item row="6" column="0">
|
<attribute name="title">
|
||||||
<widget class="QLabel" name="netvm_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Networking:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>template_vm</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="install_system">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>install system from device (also available from settings)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="launch_settings">
|
|
||||||
<property name="text">
|
|
||||||
<string>launch settings after creation</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" colspan="3">
|
|
||||||
<widget class="QComboBox" name="template_vm"/>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="provides_network">
|
|
||||||
<property name="text">
|
|
||||||
<string>provides network</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="name_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Name and label:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>name</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QComboBox" name="label">
|
|
||||||
<property name="frame">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Advanced</string>
|
<string>Advanced</string>
|
||||||
</property>
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QSpinBox" name="init_ram">
|
||||||
|
<property name="specialValueText">
|
||||||
|
<string>(default)</string>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> MB</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>90000000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p><span style=" font-weight:600;">Caution</span>: changing these settings can compromise your system or make the qube unable to boot. Use only if you know what you are doing.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="storage_pool">
|
||||||
|
<property name="currentText">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Storage pool</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Initial RAM (also available from settings)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="install_system">
|
||||||
|
<property name="text">
|
||||||
|
<string>install system from device (also available from settings)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="provides_network">
|
||||||
|
<property name="text">
|
||||||
|
<string>provides network to other qubes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</widget>
|
||||||
<item row="6" column="1" colspan="3">
|
</item>
|
||||||
<widget class="QComboBox" name="netvm"/>
|
</layout>
|
||||||
</item>
|
|
||||||
<item row="0" column="1" colspan="2">
|
|
||||||
<widget class="QLineEdit" name="name">
|
|
||||||
<property name="text">
|
|
||||||
<string>my-new-qube</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" colspan="3">
|
|
||||||
<widget class="QComboBox" name="vm_type"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Type:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>name</tabstop>
|
<tabstop>name</tabstop>
|
||||||
@ -144,9 +247,7 @@
|
|||||||
<tabstop>vm_type</tabstop>
|
<tabstop>vm_type</tabstop>
|
||||||
<tabstop>template_vm</tabstop>
|
<tabstop>template_vm</tabstop>
|
||||||
<tabstop>netvm</tabstop>
|
<tabstop>netvm</tabstop>
|
||||||
<tabstop>provides_network</tabstop>
|
|
||||||
<tabstop>launch_settings</tabstop>
|
<tabstop>launch_settings</tabstop>
|
||||||
<tabstop>install_system</tabstop>
|
|
||||||
<tabstop>buttonBox</tabstop>
|
<tabstop>buttonBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
Loading…
Reference in New Issue
Block a user