qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: John Snow <jsnow@redhat.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: Wed, 6 Dec 2017 12:30:09 +0300	[thread overview]
Message-ID: <f0b9ce3e-0912-d6ee-ff7c-c5254a3f8103@virtuozzo.com> (raw)
In-Reply-To: <59dccfee-7c47-61d0-40a0-b67f0b7fd8cf@redhat.com>

06.12.2017 01:59, John Snow wrote:
>
> 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?

hm, you are right, I'll fix.

>
>>               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
>>


-- 
Best regards,
Vladimir

  reply	other threads:[~2017-12-06  9:30 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   ` [Qemu-devel] [Qemu-block] " John Snow
2017-12-06  9:30     ` Vladimir Sementsov-Ogievskiy [this message]
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=f0b9ce3e-0912-d6ee-ff7c-c5254a3f8103@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=crosa@redhat.com \
    --cc=den@openvz.org \
    --cc=ehabkost@redhat.com \
    --cc=jsnow@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).