[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 64/97] iotests: Test backup job with two guest writes
From: |
Michael Roth |
Subject: |
[PATCH 64/97] iotests: Test backup job with two guest writes |
Date: |
Tue, 1 Oct 2019 18:45:43 -0500 |
From: Max Reitz <address@hidden>
Perform two guest writes to not yet backed up areas of an image, where
the former touches an inner area of the latter.
Before HEAD^, copy offloading broke this in two ways:
(1) The target image differs from the reference image (what the source
was when the backup started).
(2) But you will not see that in the failing output, because the job
offset is reported as being greater than the job length. This is
because one cluster is copied twice, and thus accounted for twice,
but of course the job length does not increase.
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Tested-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
(cherry picked from commit 5f594a2e99f19ca0f7744d333bcd556f5976b78f)
Signed-off-by: Michael Roth <address@hidden>
---
tests/qemu-iotests/056 | 39 ++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/056.out | 4 ++--
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056
index 3df323984d..e5ac25127b 100755
--- a/tests/qemu-iotests/056
+++ b/tests/qemu-iotests/056
@@ -133,6 +133,7 @@ class BackupTest(iotests.QMPTestCase):
self.vm = iotests.VM()
self.test_img = img_create('test')
self.dest_img = img_create('dest')
+ self.ref_img = img_create('ref')
self.vm.add_drive(self.test_img)
self.vm.launch()
@@ -140,6 +141,7 @@ class BackupTest(iotests.QMPTestCase):
self.vm.shutdown()
try_remove(self.test_img)
try_remove(self.dest_img)
+ try_remove(self.ref_img)
def hmp_io_writes(self, drive, patterns):
for pattern in patterns:
@@ -177,6 +179,43 @@ class BackupTest(iotests.QMPTestCase):
self.assert_qmp(event, 'data/error', qerror)
return False
+ def test_overlapping_writes(self):
+ # Write something to back up
+ self.hmp_io_writes('drive0', [('42', '0M', '2M')])
+
+ # Create a reference backup
+ self.qmp_backup_and_wait(device='drive0', format=iotests.imgfmt,
+ sync='full', target=self.ref_img,
+ auto_dismiss=False)
+ res = self.vm.qmp('block-job-dismiss', id='drive0')
+ self.assert_qmp(res, 'return', {})
+
+ # Now to the test backup: We simulate the following guest
+ # writes:
+ # (1) [1M + 64k, 1M + 128k): Afterwards, everything in that
+ # area should be in the target image, and we must not copy
+ # it again (because the source image has changed now)
+ # (64k is the job's cluster size)
+ # (2) [1M, 2M): The backup job must not get overeager. It
+ # must copy [1M, 1M + 64k) and [1M + 128k, 2M) separately,
+ # but not the area in between.
+
+ self.qmp_backup(device='drive0', format=iotests.imgfmt, sync='full',
+ target=self.dest_img, speed=1, auto_dismiss=False)
+
+ self.hmp_io_writes('drive0', [('23', '%ik' % (1024 + 64), '64k'),
+ ('66', '1M', '1M')])
+
+ # Let the job complete
+ res = self.vm.qmp('block-job-set-speed', device='drive0', speed=0)
+ self.assert_qmp(res, 'return', {})
+ self.qmp_backup_wait('drive0')
+ res = self.vm.qmp('block-job-dismiss', id='drive0')
+ self.assert_qmp(res, 'return', {})
+
+ self.assertTrue(iotests.compare_images(self.ref_img, self.dest_img),
+ 'target image does not match reference image')
+
def test_dismiss_false(self):
res = self.vm.qmp('query-block-jobs')
self.assert_qmp(res, 'return', [])
diff --git a/tests/qemu-iotests/056.out b/tests/qemu-iotests/056.out
index dae404e278..36376bed87 100644
--- a/tests/qemu-iotests/056.out
+++ b/tests/qemu-iotests/056.out
@@ -1,5 +1,5 @@
-.........
+..........
----------------------------------------------------------------------
-Ran 9 tests
+Ran 10 tests
OK
--
2.17.1
- [PATCH 35/97] docs: recommend use of md-clear feature on all Intel CPUs, (continued)
- [PATCH 35/97] docs: recommend use of md-clear feature on all Intel CPUs, Michael Roth, 2019/10/01
- [PATCH 43/97] hw/ssi/xilinx_spips: Avoid AXI writes to the LQSPI linear memory, Michael Roth, 2019/10/01
- [PATCH 36/97] virtio-pci: fix missing device properties, Michael Roth, 2019/10/01
- [PATCH 47/97] virtio-balloon: Fix wrong sign extension of PFNs, Michael Roth, 2019/10/01
- [PATCH 26/97] target/ppc: Fix xvabs[sd]p, xvnabs[sd]p, xvneg[sd]p, xvcpsgn[sd]p, Michael Roth, 2019/10/01
- [PATCH 27/97] target/ppc: Fix xvxsigdp, Michael Roth, 2019/10/01
- [PATCH 53/97] virtio-balloon: don't track subpages for the PBP, Michael Roth, 2019/10/01
- [PATCH 48/97] virtio-balloon: Fix QEMU crashes on pagesize > BALLOON_PAGE_SIZE, Michael Roth, 2019/10/01
- [PATCH 51/97] virtio-balloon: Rework pbp tracking data, Michael Roth, 2019/10/01
- [PATCH 55/97] i386/acpi: fix gint overflow in crs_range_compare, Michael Roth, 2019/10/01
- [PATCH 64/97] iotests: Test backup job with two guest writes,
Michael Roth <=
- [PATCH 68/97] iotests: Test unaligned blocking mirror write, Michael Roth, 2019/10/01
- [PATCH 58/97] block/backup: simplify backup_incremental_init_copy_bitmap, Michael Roth, 2019/10/01
- [PATCH 60/97] block/backup: refactor and tolerate unallocated cluster skipping, Michael Roth, 2019/10/01
- [PATCH 52/97] virtio-balloon: Use temporary PBP only, Michael Roth, 2019/10/01
- [PATCH 05/97] qcow2: Fix qcow2_make_empty() with external data file, Michael Roth, 2019/10/01
- [PATCH 69/97] block/backup: disable copy_range for compressed backup, Michael Roth, 2019/10/01
- [PATCH 78/97] iotests: Add supported protocols to execute_test(), Michael Roth, 2019/10/01
- [PATCH 07/97] cutils: Fix size_to_str() on 32-bit platforms, Michael Roth, 2019/10/01
- [PATCH 80/97] iotests: Restrict nbd Python tests to nbd, Michael Roth, 2019/10/01
- [PATCH 41/97] docs/bitmaps: use QMP lexer instead of json, Michael Roth, 2019/10/01