aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2022-10-27 14:58:36 -0400
committerJohn Snow <jsnow@redhat.com>2023-01-04 13:46:05 -0500
commit3c6e5e8ce13dc3bf286ff977a7806f2b342dfdab (patch)
tree00aaa62bfc409f2d7cdd2e2e611d4a0f403233d4 /python
parent9cccb3305a26ee01fea7b3a179eca01c98083e3a (diff)
downloadqemu-3c6e5e8ce13dc3bf286ff977a7806f2b342dfdab.zip
qemu-3c6e5e8ce13dc3bf286ff977a7806f2b342dfdab.tar.gz
qemu-3c6e5e8ce13dc3bf286ff977a7806f2b342dfdab.tar.bz2
python/machine: Handle termination cases without QMP
If we request a shutdown of a VM without a QMP console, we'll just hang waiting. Not ideal. Add in code that attempts graceful termination in these cases. Tested lightly; it appears to work and I doubt we rely on this case anywhere, but it's a corner you're allowed to wedge yourself in, so it should be handled. Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'python')
-rw-r--r--python/qemu/machine/machine.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index 6f1374a..748a0d8 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -547,6 +547,12 @@ class QEMUMachine:
finally:
# Regardless, we want to quiesce the connection.
self._close_qmp_connection()
+ elif not self._quit_issued:
+ LOG.debug(
+ "Not anticipating QEMU quit and no QMP connection present, "
+ "issuing SIGTERM"
+ )
+ self._subp.terminate()
# May raise subprocess.TimeoutExpired
LOG.debug(