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