use force=True when restarting a netvm with connected vms

This commit is contained in:
donoban 2021-02-16 22:08:51 +01:00
parent 7a0bc9b863
commit 60dbeabfb4
No known key found for this signature in database
GPG Key ID: 141310D8E3ED08A5

View File

@ -1252,11 +1252,13 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
connected_vms.append(connected_vm) connected_vms.append(connected_vm)
self.get_connected_vms(connected_vm, connected_vms) self.get_connected_vms(connected_vm, connected_vms)
def shutdown_vm(self, vm, shutdown_time=vm_shutdown_timeout, def shutdown_vm(self, vm, shutdown_time=vm_shutdown_timeout, force=False,
check_time=vm_restart_check_timeout, and_restart=False): check_time=vm_restart_check_timeout, and_restart=False):
try: try:
connected_vms = [] connected_vms = []
self.get_connected_vms(vm, connected_vms)
if not and_restart:
self.get_connected_vms(vm, connected_vms)
if len(connected_vms) > 0: if len(connected_vms) > 0:
reply = QMessageBox.question( reply = QMessageBox.question(
@ -1270,12 +1272,12 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
if reply != QMessageBox.Yes: if reply != QMessageBox.Yes:
return False return False
force=True
shutdown_time = shutdown_time * len(connected_vms)
for connected_vm in connected_vms: for connected_vm in connected_vms:
connected_vm.shutdown(force=True) connected_vm.shutdown(force=force)
vm.shutdown(force=True) vm.shutdown(force=force)
else:
vm.shutdown()
except exc.QubesException as ex: except exc.QubesException as ex:
QMessageBox.warning( QMessageBox.warning(
self, self,
@ -1308,7 +1310,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
# in case the user shut down the VM in the meantime # in case the user shut down the VM in the meantime
try: try:
if manager_utils.is_running(vm, False): if manager_utils.is_running(vm, False):
self.shutdown_vm(vm, and_restart=True) self.shutdown_vm(vm, force=True, and_restart=True)
else: else:
self.start_vm(vm) self.start_vm(vm)
except exc.QubesException as ex: except exc.QubesException as ex: