From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUqnd-0001nx-F8 for qemu-devel@nongnu.org; Sun, 14 Feb 2016 02:08:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aUqnc-0004mV-AW for qemu-devel@nongnu.org; Sun, 14 Feb 2016 02:08:53 -0500 Date: Sun, 14 Feb 2016 15:08:41 +0800 From: Fam Zheng Message-ID: <20160214070841.GC31933@ad.usersys.redhat.com> References: <1455318392-26765-1-git-send-email-jsnow@redhat.com> <1455318392-26765-4-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455318392-26765-4-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/3] iotests/124: Add cluster_size mismatch test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: kwolf@redhat.com, jcody@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org On Fri, 02/12 18:06, John Snow wrote: > If a backing file isn't specified in the target image and the > cluster_size is larger than the bitmap granularity, we run the risk of > creating bitmaps with allocated clusters but empty/no data which will > prevent the proper reading of the backup in the future. > > Signed-off-by: John Snow > --- > tests/qemu-iotests/124 | 58 ++++++++++++++++++++++++++++++++++++++++++---- > tests/qemu-iotests/124.out | 4 ++-- > 2 files changed, 55 insertions(+), 7 deletions(-) > > diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 > index 7d33422..efbb5bd 100644 > --- a/tests/qemu-iotests/124 > +++ b/tests/qemu-iotests/124 > @@ -132,14 +132,16 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): > > > def img_create(self, img, fmt=iotests.imgfmt, size='64M', > - parent=None, parentFormat=None): > + parent=None, parentFormat=None, **kwargs): > + optargs = [] > + for k,v in kwargs.iteritems(): > + optargs = optargs + ['-o', '%s=%s' % (k,v)] > + args = ['create', '-f', fmt] + optargs + [img, size] > if parent: > if parentFormat is None: > parentFormat = fmt > - iotests.qemu_img('create', '-f', fmt, img, size, > - '-b', parent, '-F', parentFormat) > - else: > - iotests.qemu_img('create', '-f', fmt, img, size) > + args = args + ['-b', parent, '-F', parentFormat] > + iotests.qemu_img(*args) > self.files.append(img) > > > @@ -307,6 +309,52 @@ class TestIncrementalBackup(TestIncrementalBackupBase): > return self.do_incremental_simple(granularity=131072) > > > + def test_larger_cluster_target(self): > + ''' > + Test: Create and verify backups made to a larger cluster size target. > + > + With a default granularity of 64KiB, verify that backups made to a > + larger cluster size target of 128KiB works as expected. > + ''' > + drive0 = self.drives[0] > + > + # Create a cluster_size=128k full backup / "anchor" backup > + self.img_create(drive0['backup'], cluster_size='128k') > + self.assertTrue(self.do_qmp_backup(device=drive0['id'], sync='full', > + format=drive0['fmt'], > + target=drive0['backup'], > + mode='existing')) > + > + # Create bitmap and dirty it with some new writes. > + # overwrite [32736, 32799] which will dirty bitmap clusters at > + # 32M-64K and 32M. 32M+64K will be left undirtied. > + bitmap0 = self.add_bitmap('bitmap0', drive0) > + self.hmp_io_writes(drive0['id'], > + (('0xab', 0, 512), > + ('0xfe', '16M', '256k'), > + ('0x64', '32736k', '64k'))) > + > + > + # Prepare a cluster_size=128k backup target without a backing file. > + (target, _) = bitmap0.new_target() > + self.img_create(target, bitmap0.drive['fmt'], cluster_size='128k') > + > + # Perform Incremental Backup > + self.assertTrue(self.do_qmp_backup(device=bitmap0.drive['id'], > + sync='incremental', > + bitmap=bitmap0.name, > + format=bitmap0.drive['fmt'], > + target=target, > + mode='existing')) > + self.make_reference_backup(bitmap0) > + > + # Add the backing file, then compare and exit. > + iotests.qemu_img('rebase', '-f', drive0['fmt'], '-u', '-b', > + drive0['backup'], '-F', drive0['fmt'], target) > + self.vm.shutdown() > + self.check_backups() > + > + > def test_incremental_transaction(self): > '''Test: Verify backups made from transactionally created bitmaps. > > diff --git a/tests/qemu-iotests/124.out b/tests/qemu-iotests/124.out > index dae404e..36376be 100644 > --- a/tests/qemu-iotests/124.out > +++ b/tests/qemu-iotests/124.out > @@ -1,5 +1,5 @@ > -......... > +.......... > ---------------------------------------------------------------------- > -Ran 9 tests > +Ran 10 tests > > OK > -- > 2.4.3 > Reviewed-by: Fam Zheng