Skip to content

Commit

Permalink
Improve experience when changing netvm in vm settings
Browse files Browse the repository at this point in the history
If user tries to change netvm of a running vm to
a halted netvm, asks if they want to start
that halted netvm.

related to QubesOS/qubes-issues#8165
  • Loading branch information
marmarta committed May 13, 2023
1 parent cfe4797 commit 7e22e33
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion qubesmanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,26 @@ def __apply_basic_tab__(self):
# vm netvm changed
try:
if utils.did_widget_selection_change(self.netVM):
self.vm.netvm = self.netVM.currentData()
if self.netVM.currentData() == qubesadmin.DEFAULT:
netvm = self.vm.property_get_default('netvm')
else:
netvm = self.netVM.currentData()
if self.vm.get_power_state() == 'Running' and netvm and \
netvm.get_power_state() != 'Running':
reply = QtWidgets.QMessageBox.question(
self, self.tr("Qube Start Confirmation"),
self.tr("<br>Can not change netvm of a running qube"
"to a halted Qube.<br>"
"Do you want to start the Qube"
" <b>'{0}'</b>?").format(netvm.name),
QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.Cancel)

if reply == QtWidgets.QMessageBox.Yes:
netvm.start()
self.vm.netvm = self.netVM.currentData()
else:
self.vm.netvm = self.netVM.currentData()
except qubesadmin.exc.QubesException as ex:
msg.append(str(ex))

Expand Down

0 comments on commit 7e22e33

Please sign in to comment.