aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/qemu/machine.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index ca1f2114e6..d3faa9a84c 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -294,6 +294,10 @@ class QEMUMachine:
self._qmp.accept()
def _post_shutdown(self):
+ if self._qmp:
+ self._qmp.close()
+ self._qmp = None
+
self._load_io_log()
if self._qemu_log_file is not None:
@@ -366,8 +370,6 @@ class QEMUMachine:
Wait for the VM to power off
"""
self._popen.wait()
- if self._qmp:
- self._qmp.close()
self._post_shutdown()
def shutdown(self, has_quit=False, hard=False):
@@ -388,7 +390,6 @@ class QEMUMachine:
try:
if not has_quit:
self._qmp.cmd('quit')
- self._qmp.close()
self._popen.wait(timeout=3)
except:
self._popen.kill()