106 lines
4.3 KiB
Diff
106 lines
4.3 KiB
Diff
|
From 456c5e79c32e3f2f9319a7d1452fe523aded7835 Mon Sep 17 00:00:00 2001
|
||
|
From: Kevin Wolf <kwolf@redhat.com>
|
||
|
Date: Wed, 3 Jun 2020 16:03:21 +0100
|
||
|
Subject: [PATCH 22/26] iotests: Backup with different source/target size
|
||
|
|
||
|
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||
|
Message-id: <20200603160325.67506-8-kwolf@redhat.com>
|
||
|
Patchwork-id: 97106
|
||
|
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH v2 07/11] iotests: Backup with different source/target size
|
||
|
Bugzilla: 1778593
|
||
|
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||
|
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||
|
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||
|
|
||
|
This tests that the backup job catches situations where the target node
|
||
|
has a different size than the source node. It must also forbid resize
|
||
|
operations when the job is already running.
|
||
|
|
||
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||
|
Message-Id: <20200430142755.315494-5-kwolf@redhat.com>
|
||
|
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||
|
(cherry picked from commit 0a82a9273062d05764e3df3637b3aa95ad8291c6)
|
||
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||
|
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||
|
---
|
||
|
tests/qemu-iotests/055 | 42 ++++++++++++++++++++++++++++++++++++++++--
|
||
|
tests/qemu-iotests/055.out | 4 ++--
|
||
|
2 files changed, 42 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055
|
||
|
index c9cdc06..1c70389 100755
|
||
|
--- a/tests/qemu-iotests/055
|
||
|
+++ b/tests/qemu-iotests/055
|
||
|
@@ -48,8 +48,10 @@ class TestSingleDrive(iotests.QMPTestCase):
|
||
|
def setUp(self):
|
||
|
qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(image_len))
|
||
|
|
||
|
- self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
|
||
|
- self.vm.add_drive(blockdev_target_img, interface="none")
|
||
|
+ self.vm = iotests.VM()
|
||
|
+ self.vm.add_drive('blkdebug::' + test_img, 'node-name=source')
|
||
|
+ self.vm.add_drive(blockdev_target_img, 'node-name=target',
|
||
|
+ interface="none")
|
||
|
if iotests.qemu_default_machine == 'pc':
|
||
|
self.vm.add_drive(None, 'media=cdrom', 'ide')
|
||
|
self.vm.launch()
|
||
|
@@ -112,6 +114,42 @@ class TestSingleDrive(iotests.QMPTestCase):
|
||
|
def test_pause_blockdev_backup(self):
|
||
|
self.do_test_pause('blockdev-backup', 'drive1', blockdev_target_img)
|
||
|
|
||
|
+ def do_test_resize_blockdev_backup(self, device, node):
|
||
|
+ def pre_finalize():
|
||
|
+ result = self.vm.qmp('block_resize', device=device, size=65536)
|
||
|
+ self.assert_qmp(result, 'error/class', 'GenericError')
|
||
|
+
|
||
|
+ result = self.vm.qmp('block_resize', node_name=node, size=65536)
|
||
|
+ self.assert_qmp(result, 'error/class', 'GenericError')
|
||
|
+
|
||
|
+ result = self.vm.qmp('blockdev-backup', job_id='job0', device='drive0',
|
||
|
+ target='drive1', sync='full', auto_finalize=False,
|
||
|
+ auto_dismiss=False)
|
||
|
+ self.assert_qmp(result, 'return', {})
|
||
|
+
|
||
|
+ self.vm.run_job('job0', auto_finalize=False, pre_finalize=pre_finalize,
|
||
|
+ use_log=False)
|
||
|
+
|
||
|
+ def test_source_resize_blockdev_backup(self):
|
||
|
+ self.do_test_resize_blockdev_backup('drive0', 'source')
|
||
|
+
|
||
|
+ def test_target_resize_blockdev_backup(self):
|
||
|
+ self.do_test_resize_blockdev_backup('drive1', 'target')
|
||
|
+
|
||
|
+ def do_test_target_size(self, size):
|
||
|
+ result = self.vm.qmp('block_resize', device='drive1', size=size)
|
||
|
+ self.assert_qmp(result, 'return', {})
|
||
|
+
|
||
|
+ result = self.vm.qmp('blockdev-backup', job_id='job0', device='drive0',
|
||
|
+ target='drive1', sync='full')
|
||
|
+ self.assert_qmp(result, 'error/class', 'GenericError')
|
||
|
+
|
||
|
+ def test_small_target(self):
|
||
|
+ self.do_test_target_size(image_len // 2)
|
||
|
+
|
||
|
+ def test_large_target(self):
|
||
|
+ self.do_test_target_size(image_len * 2)
|
||
|
+
|
||
|
def test_medium_not_found(self):
|
||
|
if iotests.qemu_default_machine != 'pc':
|
||
|
return
|
||
|
diff --git a/tests/qemu-iotests/055.out b/tests/qemu-iotests/055.out
|
||
|
index 5c26d15..0a5e958 100644
|
||
|
--- a/tests/qemu-iotests/055.out
|
||
|
+++ b/tests/qemu-iotests/055.out
|
||
|
@@ -1,5 +1,5 @@
|
||
|
-....................................
|
||
|
+........................................
|
||
|
----------------------------------------------------------------------
|
||
|
-Ran 36 tests
|
||
|
+Ran 40 tests
|
||
|
|
||
|
OK
|
||
|
--
|
||
|
1.8.3.1
|
||
|
|