From: Denis V. Lunev <[email protected]>

Use a different bitmap name for parallels images, as the format has its
own ID format and can not hold an arbitrary string.

Replace the hardcoded 'qcow2' target format with iotests.imgfmt.

Add 'parallels' to the supported formats.

Based on the original work from Alexander Ivanov.

Cc: Stefan Hajnoczi <[email protected]>
Cc: Vladimir Sementsov-Ogievskiy <[email protected]>
Signed-off-by: Denis V. Lunev <[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
---
 tests/qemu-iotests/tests/image-fleecing | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/tests/image-fleecing 
b/tests/qemu-iotests/tests/image-fleecing
index b42aa6967f..0142289843 100755
--- a/tests/qemu-iotests/tests/image-fleecing
+++ b/tests/qemu-iotests/tests/image-fleecing
@@ -28,7 +28,7 @@ import iotests
 from iotests import log, qemu_img, qemu_io
 
 iotests.script_initialize(
-    supported_fmts=['qcow2'],
+    supported_fmts=['qcow2', 'parallels'],
     supported_platforms=['linux'],
     required_fmts=['copy-before-write'],
     unsupported_imgopts=['compat'],
@@ -62,12 +62,18 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, 
base_img_path,
     if push_backup:
         assert use_cbw
 
+    # parallels stores a bitmap name as the UUID identifying it in the image
+    if iotests.imgfmt == 'parallels':
+        bitmap_name = '00000000-0000-0000-0000-000000000000'
+    else:
+        bitmap_name = 'bitmap0'
+
     log('--- Setting up images ---')
     log('')
 
     qemu_img('create', '-f', iotests.imgfmt, base_img_path, '64M')
     if bitmap:
-        qemu_img('bitmap', '--add', base_img_path, 'bitmap0')
+        qemu_img('bitmap', '--add', base_img_path, bitmap_name)
 
     if use_snapshot_access_filter:
         assert use_cbw
@@ -76,7 +82,7 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, 
base_img_path,
         qemu_img('create', '-f', 'qcow2', fleece_img_path, '64M')
 
     if push_backup:
-        qemu_img('create', '-f', 'qcow2', target_img_path, '64M')
+        qemu_img('create', '-f', iotests.imgfmt, target_img_path, '64M')
 
     for p in patterns:
         qemu_io('-f', iotests.imgfmt,
@@ -131,7 +137,7 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, 
base_img_path,
         }
 
         if bitmap:
-            fl_cbw['bitmap'] = {'node': src_node, 'name': 'bitmap0'}
+            fl_cbw['bitmap'] = {'node': src_node, 'name': bitmap_name}
 
         log(vm.qmp('blockdev-add', fl_cbw))
 
-- 
2.53.0


Reply via email to