qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "John Snow" <jsnow@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>
Subject: [PULL 03/46] python/qemu: qmp: Make accept()'s timeout configurable
Date: Thu,  6 Feb 2020 22:18:53 +0100	[thread overview]
Message-ID: <20200206211936.17098-4-philmd@redhat.com> (raw)
In-Reply-To: <20200206211936.17098-1-philmd@redhat.com>

From: Wainer dos Santos Moschetta <wainersm@redhat.com>

Currently the timeout of QEMUMonitorProtocol.accept() is
hard-coded to 15.0 seconds. This added the parameter `timeout`
so the value can be configured by the user.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20200204141111.3207-4-wainersm@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 python/qemu/qmp.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py
index f4e04a6683..0e07d80e2a 100644
--- a/python/qemu/qmp.py
+++ b/python/qemu/qmp.py
@@ -154,16 +154,23 @@ class QEMUMonitorProtocol:
             return self.__negotiate_capabilities()
         return None
 
-    def accept(self):
+    def accept(self, timeout=15.0):
         """
         Await connection from QMP Monitor and perform capabilities negotiation.
 
+        @param timeout: timeout in seconds (nonnegative float number, or
+                        None). The value passed will set the behavior of the
+                        underneath QMP socket as described in [1]. Default value
+                        is set to 15.0.
         @return QMP greeting dict
         @raise OSError on socket connection errors
         @raise QMPConnectError if the greeting is not received
         @raise QMPCapabilitiesError if fails to negotiate capabilities
+
+        [1]
+        https://docs.python.org/3/library/socket.html#socket.socket.settimeout
         """
-        self.__sock.settimeout(15)
+        self.__sock.settimeout(timeout)
         self.__sock, _ = self.__sock.accept()
         self.__sockfile = self.__sock.makefile()
         return self.__negotiate_capabilities()
-- 
2.21.1



  parent reply	other threads:[~2020-02-06 21:23 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 21:18 [PULL 00/46] Python queue 2020-02-06 Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 01/46] python/qemu: qmp: Replace socket.error with OSError Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 02/46] python/qemu: Delint the qmp module Philippe Mathieu-Daudé
2020-02-06 21:18 ` Philippe Mathieu-Daudé [this message]
2020-02-06 21:18 ` [PULL 04/46] python/qemu: qmp: Make QEMUMonitorProtocol a context manager Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 05/46] python/qemu: qmp: Remove unnused attributes Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 06/46] python/qemu: accel: Fix kvm_available() on ppc64le Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 07/46] qemu-deprecated: Remove text about Python 2 Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 08/46] python: Treat None-return of greeting cmd Philippe Mathieu-Daudé
2020-02-06 21:18 ` [PULL 09/46] python/qemu/machine: Allow to use other serial consoles than default Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 10/46] Acceptance tests: Extract _console_interaction() Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 11/46] Acceptance tests: Add interrupt_interactive_console_until_pattern() Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 12/46] travis.yml: install rpm2cpio for acceptance tests Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 13/46] tests/boot_linux_console: add extract_from_rpm method Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 14/46] tests/boot_linux_console: use os.path for filesystem paths Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 15/46] tests/boot_linux_console: fix extract_from_deb() comment Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 16/46] tests/boot_linux_console: Tag Emcraft Smartfusion2 as running 'u-boot' Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 17/46] tests/acceptance: Add boot tests for some of the QEMU advent calendar images Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 18/46] tests: rename virtio_seg_max_adjust to virtio_check_params Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 19/46] tests/acceptance/virtio_check_params: Improve exception logging Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 20/46] tests/acceptance/virtio_check_params: List machine being tested Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 21/46] tests/acceptance/virtio_check_params: Default to -nodefaults Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 22/46] tests/acceptance/virtio_check_params: Disable the test Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 23/46] tests/acceptance/boot_linux_console: Do not use VGA on Clipper machine Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 24/46] tests/acceptance/version: Default to -nodefaults Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 25/46] tests/acceptance/migration: Factor out assert_migration() Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 26/46] tests/acceptance/migration: Factor out do_migrate() Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 27/46] tests/acceptance/migration: Test UNIX transport when migrating Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 28/46] tests/acceptance/migration: Test EXEC " Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 29/46] tests/acceptance/migration: Add the 'migration' tag Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 30/46] tests/acceptance/migration: Default to -nodefaults Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 31/46] scripts/checkpatch.pl: Only allow Python 3 interpreter Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 32/46] tests/qemu-iotests/check: Allow use of python3 interpreter Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 33/46] tests/qemu-iotests: Explicit usage of Python 3 (scripts with __main__) Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 34/46] tests: Explicit usage of Python 3 Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 35/46] scripts: Explicit usage of Python 3 (scripts with __main__) Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 36/46] scripts/minikconf: Explicit usage of Python 3 Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 37/46] scripts/tracetool: Remove shebang header Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 38/46] tests/acceptance: " Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 39/46] tests/vm: " Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 40/46] tests/qemu-iotests: Explicit usage of Python3 (scripts without __main__) Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 41/46] scripts: Explicit usage of Python 3 " Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 42/46] tests/qemu-iotests/check: Only check for Python 3 interpreter Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 43/46] scripts/signrom: remove Python 2 support, add shebang Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 44/46] make all Python scripts executable Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 45/46] drop "from __future__ import print_function" Philippe Mathieu-Daudé
2020-02-06 21:19 ` [PULL 46/46] .readthedocs.yml: specify some minimum python requirements Philippe Mathieu-Daudé
2020-02-06 22:07 ` [PULL 00/46] Python queue 2020-02-06 Eduardo Habkost
2020-02-07 11:51 ` Peter Maydell
2020-02-07 12:39   ` Philippe Mathieu-Daudé
2020-02-07 14:01     ` Philippe Mathieu-Daudé
2020-02-07 13:30   ` Philippe Mathieu-Daudé
2020-02-07 13:34     ` Philippe Mathieu-Daudé

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=20200206211936.17098-4-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@redhat.com \
    /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).