|
|
ddf19c |
From a5bf39550e82dbbe18f8debe07fa5d968a3fcf51 Mon Sep 17 00:00:00 2001
|
|
|
ddf19c |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
ddf19c |
Date: Wed, 3 Jun 2020 16:03:17 +0100
|
|
|
ddf19c |
Subject: [PATCH 18/26] iotests/055: refactor compressed backup to vmdk
|
|
|
ddf19c |
|
|
|
ddf19c |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
ddf19c |
Message-id: <20200603160325.67506-4-kwolf@redhat.com>
|
|
|
ddf19c |
Patchwork-id: 97104
|
|
|
ddf19c |
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH v2 03/11] iotests/055: refactor compressed backup to vmdk
|
|
|
ddf19c |
Bugzilla: 1778593
|
|
|
ddf19c |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
Instead of looping in each test, let's better refactor vmdk target case
|
|
|
ddf19c |
as a subclass.
|
|
|
ddf19c |
|
|
|
ddf19c |
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
ddf19c |
Message-Id: <20200430124713.3067-6-vsementsov@virtuozzo.com>
|
|
|
ddf19c |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ddf19c |
(cherry picked from commit 8e8372944e5e097e98844b4db10f867689065e16)
|
|
|
ddf19c |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ddf19c |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ddf19c |
---
|
|
|
ddf19c |
tests/qemu-iotests/055 | 70 ++++++++++++++++++++++++----------------------
|
|
|
ddf19c |
tests/qemu-iotests/055.out | 4 +--
|
|
|
ddf19c |
2 files changed, 39 insertions(+), 35 deletions(-)
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055
|
|
|
ddf19c |
index eb50c9f..8666601 100755
|
|
|
ddf19c |
--- a/tests/qemu-iotests/055
|
|
|
ddf19c |
+++ b/tests/qemu-iotests/055
|
|
|
ddf19c |
@@ -450,10 +450,9 @@ class TestSingleTransaction(iotests.QMPTestCase):
|
|
|
ddf19c |
self.assert_no_active_block_jobs()
|
|
|
ddf19c |
|
|
|
ddf19c |
|
|
|
ddf19c |
-class TestDriveCompression(iotests.QMPTestCase):
|
|
|
ddf19c |
+class TestCompressedToQcow2(iotests.QMPTestCase):
|
|
|
ddf19c |
image_len = 64 * 1024 * 1024 # MB
|
|
|
ddf19c |
- fmt_supports_compression = [{'type': 'qcow2', 'args': ()},
|
|
|
ddf19c |
- {'type': 'vmdk', 'args': ('-o', 'subformat=streamOptimized')}]
|
|
|
ddf19c |
+ target_fmt = {'type': 'qcow2', 'args': ()}
|
|
|
ddf19c |
|
|
|
ddf19c |
def tearDown(self):
|
|
|
ddf19c |
self.vm.shutdown()
|
|
|
ddf19c |
@@ -463,19 +462,20 @@ class TestDriveCompression(iotests.QMPTestCase):
|
|
|
ddf19c |
except OSError:
|
|
|
ddf19c |
pass
|
|
|
ddf19c |
|
|
|
ddf19c |
- def do_prepare_drives(self, fmt, args, attach_target):
|
|
|
ddf19c |
+ def do_prepare_drives(self, attach_target):
|
|
|
ddf19c |
self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
|
|
|
ddf19c |
|
|
|
ddf19c |
- qemu_img('create', '-f', fmt, blockdev_target_img,
|
|
|
ddf19c |
- str(TestDriveCompression.image_len), *args)
|
|
|
ddf19c |
+ qemu_img('create', '-f', self.target_fmt['type'], blockdev_target_img,
|
|
|
ddf19c |
+ str(self.image_len), *self.target_fmt['args'])
|
|
|
ddf19c |
if attach_target:
|
|
|
ddf19c |
self.vm.add_drive(blockdev_target_img,
|
|
|
ddf19c |
- img_format=fmt, interface="none")
|
|
|
ddf19c |
+ img_format=self.target_fmt['type'],
|
|
|
ddf19c |
+ interface="none")
|
|
|
ddf19c |
|
|
|
ddf19c |
self.vm.launch()
|
|
|
ddf19c |
|
|
|
ddf19c |
- def do_test_compress_complete(self, cmd, format, attach_target, **args):
|
|
|
ddf19c |
- self.do_prepare_drives(format['type'], format['args'], attach_target)
|
|
|
ddf19c |
+ def do_test_compress_complete(self, cmd, attach_target, **args):
|
|
|
ddf19c |
+ self.do_prepare_drives(attach_target)
|
|
|
ddf19c |
|
|
|
ddf19c |
self.assert_no_active_block_jobs()
|
|
|
ddf19c |
|
|
|
ddf19c |
@@ -486,21 +486,21 @@ class TestDriveCompression(iotests.QMPTestCase):
|
|
|
ddf19c |
|
|
|
ddf19c |
self.vm.shutdown()
|
|
|
ddf19c |
self.assertTrue(iotests.compare_images(test_img, blockdev_target_img,
|
|
|
ddf19c |
- iotests.imgfmt, format['type']),
|
|
|
ddf19c |
+ iotests.imgfmt,
|
|
|
ddf19c |
+ self.target_fmt['type']),
|
|
|
ddf19c |
'target image does not match source after backup')
|
|
|
ddf19c |
|
|
|
ddf19c |
def test_complete_compress_drive_backup(self):
|
|
|
ddf19c |
- for format in TestDriveCompression.fmt_supports_compression:
|
|
|
ddf19c |
- self.do_test_compress_complete('drive-backup', format, False,
|
|
|
ddf19c |
- target=blockdev_target_img, mode='existing')
|
|
|
ddf19c |
+ self.do_test_compress_complete('drive-backup', False,
|
|
|
ddf19c |
+ target=blockdev_target_img,
|
|
|
ddf19c |
+ mode='existing')
|
|
|
ddf19c |
|
|
|
ddf19c |
def test_complete_compress_blockdev_backup(self):
|
|
|
ddf19c |
- for format in TestDriveCompression.fmt_supports_compression:
|
|
|
ddf19c |
- self.do_test_compress_complete('blockdev-backup', format, True,
|
|
|
ddf19c |
- target='drive1')
|
|
|
ddf19c |
+ self.do_test_compress_complete('blockdev-backup',
|
|
|
ddf19c |
+ True, target='drive1')
|
|
|
ddf19c |
|
|
|
ddf19c |
- def do_test_compress_cancel(self, cmd, format, attach_target, **args):
|
|
|
ddf19c |
- self.do_prepare_drives(format['type'], format['args'], attach_target)
|
|
|
ddf19c |
+ def do_test_compress_cancel(self, cmd, attach_target, **args):
|
|
|
ddf19c |
+ self.do_prepare_drives(attach_target)
|
|
|
ddf19c |
|
|
|
ddf19c |
self.assert_no_active_block_jobs()
|
|
|
ddf19c |
|
|
|
ddf19c |
@@ -514,17 +514,16 @@ class TestDriveCompression(iotests.QMPTestCase):
|
|
|
ddf19c |
self.vm.shutdown()
|
|
|
ddf19c |
|
|
|
ddf19c |
def test_compress_cancel_drive_backup(self):
|
|
|
ddf19c |
- for format in TestDriveCompression.fmt_supports_compression:
|
|
|
ddf19c |
- self.do_test_compress_cancel('drive-backup', format, False,
|
|
|
ddf19c |
- target=blockdev_target_img, mode='existing')
|
|
|
ddf19c |
+ self.do_test_compress_cancel('drive-backup', False,
|
|
|
ddf19c |
+ target=blockdev_target_img,
|
|
|
ddf19c |
+ mode='existing')
|
|
|
ddf19c |
|
|
|
ddf19c |
def test_compress_cancel_blockdev_backup(self):
|
|
|
ddf19c |
- for format in TestDriveCompression.fmt_supports_compression:
|
|
|
ddf19c |
- self.do_test_compress_cancel('blockdev-backup', format, True,
|
|
|
ddf19c |
- target='drive1')
|
|
|
ddf19c |
+ self.do_test_compress_cancel('blockdev-backup', True,
|
|
|
ddf19c |
+ target='drive1')
|
|
|
ddf19c |
|
|
|
ddf19c |
- def do_test_compress_pause(self, cmd, format, attach_target, **args):
|
|
|
ddf19c |
- self.do_prepare_drives(format['type'], format['args'], attach_target)
|
|
|
ddf19c |
+ def do_test_compress_pause(self, cmd, attach_target, **args):
|
|
|
ddf19c |
+ self.do_prepare_drives(attach_target)
|
|
|
ddf19c |
|
|
|
ddf19c |
self.assert_no_active_block_jobs()
|
|
|
ddf19c |
|
|
|
ddf19c |
@@ -550,18 +549,23 @@ class TestDriveCompression(iotests.QMPTestCase):
|
|
|
ddf19c |
|
|
|
ddf19c |
self.vm.shutdown()
|
|
|
ddf19c |
self.assertTrue(iotests.compare_images(test_img, blockdev_target_img,
|
|
|
ddf19c |
- iotests.imgfmt, format['type']),
|
|
|
ddf19c |
+ iotests.imgfmt,
|
|
|
ddf19c |
+ self.target_fmt['type']),
|
|
|
ddf19c |
'target image does not match source after backup')
|
|
|
ddf19c |
|
|
|
ddf19c |
def test_compress_pause_drive_backup(self):
|
|
|
ddf19c |
- for format in TestDriveCompression.fmt_supports_compression:
|
|
|
ddf19c |
- self.do_test_compress_pause('drive-backup', format, False,
|
|
|
ddf19c |
- target=blockdev_target_img, mode='existing')
|
|
|
ddf19c |
+ self.do_test_compress_pause('drive-backup', False,
|
|
|
ddf19c |
+ target=blockdev_target_img,
|
|
|
ddf19c |
+ mode='existing')
|
|
|
ddf19c |
|
|
|
ddf19c |
def test_compress_pause_blockdev_backup(self):
|
|
|
ddf19c |
- for format in TestDriveCompression.fmt_supports_compression:
|
|
|
ddf19c |
- self.do_test_compress_pause('blockdev-backup', format, True,
|
|
|
ddf19c |
- target='drive1')
|
|
|
ddf19c |
+ self.do_test_compress_pause('blockdev-backup', True,
|
|
|
ddf19c |
+ target='drive1')
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+class TestCompressedToVmdk(TestCompressedToQcow2):
|
|
|
ddf19c |
+ target_fmt = {'type': 'vmdk', 'args': ('-o', 'subformat=streamOptimized')}
|
|
|
ddf19c |
+
|
|
|
ddf19c |
|
|
|
ddf19c |
if __name__ == '__main__':
|
|
|
ddf19c |
iotests.main(supported_fmts=['raw', 'qcow2'],
|
|
|
ddf19c |
diff --git a/tests/qemu-iotests/055.out b/tests/qemu-iotests/055.out
|
|
|
ddf19c |
index 5ce2f9a..5c26d15 100644
|
|
|
ddf19c |
--- a/tests/qemu-iotests/055.out
|
|
|
ddf19c |
+++ b/tests/qemu-iotests/055.out
|
|
|
ddf19c |
@@ -1,5 +1,5 @@
|
|
|
ddf19c |
-..............................
|
|
|
ddf19c |
+....................................
|
|
|
ddf19c |
----------------------------------------------------------------------
|
|
|
ddf19c |
-Ran 30 tests
|
|
|
ddf19c |
+Ran 36 tests
|
|
|
ddf19c |
|
|
|
ddf19c |
OK
|
|
|
ddf19c |
--
|
|
|
ddf19c |
1.8.3.1
|
|
|
ddf19c |
|