Skip to content

Commit

Permalink
Fix setting netvm to the default one
Browse files Browse the repository at this point in the history
self._get_default_netvm() returns a QubesVm object, while
self.qubes_cache.get_vm returns VmInfo object. Extract QubesVm in the
second case too, to make handling uniform. And also deal with default
netvm being None.

(cherry picked from commit a2a2a9d)
  • Loading branch information
marmarek committed Jun 22, 2023
1 parent b7858e5 commit f5230bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,8 @@ def change_network(self, netvm_name):
netvm = self._get_default_netvm()
else:
netvm = self.qubes_cache.get_vm(name=netvm_name)
if check_power and netvm.state['power'] != 'Running':
netvm = netvm.vm
if check_power and netvm and not netvm.is_running():
reply = QMessageBox.question(
self, self.tr("Qube Start Confirmation"),
self.tr("<br>Can not change netvm to a halted Qube.<br>"
Expand All @@ -889,7 +890,7 @@ def change_network(self, netvm_name):
QMessageBox.Yes | QMessageBox.Cancel)

if reply == QMessageBox.Yes:
self.start_vm(netvm.vm, True)
self.start_vm(netvm, True)
else:
return

Expand Down

0 comments on commit f5230bd

Please sign in to comment.