Skip to content

Commit 8952805

Browse files
jnsnowphilmd
authored andcommitted
python/machine.py: Make wait() call shutdown()
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: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
1 parent c9b3045 commit 8952805

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

python/qemu/machine.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,6 @@ def _early_cleanup(self) -> None:
385385
self._console_socket.close()
386386
self._console_socket = None
387387

388-
def wait(self):
389-
"""
390-
Wait for the VM to power off
391-
"""
392-
self._early_cleanup()
393-
self._popen.wait()
394-
self._post_shutdown()
395-
396388
def shutdown(self, has_quit: bool = False,
397389
hard: bool = False,
398390
timeout: Optional[int] = 3) -> None:
@@ -421,6 +413,15 @@ def shutdown(self, has_quit: bool = False,
421413
def kill(self):
422414
self.shutdown(hard=True)
423415

416+
def wait(self, timeout: Optional[int] = None) -> None:
417+
"""
418+
Wait for the VM to power off and perform post-shutdown cleanup.
419+
420+
:param timeout: Optional timeout in seconds.
421+
Default None, an infinite wait.
422+
"""
423+
self.shutdown(has_quit=True, timeout=timeout)
424+
424425
def set_qmp_monitor(self, enabled=True):
425426
"""
426427
Set the QMP monitor.

0 commit comments

Comments
 (0)