qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org,
	Eduardo Habkost <ehabkost@redhat.com>,
	philmd@redhat.com, Cleber Rosa <crosa@redhat.com>,
	John Snow <jsnow@redhat.com>
Subject: [PATCH 1/1] python/machine: Change default timeout to 30 seconds
Date: Mon, 20 Jul 2020 12:02:52 -0400	[thread overview]
Message-ID: <20200720160252.104139-2-jsnow@redhat.com> (raw)
In-Reply-To: <20200720160252.104139-1-jsnow@redhat.com>

3 seconds is too short for some tests running inside busy VMs. Build it out to
a rather generous 30 seconds to find out conclusively if there are more severe
problems in the merge/CI tests.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/qemu/machine.py | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index 80c4d4a8b6..51aa255ef9 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -394,15 +394,15 @@ def _hard_shutdown(self) -> None:
         self._popen.kill()
         self._popen.wait(timeout=60)
 
-    def _soft_shutdown(self, has_quit: bool = False,
-                       timeout: Optional[int] = 3) -> None:
+    def _soft_shutdown(self, timeout: Optional[int],
+                       has_quit: bool = False) -> None:
         """
         Perform early cleanup, attempt to gracefully shut down the VM, and wait
         for it to terminate.
 
+        :param timeout: Timeout in seconds for graceful shutdown.
+                        A value of None is an infinite wait.
         :param has_quit: When True, don't attempt to issue 'quit' QMP command
-        :param timeout: Optional timeout in seconds for graceful shutdown.
-                        Default 3 seconds, A value of None is an infinite wait.
 
         :raise ConnectionReset: On QMP communication errors
         :raise subprocess.TimeoutExpired: When timeout is exceeded waiting for
@@ -418,14 +418,14 @@ def _soft_shutdown(self, has_quit: bool = False,
         # May raise subprocess.TimeoutExpired
         self._popen.wait(timeout=timeout)
 
-    def _do_shutdown(self, has_quit: bool = False,
-                     timeout: Optional[int] = 3) -> None:
+    def _do_shutdown(self, timeout: Optional[int],
+                     has_quit: bool = False) -> None:
         """
         Attempt to shutdown the VM gracefully; fallback to a hard shutdown.
 
+        :param timeout: Timeout in seconds for graceful shutdown.
+                        A value of None is an infinite wait.
         :param has_quit: When True, don't attempt to issue 'quit' QMP command
-        :param timeout: Optional timeout in seconds for graceful shutdown.
-                        Default 3 seconds, A value of None is an infinite wait.
 
         :raise AbnormalShutdown: When the VM could not be shut down gracefully.
             The inner exception will likely be ConnectionReset or
@@ -433,7 +433,7 @@ def _do_shutdown(self, has_quit: bool = False,
             may result in its own exceptions, likely subprocess.TimeoutExpired.
         """
         try:
-            self._soft_shutdown(has_quit, timeout)
+            self._soft_shutdown(timeout, has_quit)
         except Exception as exc:
             self._hard_shutdown()
             raise AbnormalShutdown("Could not perform graceful shutdown") \
@@ -441,7 +441,7 @@ def _do_shutdown(self, has_quit: bool = False,
 
     def shutdown(self, has_quit: bool = False,
                  hard: bool = False,
-                 timeout: Optional[int] = 3) -> None:
+                 timeout: Optional[int] = 30) -> None:
         """
         Terminate the VM (gracefully if possible) and perform cleanup.
         Cleanup will always be performed.
@@ -453,7 +453,7 @@ def shutdown(self, has_quit: bool = False,
         :param hard: When true, do not attempt graceful shutdown, and
                      suppress the SIGKILL warning log message.
         :param timeout: Optional timeout in seconds for graceful shutdown.
-                        Default 3 seconds, A value of None is an infinite wait.
+                        Default 30 seconds, A `None` value is an infinite wait.
         """
         if not self._launched:
             return
@@ -463,7 +463,7 @@ def shutdown(self, has_quit: bool = False,
                 self._user_killed = True
                 self._hard_shutdown()
             else:
-                self._do_shutdown(has_quit, timeout=timeout)
+                self._do_shutdown(timeout, has_quit)
         finally:
             self._post_shutdown()
 
@@ -473,12 +473,12 @@ def kill(self):
         """
         self.shutdown(hard=True)
 
-    def wait(self, timeout: Optional[int] = 3) -> None:
+    def wait(self, timeout: Optional[int] = 30) -> None:
         """
         Wait for the VM to power off and perform post-shutdown cleanup.
 
-        :param timeout: Optional timeout in seconds.
-                        Default 3 seconds, A value of None is an infinite wait.
+        :param timeout: Optional timeout in seconds. Default 30 seconds.
+                        A value of `None` is an infinite wait.
         """
         self.shutdown(has_quit=True, timeout=timeout)
 
-- 
2.26.2



  reply	other threads:[~2020-07-20 16:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 16:02 [PATCH 0/1] python/machine: Change default timeout to 30 seconds John Snow
2020-07-20 16:02 ` John Snow [this message]
2020-07-20 20:01   ` [PATCH 1/1] " Eduardo Habkost
2020-07-20 20:06     ` John Snow
2020-07-20 20:20   ` Eduardo Habkost
2020-07-24 16:31     ` John Snow
2020-07-25 17:46       ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200720160252.104139-2-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).