From: Jeff Cody <jcody@redhat.com>
To: qemu-block@nongnu.org
Cc: peter.maydell@linaro.org, jcody@redhat.com, famz@redhat.com,
qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 12/12] iotests/124: Add cluster_size mismatch test
Date: Mon, 29 Feb 2016 15:08:52 -0500 [thread overview]
Message-ID: <1456776532-1008-13-git-send-email-jcody@redhat.com> (raw)
In-Reply-To: <1456776532-1008-1-git-send-email-jcody@redhat.com>
From: John Snow <jsnow@redhat.com>
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 <jsnow@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1456433911-24718-4-git-send-email-jsnow@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
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..de7cdbe 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 without a backing file works.
+ '''
+ 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
--
1.9.3
next prev parent reply other threads:[~2016-02-29 20:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-29 20:08 [Qemu-devel] [PULL 00/12] Block patches Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 01/12] block/nfs: add support for setting debug level Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 02/12] sheepdog: allow to delete snapshot Jeff Cody
2016-03-02 14:11 ` Paolo Bonzini
2016-03-02 15:18 ` Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 03/12] rbd: add support for getting password from QCryptoSecret object Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 04/12] curl: add support for HTTP authentication parameters Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 05/12] iscsi: add support for getting CHAP password via QCryptoSecret API Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 06/12] vhdx: DIV_ROUND_UP() in vhdx_calc_bat_entries() Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 07/12] vhdx: Simplify vhdx_set_shift_bits() Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 08/12] mirror: Rewrite mirror_iteration Jeff Cody
2016-04-13 13:40 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2016-02-29 20:08 ` [Qemu-devel] [PULL 09/12] mirror: Add mirror_wait_for_io Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 10/12] block/backup: make backup cluster size configurable Jeff Cody
2016-02-29 20:08 ` [Qemu-devel] [PULL 11/12] block/backup: avoid copying less than full target clusters Jeff Cody
2016-02-29 20:08 ` Jeff Cody [this message]
2016-03-01 10:34 ` [Qemu-devel] [PULL 00/12] Block patches Peter Maydell
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=1456776532-1008-13-git-send-email-jcody@redhat.com \
--to=jcody@redhat.com \
--cc=famz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).