qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, ehabkost@redhat.com, mreitz@redhat.com,
	crosa@redhat.com, den@openvz.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 3/4] scripts/qemu.py: tiny enhancement for event_wiat
Date: Tue, 5 Dec 2017 17:59:33 -0500	[thread overview]
Message-ID: <59dccfee-7c47-61d0-40a0-b67f0b7fd8cf@redhat.com> (raw)
In-Reply-To: <20171128071409.21887-4-vsementsov@virtuozzo.com>



On 11/28/2017 02:14 AM, Vladimir Sementsov-Ogievskiy wrote:
> - 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))

Before this patch you *could* ask for no timeout, and this would block
waiting for an event. After, you can't.

Are you making the argument that it is *never* correct to ask for no
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
> 

  reply	other threads:[~2017-12-05 22:59 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 ` [Qemu-devel] [PATCH 3/4] scripts/qemu.py: tiny enhancement for event_wiat Vladimir Sementsov-Ogievskiy
2017-12-05 22:59   ` John Snow [this message]
2017-12-06  9:30     ` [Qemu-devel] [Qemu-block] " 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=59dccfee-7c47-61d0-40a0-b67f0b7fd8cf@redhat.com \
    --to=jsnow@redhat.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 \
    --cc=vsementsov@virtuozzo.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).