소스 검색

Check if VM needs killing before murdering it

In some cases, when the user waited some time before force-killing a VM,
it could be already dead.

fixes QubesOS/qubes-issues#3730
Marta Marczykowska-Górecka 6 년 전
부모
커밋
20cabb5563
2개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      qubesmanager/qube_manager.py
  2. 3 0
      test-packages/qubesadmin/exc.py

+ 6 - 1
qubesmanager/qube_manager.py

@@ -192,7 +192,12 @@ class VmShutdownMonitor(QtCore.QObject):
                     self.tr("Wait another {0} seconds...").format(
                         self.shutdown_time / 1000))
                 if reply == 0:
-                    vm.kill()
+                    try:
+                        vm.kill()
+                    except exc.QubesVMNotStartedError:
+                        # the VM shut down while the user was thinking about
+                        # shutting it down
+                        pass
                     self.restart_vm_if_needed()
                 else:
                     self.shutdown_started = datetime.now()

+ 3 - 0
test-packages/qubesadmin/exc.py

@@ -4,3 +4,6 @@
 
 class QubesException(BaseException):
     pass
+
+class QubesVMNotStartedError(BaseException):
+    pass