From 7a0bc9b863aa82a1393bff30886bdc675f02fd14 Mon Sep 17 00:00:00 2001 From: donoban Date: Tue, 16 Feb 2021 21:28:32 +0100 Subject: [PATCH] Join all connected VM's in same warning --- qubesmanager/qube_manager.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 4b54748..71f905d 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -1246,10 +1246,17 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow): if reply == QMessageBox.Yes: self.shutdown_vm(vm) + def get_connected_vms(self, vm, connected_vms): + for connected_vm in vm.connected_vms: + if connected_vm.is_running(): + connected_vms.append(connected_vm) + self.get_connected_vms(connected_vm, connected_vms) + def shutdown_vm(self, vm, shutdown_time=vm_shutdown_timeout, check_time=vm_restart_check_timeout, and_restart=False): try: - connected_vms = [x for x in vm.connected_vms if x.is_running()] + connected_vms = [] + self.get_connected_vms(vm, connected_vms) if len(connected_vms) > 0: reply = QMessageBox.question( @@ -1264,8 +1271,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow): return False for connected_vm in connected_vms: - if not self.shutdown_vm(connected_vm): - return False + connected_vm.shutdown(force=True) vm.shutdown(force=True) else: