]> Git Repo - qemu.git/commitdiff
python/machine.py: Make wait() call shutdown()
authorJohn Snow <[email protected]>
Fri, 10 Jul 2020 05:06:44 +0000 (01:06 -0400)
committerPhilippe Mathieu-Daudé <[email protected]>
Tue, 14 Jul 2020 20:22:22 +0000 (22:22 +0200)
At this point, shutdown(has_quit=True) and wait() do essentially the
same thing; they perform cleanup without actually instructing QEMU to
quit.

Define one in terms of the other.

Signed-off-by: John Snow <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Cleber Rosa <[email protected]>
Tested-by: Cleber Rosa <[email protected]>
Message-Id: <20200710050649[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
python/qemu/machine.py

index e825f0bdc60e8fb8d67823ab6b3a6d13391c668d..3f0b873f5810ce7d11c01d56283ebd0e800ac5f9 100644 (file)
@@ -385,14 +385,6 @@ class QEMUMachine:
             self._console_socket.close()
             self._console_socket = None
 
-    def wait(self):
-        """
-        Wait for the VM to power off
-        """
-        self._early_cleanup()
-        self._popen.wait()
-        self._post_shutdown()
-
     def shutdown(self, has_quit: bool = False,
                  hard: bool = False,
                  timeout: Optional[int] = 3) -> None:
@@ -421,6 +413,15 @@ class QEMUMachine:
     def kill(self):
         self.shutdown(hard=True)
 
+    def wait(self, timeout: Optional[int] = None) -> None:
+        """
+        Wait for the VM to power off and perform post-shutdown cleanup.
+
+        :param timeout: Optional timeout in seconds.
+                        Default None, an infinite wait.
+        """
+        self.shutdown(has_quit=True, timeout=timeout)
+
     def set_qmp_monitor(self, enabled=True):
         """
         Set the QMP monitor.
This page took 0.028316 seconds and 4 git commands to generate.