From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bte0o-0002xA-L4 for qemu-devel@nongnu.org; Mon, 10 Oct 2016 13:05:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bte0i-0001sf-SC for qemu-devel@nongnu.org; Mon, 10 Oct 2016 13:05:10 -0400 References: <1475232808-4852-1-git-send-email-vsementsov@virtuozzo.com> <1475232808-4852-20-git-send-email-vsementsov@virtuozzo.com> From: Max Reitz Message-ID: <2233a1e0-0415-effb-eb17-f22b17a8c11e@redhat.com> Date: Mon, 10 Oct 2016 19:04:56 +0200 MIME-Version: 1.0 In-Reply-To: <1475232808-4852-20-git-send-email-vsementsov@virtuozzo.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Mmw2JumI0SE2XbOGOPJxKPoxD94bhIAL5" Subject: Re: [Qemu-devel] [PATCH 19/22] iotests: test qcow2 persistent dirty bitmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, armbru@redhat.com, eblake@redhat.com, jsnow@redhat.com, famz@redhat.com, den@openvz.org, stefanha@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Mmw2JumI0SE2XbOGOPJxKPoxD94bhIAL5 From: Max Reitz To: Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, armbru@redhat.com, eblake@redhat.com, jsnow@redhat.com, famz@redhat.com, den@openvz.org, stefanha@redhat.com, pbonzini@redhat.com Message-ID: <2233a1e0-0415-effb-eb17-f22b17a8c11e@redhat.com> Subject: Re: [PATCH 19/22] iotests: test qcow2 persistent dirty bitmap References: <1475232808-4852-1-git-send-email-vsementsov@virtuozzo.com> <1475232808-4852-20-git-send-email-vsementsov@virtuozzo.com> In-Reply-To: <1475232808-4852-20-git-send-email-vsementsov@virtuozzo.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote: > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > tests/qemu-iotests/165 | 87 ++++++++++++++++++++++++++++++++++++++= ++++++++ > tests/qemu-iotests/165.out | 5 +++ > tests/qemu-iotests/group | 1 + > 3 files changed, 93 insertions(+) > create mode 100755 tests/qemu-iotests/165 > create mode 100644 tests/qemu-iotests/165.out >=20 > diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 > new file mode 100755 > index 0000000..a69799c > --- /dev/null > +++ b/tests/qemu-iotests/165 > @@ -0,0 +1,87 @@ > +#!/usr/bin/env python > +# > +# Tests for persistent dirty bitmaps. > +# > +# Copyright: Vladimir Sementsov-Ogievskiy 2015-2016 > +# > +# This program is free software; you can redistribute it and/or modify= > +# it under the terms of the GNU General Public License as published by= > +# the Free Software Foundation; either version 2 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see = =2E > +# > + > +import os > +import iotests > +from iotests import qemu_img > + > +disk =3D os.path.join(iotests.test_dir, 'disk') > +disk_size =3D 0x40000000 # 1G > + > +# regions for qemu_io: (start, count) in bytes > +regions1 =3D ((0, 0x100000), > + (0x200000, 0x100000)) > + > +regions2 =3D ((0x10000000, 0x20000), > + (0x39990000, 0x10000)) Did you mean 0x3fff0000? Looks good apart from that (and the fact that I don't like the @md5 field in query-block too much, but that's a matter for patch 18). Max > + > +class TestPersistentDirtyBitmap(iotests.QMPTestCase): > + > + def setUp(self): > + qemu_img('create', '-f', iotests.imgfmt, disk, str(disk_size))= > + > + def tearDown(self): > + os.remove(disk) > + > + def mkVm(self): > + return iotests.VM().add_drive(disk) > + > + def getMd5(self): > + result =3D self.vm.qmp('query-block'); > + return result['return'][0]['dirty-bitmaps'][0]['md5'] > + > + def checkBitmap(self, md5): > + result =3D self.vm.qmp('query-block'); > + self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/md5', md5)= ; > + > + def writeRegions(self, regions): > + for r in regions: > + self.vm.hmp_qemu_io('drive0', > + 'write %d %d' % r) > + > + def qmpAddBitmap(self): > + self.vm.qmp('block-dirty-bitmap-add', node=3D'drive0', > + name=3D'bitmap0', persistent=3DTrue, autoload=3DTr= ue) > + > + def test_persistent(self): > + self.vm =3D self.mkVm() > + self.vm.launch() > + self.qmpAddBitmap() > + > + self.writeRegions(regions1) > + md5 =3D self.getMd5() > + > + self.vm.shutdown() > + self.vm =3D self.mkVm() > + self.vm.launch() > + > + self.checkBitmap(md5) > + self.writeRegions(regions2) > + md5 =3D self.getMd5() > + > + self.vm.shutdown() > + self.vm.launch() > + > + self.checkBitmap(md5) > + > + self.vm.shutdown() > + > +if __name__ =3D=3D '__main__': > + iotests.main(supported_fmts=3D['qcow2']) > diff --git a/tests/qemu-iotests/165.out b/tests/qemu-iotests/165.out > new file mode 100644 > index 0000000..ae1213e > --- /dev/null > +++ b/tests/qemu-iotests/165.out > @@ -0,0 +1,5 @@ > +. > +----------------------------------------------------------------------= > +Ran 1 tests > + > +OK > diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group > index 503eb27..ed14294 100644 > --- a/tests/qemu-iotests/group > +++ b/tests/qemu-iotests/group > @@ -161,3 +161,4 @@ > 159 rw auto quick > 160 rw auto quick > 162 auto quick > +165 rw auto quick >=20 --Mmw2JumI0SE2XbOGOPJxKPoxD94bhIAL5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEvBAEBCAAZBQJX+8o5EhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQE/R B/9sSnjOlt96PWVIg4toNZZbjNXOfqyEXewHrXfvaCmw0/FkUHqBpRJxs83NKo7G Ydd37hcjY3LeAgtsXiWowctWROFZzFCpwXRboZMDXSCQCgSlsWhkcL/FR10Vyve9 Z6q4/+1asUcJWDe9xffshDlpdk+uHlDEPHNhtr0Et0bPC5ggD3yLY7XTbgltSqJK 4gZookj4ruHSQtt+K/rRafyHe9u99tOIZqd0v2QWAM37sfLSGfvU7OxJbCpdjA7x PL/c4fmUCDVqQtNSQ9hIvXAW6QZiRf8gUkvuKVUXTYNT06ioZ4ld/QqVyYeGIgqx SGGyhn9oHy6akhhbpJQKcJy5 =nDTL -----END PGP SIGNATURE----- --Mmw2JumI0SE2XbOGOPJxKPoxD94bhIAL5--