qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: crosa@redhat.com, ehabkost@redhat.com, mreitz@redhat.com,
	kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org
Subject: [Qemu-devel] [PATCH 3/4] scripts/qemu.py: tiny enhancement for event_wiat
Date: Tue, 28 Nov 2017 10:14:08 +0300	[thread overview]
Message-ID: <20171128071409.21887-4-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20171128071409.21887-1-vsementsov@virtuozzo.com>

- add comment
- allow int timeout and disallow bool (which has special
  meaning for pull_event())
- remove unreachable 'return None'

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 scripts/qemu.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/qemu.py b/scripts/qemu.py
index 9bfdf6d37d..8763335254 100644
--- a/scripts/qemu.py
+++ b/scripts/qemu.py
@@ -291,7 +291,13 @@ class QEMUMachine(object):
         branch processing on match's value None
            {"foo": {"bar": 1}} matches {"foo": None}
            {"foo": {"bar": 1}} does not matches {"foo": {"baz": None}}
+
+        @raise QMPTimeoutError: If timeout period elapses.
+        @raise QMPConnectError: If some other error occurred.
         '''
+
+        assert isinstance(timeout, float) or isinstance(timeout, int)
+
         def event_match(event, match=None):
             if match is None:
                 return True
@@ -316,13 +322,11 @@ class QEMUMachine(object):
 
         # Poll for new events
         while True:
-            event = self._qmp.pull_event(wait=timeout)
+            event = self._qmp.pull_event(wait=float(timeout))
             if (event['event'] == name) and event_match(event, match):
                 return event
             self._events.append(event)
 
-        return None
-
     def get_log(self):
         '''
         After self.shutdown or failed qemu execution, this returns the output
-- 
2.11.1

  parent reply	other threads:[~2017-11-28  7:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28  7:14 [Qemu-devel] [PATCH for 2.11 0/4] fix bitmaps migration through shared storage Vladimir Sementsov-Ogievskiy
2017-11-28  7:14 ` [Qemu-devel] [PATCH 1/4] qcow2-bitmap: add qcow2_reopen_bitmaps_rw_hint() Vladimir Sementsov-Ogievskiy
2017-12-05 23:00   ` [Qemu-devel] [Qemu-block] " John Snow
2017-11-28  7:14 ` [Qemu-devel] [PATCH 2/4] qcow2: handle reopening bitmaps on bdrv_invalidate_cache Vladimir Sementsov-Ogievskiy
2017-12-05 23:01   ` [Qemu-devel] [Qemu-block] " John Snow
2017-11-28  7:14 ` Vladimir Sementsov-Ogievskiy [this message]
2017-12-05 22:59   ` [Qemu-devel] [Qemu-block] [PATCH 3/4] scripts/qemu.py: tiny enhancement for event_wiat John Snow
2017-12-06  9:30     ` Vladimir Sementsov-Ogievskiy
2017-12-06  9:50   ` [Qemu-devel] " Vladimir Sementsov-Ogievskiy
2017-11-28  7:14 ` [Qemu-devel] [PATCH 4/4] iotests: add dirty bitmap migration test Vladimir Sementsov-Ogievskiy
2017-11-28  7:17   ` Vladimir Sementsov-Ogievskiy
2017-12-05 23:05   ` [Qemu-devel] [Qemu-block] " John Snow
2017-12-06  9:51   ` [Qemu-devel] " Vladimir Sementsov-Ogievskiy
2017-12-06 20:54     ` [Qemu-devel] [Qemu-block] " John Snow

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=20171128071409.21887-4-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=crosa@redhat.com \
    --cc=den@openvz.org \
    --cc=ehabkost@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).