qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] iotests: fix wait_until_completed()
Date: Tue, 10 Apr 2018 14:26:39 +0800	[thread overview]
Message-ID: <20180410062639.GD27604@xz-mi> (raw)
In-Reply-To: <888b356e-284b-54a5-0646-b6999e0e2c89@redhat.com>

On Mon, Apr 09, 2018 at 09:06:59AM -0500, Eric Blake wrote:
> On 04/07/2018 10:05 PM, Peter Xu wrote:
> > If there are more than one events, wait_until_completed() might return
> > the 2nd event even if the 1st event is JOB_COMPLETED, since the for loop
> > will continue to run even if completed is set to True.
> > 
> > It never happened before, but it can be triggered when OOB is enabled
> > due to the RESUME startup message. Fix that up.
> > 
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >  tests/qemu-iotests/iotests.py | 9 +++------
> >  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> If you get the other OOB-related bug fixes working, I can include this
> along with those for -rc3 through the qapi tree.  Otherwise, I'm fine
> waiting for this until 2.13.

Hi, Eric,

I think we have settled on the other two fix patches with Stefan,
it'll be good we can include those two patches for 2.12 now (maybe
also together with this one since it's pretty safe).

> 
> 
> > +++ b/tests/qemu-iotests/iotests.py
> > @@ -470,18 +470,15 @@ class QMPTestCase(unittest.TestCase):
> >  
> >      def wait_until_completed(self, drive='drive0', check_offset=True):
> >          '''Wait for a block job to finish, returning the event'''
> > -        completed = False
> > -        while not completed:
> > +        while True:
> >              for event in self.vm.get_qmp_events(wait=True):
> 
> Do we really need two loops?  Or can you eliminate the 'while True:'
> loop and rely on just the 'for event...' loop?

Seems not; the old wait_until_completed() will block here if haven't
received the JOB_COMPETE event yet until this point.  Removing the
while loop will let the function return immediately with a None, which
might break the old semantics.  Thanks,

-- 
Peter Xu

      reply	other threads:[~2018-04-10  6:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08  3:05 [Qemu-devel] [PATCH v2] iotests: fix wait_until_completed() Peter Xu
2018-04-08  9:03 ` Fam Zheng
2018-04-09  7:05 ` Stefan Hajnoczi
2018-04-09 14:06 ` Eric Blake
2018-04-10  6:26   ` Peter Xu [this message]

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=20180410062639.GD27604@xz-mi \
    --to=peterx@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).