qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org, fam@euphon.net,
	armbru@redhat.com, mreitz@redhat.com, jsnow@redhat.com,
	den@openvz.org, vsementsov@virtuozzo.com
Subject: Re: [Qemu-devel] [PATCH v11 3/3] qemu-img info: bitmaps extension new test 239
Date: Fri, 1 Feb 2019 18:34:01 +0100	[thread overview]
Message-ID: <20190201173401.GD31750@localhost.localdomain> (raw)
In-Reply-To: <2edaa66c-52d9-ad56-d155-304ec7fb6903@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2806 bytes --]

Am 01.02.2019 um 18:23 hat Eric Blake geschrieben:
> On 1/31/19 7:46 AM, Andrey Shinkevich wrote:
> > A new test file 239 added to the qemu-iotests set. It checks
> > the output format of 'qemu-img info' for bitmaps extension of
> > qcow2 specific information.
> > 
> > Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> > ---
> >  tests/qemu-iotests/239     |  74 ++++++++++++++++++++++++++
> >  tests/qemu-iotests/239.out | 130 +++++++++++++++++++++++++++++++++++++++++++++
> >  tests/qemu-iotests/group   |   1 +
> >  3 files changed, 205 insertions(+)
> >  create mode 100755 tests/qemu-iotests/239
> >  create mode 100644 tests/qemu-iotests/239.out
> 
> Kevin just sent a pull request with 239 consumed for something else (a
> test for dmg; also consumed 240); I don't mind renumbering the test as
> 242 or later as part of staging if we are happy with this version of the
> test.  But I also see that Vladimir had some suggestions, so I wouldn't
> be surprised if you want to send a v12.
> 
> > 
> > diff --git a/tests/qemu-iotests/239 b/tests/qemu-iotests/239
> > new file mode 100755
> > index 0000000..bee7943
> > --- /dev/null
> > +++ b/tests/qemu-iotests/239
> > @@ -0,0 +1,74 @@
> > +#!/usr/bin/env python
> > +#
> > +# Test for qcow2 bitmap printed information
> > +#
> > +# Copyright (c) 2018 Virtuozzo International GmbH
> 
> Want to claim 2019?
> 
> 
> > +def add_bitmap(bitmap_number, persistent, disabled):
> > +    granularity = 2**(13 + bitmap_number)
> > +    bitmap_name = 'bitmap-' + str(bitmap_number-1)
> > +    vm = iotests.VM().add_drive(disk)
> > +    vm.launch()
> > +    vm.qmp_log('block-dirty-bitmap-add', node='drive0', name=bitmap_name,
> > +               granularity=granularity, persistent=persistent,
> > +               disabled=disabled)
> > +    vm.shutdown()
> > +
> > +def write_to_disk(offset, size):
> > +    write = 'write {} {}K'.format(offset, size)
> > +    qemu_io('-f', iotests.imgfmt, '-c', write, disk)
> > +    log('Write ' + str(size) + 'K to disk at offset ' + str(hex(offset)))
> > +
> > +
> > +qemu_img_create('-f', iotests.imgfmt, disk, '1M')
> > +
> > +for num in range(1, 4):
> > +    disabled = False
> > +    if num == 2:
> > +        disabled = True
> > +    add_bitmap(num, bool(num-1), disabled)
> 
> I don't know the pythonic way of coercing a bool value out of a check
> for whether another value is a particular integer; but I see that you
> did it in two different styles.  I don't know if this works, but it
> would at least look more consistent:
> 
> add_bitmap(num, bool(num == 1), bool(num == 2))

Hm...

    >>> num = 0
    >>> type(num == 2)
    <class 'bool'>

Why all the bool() calls when the result of == is already a bool?

Kevin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2019-02-01 17:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 13:46 [Qemu-devel] [PATCH v11 0/3] qemu-img info lists bitmap directory entries Andrey Shinkevich
2019-01-31 13:46 ` [Qemu-devel] [PATCH v11 1/3] bdrv_query_image_info Error parameter added Andrey Shinkevich
2019-02-01 14:42   ` Vladimir Sementsov-Ogievskiy
2019-02-01 14:46     ` Daniel P. Berrangé
2019-02-01 17:13   ` Kevin Wolf
2019-01-31 13:46 ` [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries Andrey Shinkevich
2019-02-01 15:19   ` Vladimir Sementsov-Ogievskiy
2019-02-01 17:08   ` Eric Blake
2019-02-01 17:19   ` Kevin Wolf
2019-02-01 18:39   ` Markus Armbruster
2019-02-01 19:04     ` Eric Blake
2019-02-01 19:23       ` Markus Armbruster
2019-02-01 19:28         ` Eric Blake
2019-02-04 13:05           ` Markus Armbruster
2019-02-04 16:03             ` Vladimir Sementsov-Ogievskiy
2019-02-04 16:24               ` Eric Blake
2019-02-04 16:35                 ` Vladimir Sementsov-Ogievskiy
2019-02-04 16:46                   ` Vladimir Sementsov-Ogievskiy
2019-02-04 17:33                     ` Eric Blake
2019-02-04 17:37                       ` Eric Blake
2019-02-04  7:49     ` Vladimir Sementsov-Ogievskiy
2019-02-04 15:23       ` Eric Blake
2019-02-04  9:46     ` Kevin Wolf
2019-02-04 13:45       ` Markus Armbruster
2019-02-04 15:36         ` Vladimir Sementsov-Ogievskiy
2019-02-05 10:00           ` Kevin Wolf
2019-02-05 13:16             ` Vladimir Sementsov-Ogievskiy
2019-02-05 14:28               ` Kevin Wolf
2019-02-05 14:38                 ` Eric Blake
2019-01-31 13:46 ` [Qemu-devel] [PATCH v11 3/3] qemu-img info: bitmaps extension new test 239 Andrey Shinkevich
2019-02-01 15:57   ` Vladimir Sementsov-Ogievskiy
2019-02-01 17:14   ` Kevin Wolf
2019-02-04  7:53     ` Vladimir Sementsov-Ogievskiy
2019-02-04  9:36       ` Kevin Wolf
2019-02-01 17:23   ` Eric Blake
2019-02-01 17:34     ` Kevin Wolf [this message]
2019-02-03 15:28 ` [Qemu-devel] [PATCH v11 0/3] qemu-img info lists bitmap directory entries no-reply

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=20190201173401.GD31750@localhost.localdomain \
    --to=kwolf@redhat.com \
    --cc=andrey.shinkevich@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=jsnow@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).