Merge remote-tracking branch 'origin/pr/182'

* origin/pr/182:
  Added 'provides network' checkbox to VM settings
This commit is contained in:
Marek Marczykowski-Górecki 2019-06-10 03:48:13 +02:00
commit b2e6c1556a
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 32 additions and 6 deletions

View File

@ -747,6 +747,17 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
else:
self.dvm_template_checkbox.setVisible(False)
self.provides_network_checkbox.setChecked(
getattr(self.vm, 'provides_network', False))
if self.provides_network_checkbox.isChecked():
domains_using = [vm.name for vm in self.vm.connected_vms]
if domains_using:
self.provides_network_checkbox.setEnabled(False)
self.provides_network_checkbox.setToolTip(
"Cannot change this setting while this qube is used as a "
"NetVM by the following qubes:\n" +
"\n".join(domains_using))
def enable_seamless(self):
self.vm.run_service_for_stdio("qubes.SetGuiMode", input=b'SEAMLESS')
@ -817,6 +828,14 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
except Exception as ex: # pylint: disable=broad-except
msg.append(str(ex))
if getattr(self.vm, 'provides_network', False) != \
self.provides_network_checkbox.isChecked():
try:
self.vm.provides_network = \
self.provides_network_checkbox.isChecked()
except Exception as ex: # pylint: disable=broad-except
msg.append(str(ex))
return msg
def include_in_balancing_changed(self, state):

View File

@ -29,7 +29,7 @@
<locale language="English" country="UnitedStates"/>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="basic_tab">
<property name="locale">
@ -806,7 +806,7 @@ border-width: 1px;</string>
<property name="topMargin">
<number>15</number>
</property>
<item row="2" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Default DispVM:</string>
@ -816,17 +816,17 @@ border-width: 1px;</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="5" column="1">
<widget class="QComboBox" name="default_dispvm"/>
</item>
<item row="3" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QPushButton" name="boot_from_device_button">
<property name="text">
<string>Boot qube from CDROM</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="7" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QPushButton" name="seamless_on_button">
@ -852,7 +852,14 @@ The qube must be running to disable seamless mode; this setting is not persisten
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<item row="1" column="0">
<widget class="QCheckBox" name="provides_network_checkbox">
<property name="text">
<string>Provides network</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="dvm_template_checkbox">
<property name="toolTip">
<string/>