[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/5] python/machine: Handle termination cases without QMP
From: |
John Snow |
Subject: |
[PULL 2/5] python/machine: Handle termination cases without QMP |
Date: |
Wed, 4 Jan 2023 16:04:52 -0500 |
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>
---
python/qemu/machine/machine.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index 6f1374a7550..748a0d807c9 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -547,6 +547,12 @@ def _soft_shutdown(self, timeout: Optional[int]) -> None:
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(
--
2.39.0
- [PULL 0/5] Python patches, John Snow, 2023/01/04
- [PULL 4/5] iotests/check: Fix typing for sys.exit() value, John Snow, 2023/01/04
- [PULL 3/5] Python: fix flake8 config, John Snow, 2023/01/04
- [PULL 2/5] python/machine: Handle termination cases without QMP,
John Snow <=
- [PULL 1/5] python/machine: Add debug logging to key state changes, John Snow, 2023/01/04
- [PULL 5/5] python: add 3.11 to supported list, John Snow, 2023/01/04
- Re: [PULL 0/5] Python patches, Peter Maydell, 2023/01/05