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