From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjG20-0007ux-4C for qemu-devel@nongnu.org; Fri, 17 Apr 2015 19:50:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YjG1w-0006Cw-9V for qemu-devel@nongnu.org; Fri, 17 Apr 2015 19:50:44 -0400 From: John Snow Date: Fri, 17 Apr 2015 19:50:09 -0400 Message-Id: <1429314609-29776-22-git-send-email-jsnow@redhat.com> In-Reply-To: <1429314609-29776-1-git-send-email-jsnow@redhat.com> References: <1429314609-29776-1-git-send-email-jsnow@redhat.com> Subject: [Qemu-devel] [PATCH v6 21/21] iotests: add incremental backup granularity tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, John Snow , qemu-devel@nongnu.org, armbru@redhat.com, vsementsov@parallels.com, stefanha@redhat.com, mreitz@redhat.com Test what happens if you fiddle with the granularity. Reviewed-by: Max Reitz Signed-off-by: John Snow --- tests/qemu-iotests/124 | 58 +++++++++++++++++++++++++++++++++++++--------- tests/qemu-iotests/124.out | 4 ++-- 2 files changed, 49 insertions(+), 13 deletions(-) diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index 95f6de5..3ee78cd 100644 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -158,11 +158,11 @@ class TestIncrementalBackup(iotests.QMPTestCase): self.assertTrue(res) - def add_bitmap(self, name, drive): + def add_bitmap(self, name, drive, **kwargs): bitmap = Bitmap(name, drive) self.bitmaps.append(bitmap) result = self.vm.qmp('block-dirty-bitmap-add', node=drive['id'], - name=bitmap.name) + name=bitmap.name, **kwargs) self.assert_qmp(result, 'return', {}) return bitmap @@ -212,16 +212,9 @@ class TestIncrementalBackup(iotests.QMPTestCase): self.vm.hmp_qemu_io(drive, 'flush') - def test_incremental_simple(self): - ''' - Test: Create and verify three incremental backups. - - Create a bitmap and a full backup before VM execution begins, - then create a series of three incremental backups "during execution," - i.e.; after IO requests begin modifying the drive. - ''' + def do_incremental_simple(self, **kwargs): self.create_anchor_backup() - self.add_bitmap('bitmap0', self.drives[0]) + self.add_bitmap('bitmap0', self.drives[0], **kwargs) # Sanity: Create a "hollow" incremental backup self.create_incremental() @@ -240,6 +233,37 @@ class TestIncrementalBackup(iotests.QMPTestCase): self.check_backups() + def test_incremental_simple(self): + ''' + Test: Create and verify three incremental backups. + + Create a bitmap and a full backup before VM execution begins, + then create a series of three incremental backups "during execution," + i.e.; after IO requests begin modifying the drive. + ''' + return self.do_incremental_simple() + + + def test_small_granularity(self): + ''' + Test: Create and verify backups made with a small granularity bitmap. + + Perform the same test as test_incremental_simple, but with a granularity + of only 32KiB instead of the present default of 64KiB. + ''' + return self.do_incremental_simple(granularity=32768) + + + def test_large_granularity(self): + ''' + Test: Create and verify backups made with a large granularity bitmap. + + Perform the same test as test_incremental_simple, but with a granularity + of 128KiB instead of the present default of 64KiB. + ''' + return self.do_incremental_simple(granularity=131072) + + def test_incremental_failure(self): '''Test: Verify backups made after a failure are correct. @@ -315,6 +339,18 @@ class TestIncrementalBackup(iotests.QMPTestCase): self.assert_qmp(result, 'error/class', 'GenericError') + def test_sync_dirty_bitmap_bad_granularity(self): + ''' + Test: Test what happens if we provide an improper granularity. + + The granularity must always be a power of 2. + ''' + self.assert_no_active_block_jobs() + self.assertRaises(AssertionError, self.add_bitmap, + 'bitmap0', self.drives[0], + granularity=64000) + + def tearDown(self): self.vm.shutdown() for bitmap in self.bitmaps: diff --git a/tests/qemu-iotests/124.out b/tests/qemu-iotests/124.out index 89968f3..2f7d390 100644 --- a/tests/qemu-iotests/124.out +++ b/tests/qemu-iotests/124.out @@ -1,5 +1,5 @@ -.... +....... ---------------------------------------------------------------------- -Ran 4 tests +Ran 7 tests OK -- 2.1.0