[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 06/12] python/machine.py: Add a configurable timeout to shutdo
From: |
John Snow |
Subject: |
[PATCH v5 06/12] python/machine.py: Add a configurable timeout to shutdown() |
Date: |
Fri, 10 Jul 2020 01:06:43 -0400 |
Three seconds is hardcoded. Use it as a default parameter instead, and use that
value for both waits that may occur in the function.
Signed-off-by: John Snow <jsnow@redhat.com>
---
python/qemu/machine.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index e66a7d66dd..120e0df3ee 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -382,7 +382,9 @@ def wait(self):
self._popen.wait()
self._post_shutdown()
- def shutdown(self, has_quit=False, hard=False):
+ def shutdown(self, has_quit: bool = False,
+ hard: bool = False,
+ timeout: Optional[int] = 3) -> None:
"""
Terminate the VM and clean up
"""
@@ -398,10 +400,10 @@ def shutdown(self, has_quit=False, hard=False):
try:
if not has_quit:
self._qmp.cmd('quit')
- self._popen.wait(timeout=3)
+ self._popen.wait(timeout=timeout)
except:
self._popen.kill()
- self._popen.wait()
+ self._popen.wait(timeout=timeout)
self._post_shutdown()
--
2.21.3
- Re: [PATCH v5 01/12] python/machine.py: consolidate _post_shutdown(), (continued)
- [PATCH v5 03/12] python/machine.py: Add _early_cleanup hook, John Snow, 2020/07/10
- [PATCH v5 05/12] python/machine.py: Prohibit multiple shutdown() calls, John Snow, 2020/07/10
- [PATCH v5 04/12] python/machine.py: Perform early cleanup for wait() calls, too, John Snow, 2020/07/10
- [PATCH v5 06/12] python/machine.py: Add a configurable timeout to shutdown(),
John Snow <=
- [PATCH v5 07/12] python/machine.py: Make wait() call shutdown(), John Snow, 2020/07/10
- [PATCH v5 08/12] tests/acceptance: wait() instead of shutdown() where appropriate, John Snow, 2020/07/10
- [PATCH v5 09/12] tests/acceptance: Don't test reboot on cubieboard, John Snow, 2020/07/10