From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
Peter Krempa <pkrempa@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] iotests/169: Test source cont with backing bmap
Date: Thu, 30 Jul 2020 09:38:43 -0500 [thread overview]
Message-ID: <2d89e3e6-a535-8d0c-63e2-605f7233d1bf@redhat.com> (raw)
In-Reply-To: <20200730120234.49288-3-mreitz@redhat.com>
On 7/30/20 7:02 AM, Max Reitz wrote:
> Test migrating from a VM with a persistent bitmap in the backing chain,
> and then continuing that VM after the migration
Indeed, the more our iotest is like what libvirt actually does, the
better we protect ourselves from future bugs in this area.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> tests/qemu-iotests/169 | 64 +++++++++++++++++++++++++++++++++++++-
> tests/qemu-iotests/169.out | 4 +--
> 2 files changed, 65 insertions(+), 3 deletions(-)
>
> +class TestDirtyBitmapBackingMigration(iotests.QMPTestCase):
> + def setUp(self):
> + qemu_img_create('-f', iotests.imgfmt, base_a, size)
> + qemu_img_create('-f', iotests.imgfmt, '-F', iotests.imgfmt,
> + '-b', base_a, disk_a, size)
> +
> + for f in (disk_a, base_a):
> + qemu_img('bitmap', '--add', f, 'bmap0')
I'm so glad to see 'qemu-img bitmap' getting some use :)
> +
> + blockdev = {
> + 'node-name': 'node0',
> + 'driver': iotests.imgfmt,
> + 'file': {
> + 'driver': 'file',
> + 'filename': disk_a
> + },
> + 'backing': {
> + 'node-name': 'node0-base',
> + 'driver': iotests.imgfmt,
> + 'file': {
> + 'driver': 'file',
> + 'filename': base_a
> + }
> + }
> + }
> +
> + self.vm = iotests.VM()
> + self.vm.launch()
> +
> + result = self.vm.qmp('blockdev-add', **blockdev)
> + self.assert_qmp(result, 'return', {})
> +
> + # Check that the bitmaps are there
> + for node in self.vm.qmp('query-named-block-nodes', flat=True)['return']:
> + if 'node0' in node['node-name']:
This caught me on the first read, before I realized it was a clever way
to test both 'node0' and 'node0-base'.
> + self.assert_qmp(node, 'dirty-bitmaps[0]/name', 'bmap0')
> +
> + caps = [{'capability': 'events', 'state': True}]
> + result = self.vm.qmp('migrate-set-capabilities', capabilities=caps)
> + self.assert_qmp(result, 'return', {})
> +
> + def tearDown(self):
> + self.vm.shutdown()
> + for f in (disk_a, base_a):
> + os.remove(f)
> +
> + def test_cont_on_source(self):
> + """
> + Continue the source after migration.
> + """
> + result = self.vm.qmp('migrate', uri=f'exec: cat > /dev/null')
> + self.assert_qmp(result, 'return', {})
> +
> + with Timeout(10, 'Migration timeout'):
> + self.vm.wait_migration('postmigrate')
> +
> + result = self.vm.qmp('cont')
> + self.assert_qmp(result, 'return', {})
> +
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-07-30 14:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-30 12:02 [PATCH 0/2] qcow2: Release read-only bitmaps when inactivated Max Reitz
2020-07-30 12:02 ` [PATCH 1/2] " Max Reitz
2020-07-30 14:22 ` Peter Krempa
2020-07-30 14:54 ` Eric Blake
2020-08-05 11:06 ` Vladimir Sementsov-Ogievskiy
2020-07-30 12:02 ` [PATCH 2/2] iotests/169: Test source cont with backing bmap Max Reitz
2020-07-30 14:38 ` Eric Blake [this message]
2020-07-30 14:19 ` [PATCH 0/2] qcow2: Release read-only bitmaps when inactivated Eric Blake
2020-08-05 8:15 ` Vladimir Sementsov-Ogievskiy
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=2d89e3e6-a535-8d0c-63e2-605f7233d1bf@redhat.com \
--to=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pkrempa@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).