[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen master] python/machine.py: Add a configurable timeout to shutdown()



commit c9b3045bc2f52aca8825b6a04e9367b87d64d1cf
Author:     John Snow <jsnow@xxxxxxxxxx>
AuthorDate: Fri Jul 10 01:06:43 2020 -0400
Commit:     Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
CommitDate: Tue Jul 14 22:22:22 2020 +0200

    python/machine.py: Add a configurable timeout to shutdown()
    
    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@xxxxxxxxxx>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
    Reviewed-by: Cleber Rosa <crosa@xxxxxxxxxx>
    Message-Id: <20200710050649.32434-7-jsnow@xxxxxxxxxx>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
---
 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 c28957ee82..e825f0bdc6 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -393,7 +393,9 @@ class QEMUMachine:
         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
         """
@@ -409,10 +411,10 @@ class QEMUMachine:
                 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()
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.