Skip to contentSkip to conversation

vmdk: Set vmdk parent backing_format to vmdk

PATCH Superseded Thomas Huth 3 participants 7 messages May 2, 2019 – May 7, 2019 3 messages not in the archive Block layer

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 38 lines · Sam Eiderman

Thanks,

Also please notice that the mentioned commit in the commit message has it’s commit id changed to b69864e.

Sam

Quoted 32 lines · Eric Blake
Quoted 2 lines · Sam Eiderman

Commit fb2105b ("vmdk: Support version=3 in VMDK descriptor files") fixed the probe function to correctly guess vmdk descriptors with version=3.

All patches need to cc qemu-devel in addition to their maintainers (I've added that now).

Quoted 23 lines

This solves the issue where vmdk snapshot with parent vmdk descriptor containing "version=3" would be treated as raw instead vmdk.

In the future case where a new vmdk version is introduced, we will again experience this issue, even if the user will provide "-f vmdk" it will only apply to the tip image and not to the underlying "misprobed" parent image.

The code in vmdk.c already assumes that the backing file of vmdk must be vmdk (see vmdk_is_cid_valid which returns 0 if backing file is not vmdk).

So let's make it official by supplying the backing_format as vmdk.

---
block/vmdk.c | 2 ++

1 file changed, 2 insertions(+)
Quoted 11 lines
Quoted 11 lines

block/vmdk.c static int vmdk_parent_open(BlockDriverState *bs) · line 402

Quoted 11 lines
block/vmdk.c +2 -0
index 8dec6ef767..de8cb859f8 100644
@@ -397,6 +397,8 @@ static int vmdk_parent_open(BlockDriverState *bs)
        pstrcpy(bs->auto_backing_file, end_name - p_name + 1, p_name);
        pstrcpy(bs->backing_file, sizeof(bs->backing_file),
                bs->auto_backing_file);
+        pstrcpy(bs->backing_format, sizeof(bs->backing_format),
+                "vmdk");
    }

Hi,

this patch broke the vmdk qemu-iotests:

$ cd tests/qemu-iotests/ ; ./check -vmdk 110 126 ; cd ../..
[...]
110 0s ... - output mismatch (see 110.out.bad)
--- /home/thuth/devel/qemu/tests/qemu-iotests/110.out	2019-05-02
11:27:41.000000000 +0200
+++ /home/thuth/tmp/qemu-build/tests/qemu-iotests/110.out.bad	2019-05-02
11:27:54.000000000 +0200
@@ -8,6 +8,7 @@
 file format: IMGFMT
 virtual size: 64M (67108864 bytes)
 backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
+backing file format: IMGFMT

=== Non-reconstructable filename ===

@@ -15,6 +16,7 @@
file format: IMGFMT
virtual size: 64M (67108864 bytes)
backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
+backing file format: IMGFMT

=== Backing name is always relative to the backed image ===

@@ -26,4 +28,5 @@
file format: IMGFMT
virtual size: 64M (67108864 bytes)
backing file: t.IMGFMT.base (cannot determine actual path)
+backing file format: IMGFMT
*** done
126 0s ... - output mismatch (see 126.out.bad)
--- /home/thuth/devel/qemu/tests/qemu-iotests/126.out 2019-05-02
11:27:41.000000000 +0200
+++ /home/thuth/tmp/qemu-build/tests/qemu-iotests/126.out.bad 2019-05-02
11:27:55.000000000 +0200
@@ -13,6 +13,7 @@
file format: IMGFMT
virtual size: 64M (67108864 bytes)
backing file: ./image:base.IMGFMT (actual path:
TEST_DIR/./image:base.IMGFMT)
+backing file format: IMGFMT

Formatting 'base.IMGFMT', fmt=IMGFMT size=67108864 Formatting 'file:image:top.IMGFMT', fmt=IMGFMT size=67108864
backing_file=base.IMGFMT
@@ -20,4 +21,5 @@
file format: IMGFMT
virtual size: 64M (67108864 bytes)
backing file: base.IMGFMT (actual path: ./base.IMGFMT)
+backing file format: IMGFMT
*** done
Failures: 110 126
Failed 2 of 2 tests

Could you please send a patch to fix this?

Thanks,
Thomas

#4 lore raw

PATCH v2 1/1 vmdk: Set vmdk parent backing_format to vmdk

Fixing broken iotests 110 and and 126 by filtering out "backing file format" as Max suggested.

#5 lore raw

PATCH v2 1/1 vmdk: Set vmdk parent backing_format to vmdk

Commit b69864e ("vmdk: Support version=3 in VMDK descriptor files") fixed the probe function to correctly guess vmdk descriptors with version=3.

This solves the issue where vmdk snapshot with parent vmdk descriptor containing "version=3" would be treated as raw instead vmdk.

In the future case where a new vmdk version is introduced, we will again experience this issue, even if the user will provide "-f vmdk" it will only apply to the tip image and not to the underlying "misprobed" parent image.

The code in vmdk.c already assumes that the backing file of vmdk must be vmdk (see vmdk_is_cid_valid which returns 0 if backing file is not vmdk).

So let's make it official by supplying the backing_format as vmdk.

---
 block/vmdk.c           | 2 ++
 tests/qemu-iotests/110 | 6 +++---
 tests/qemu-iotests/126 | 4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)
block/vmdk.c +2 -0
index 8dec6ef767..de8cb859f8 100644
@@ -397,6 +397,8 @@ static int vmdk_parent_open(BlockDriverState *bs)
         pstrcpy(bs->auto_backing_file, end_name - p_name + 1, p_name);
         pstrcpy(bs->backing_file, sizeof(bs->backing_file),
                 bs->auto_backing_file);
+        pstrcpy(bs->backing_format, sizeof(bs->backing_format),
+                "vmdk");
     }
 
 out:
tests/qemu-iotests/110 +3 -3
index fad672c1ae..982569dbc5 100755
@@ -54,7 +54,7 @@ _make_test_img -b "$TEST_IMG_REL.base" 64M
 # qemu should be able to reconstruct the filename, so relative backing names
 # should work
 TEST_IMG="json:{'driver':'$IMGFMT','file':{'driver':'file','filename':'$TEST_IMG'}}" \
-    _img_info | _filter_img_info
+    _img_info | _filter_img_info | grep -v "backing file format"
 
 echo
 echo '=== Non-reconstructable filename ==='
@@ -78,7 +78,7 @@ TEST_IMG="json:{
             }
         ]
     }
-}" _img_info | _filter_img_info
+}" _img_info | _filter_img_info | grep -v "backing file format"
 
 echo
 echo '=== Backing name is always relative to the backed image ==='
@@ -110,7 +110,7 @@ TEST_IMG="json:{
             }
         ]
     }
-}" _img_info | _filter_img_info
+}" _img_info | _filter_img_info | grep -v "backing file format"
 
 
 # success, all done
tests/qemu-iotests/126 +2 -2
index 96dc048d59..1f7618c8a5 100755
@@ -63,7 +63,7 @@ TEST_IMG=$BASE_IMG _make_test_img 64M
 TEST_IMG=$TOP_IMG _make_test_img -b ./image:base.$IMGFMT
 
 # The default cluster size depends on the image format
-TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size'
+TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size\|backing file format'
 
 _rm_test_img "$BASE_IMG"
 _rm_test_img "$TOP_IMG"
@@ -79,7 +79,7 @@ TOP_IMG="file:image:top.$IMGFMT"
 TEST_IMG=$BASE_IMG _make_test_img 64M
 TEST_IMG=$TOP_IMG _make_test_img -b "$BASE_IMG"
 
-TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size'
+TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size\|backing file format'
 
 _rm_test_img "$BASE_IMG"
 _rm_test_img "image:top.$IMGFMT"
Signature · 1 line
2.13.3
#6 lore raw

Hi Sam,

Quoted 33 lines · Sam Eiderman

Commit b69864e ("vmdk: Support version=3 in VMDK descriptor files") fixed the probe function to correctly guess vmdk descriptors with version=3.

This solves the issue where vmdk snapshot with parent vmdk descriptor containing "version=3" would be treated as raw instead vmdk.

In the future case where a new vmdk version is introduced, we will again experience this issue, even if the user will provide "-f vmdk" it will only apply to the tip image and not to the underlying "misprobed" parent image.

The code in vmdk.c already assumes that the backing file of vmdk must be vmdk (see vmdk_is_cid_valid which returns 0 if backing file is not vmdk).

So let's make it official by supplying the backing_format as vmdk.

---
 block/vmdk.c           | 2 ++
 tests/qemu-iotests/110 | 6 +++---
 tests/qemu-iotests/126 | 4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)
block/vmdk.c +0 -0
index 8dec6ef767..de8cb859f8 100644

block/vmdk.c static int vmdk_parent_open(BlockDriverState *bs) · line 402

Quoted 6 lines
block/vmdk.c +2 -0
@@ -397,6 +397,8 @@ static int vmdk_parent_open(BlockDriverState *bs)
         pstrcpy(bs->auto_backing_file, end_name - p_name + 1, p_name);
         pstrcpy(bs->backing_file, sizeof(bs->backing_file),
                 bs->auto_backing_file);
+        pstrcpy(bs->backing_format, sizeof(bs->backing_format),
+                "vmdk");
     }

Your patch with this change has already been merged into the QEMU master branch...

Quoted 46 lines
tests/qemu-iotests/110 +3 -3
index fad672c1ae..982569dbc5 100755
@@ -54,7 +54,7 @@ _make_test_img -b "$TEST_IMG_REL.base" 64M
 # qemu should be able to reconstruct the filename, so relative backing names
 # should work
 TEST_IMG="json:{'driver':'$IMGFMT','file':{'driver':'file','filename':'$TEST_IMG'}}" \
-    _img_info | _filter_img_info
+    _img_info | _filter_img_info | grep -v "backing file format"
 
 echo
 echo '=== Non-reconstructable filename ==='
@@ -78,7 +78,7 @@ TEST_IMG="json:{
             }
         ]
     }
-}" _img_info | _filter_img_info
+}" _img_info | _filter_img_info | grep -v "backing file format"
 
 echo
 echo '=== Backing name is always relative to the backed image ==='
@@ -110,7 +110,7 @@ TEST_IMG="json:{
             }
         ]
     }
-}" _img_info | _filter_img_info
+}" _img_info | _filter_img_info | grep -v "backing file format"
 
 
 # success, all done
tests/qemu-iotests/126 +1 -1
index 96dc048d59..1f7618c8a5 100755
@@ -63,7 +63,7 @@ TEST_IMG=$BASE_IMG _make_test_img 64M
 TEST_IMG=$TOP_IMG _make_test_img -b ./image:base.$IMGFMT
 
 # The default cluster size depends on the image format
-TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size'
+TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size\|backing file format'
 
 _rm_test_img "$BASE_IMG"
 _rm_test_img "$TOP_IMG"

tests/qemu-iotests/126 TOP_IMG="file:image:top.$IMGFMT" · line 85

Quoted 8 lines
tests/qemu-iotests/126 +1 -1
@@ -79,7 +79,7 @@ TOP_IMG="file:image:top.$IMGFMT"
 TEST_IMG=$BASE_IMG _make_test_img 64M
 TEST_IMG=$TOP_IMG _make_test_img -b "$BASE_IMG"
 
-TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size'
+TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size\|backing file format'
 
 _rm_test_img "$BASE_IMG"
 _rm_test_img "image:top.$IMGFMT"

... so please just send a patch with these fixes!

Thanks,
Thomas

#7 lore raw
Quoted 94 lines · Thomas Huth

Hi Sam,

Quoted 33 lines · Sam Eiderman

Commit b69864e ("vmdk: Support version=3 in VMDK descriptor files") fixed the probe function to correctly guess vmdk descriptors with version=3.

This solves the issue where vmdk snapshot with parent vmdk descriptor containing "version=3" would be treated as raw instead vmdk.

In the future case where a new vmdk version is introduced, we will again experience this issue, even if the user will provide "-f vmdk" it will only apply to the tip image and not to the underlying "misprobed" parent image.

The code in vmdk.c already assumes that the backing file of vmdk must be vmdk (see vmdk_is_cid_valid which returns 0 if backing file is not vmdk).

So let's make it official by supplying the backing_format as vmdk.

---
 block/vmdk.c           | 2 ++
 tests/qemu-iotests/110 | 6 +++---
 tests/qemu-iotests/126 | 4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)
block/vmdk.c +0 -0
index 8dec6ef767..de8cb859f8 100644

block/vmdk.c static int vmdk_parent_open(BlockDriverState *bs) · line 402

Quoted 6 lines
block/vmdk.c +2 -0
@@ -397,6 +397,8 @@ static int vmdk_parent_open(BlockDriverState *bs)
         pstrcpy(bs->auto_backing_file, end_name - p_name + 1, p_name);
         pstrcpy(bs->backing_file, sizeof(bs->backing_file),
                 bs->auto_backing_file);
+        pstrcpy(bs->backing_format, sizeof(bs->backing_format),
+                "vmdk");
     }

Your patch with this change has already been merged into the QEMU master branch...

Quoted 48 lines
tests/qemu-iotests/110 +3 -3
index fad672c1ae..982569dbc5 100755
@@ -54,7 +54,7 @@ _make_test_img -b "$TEST_IMG_REL.base" 64M
 # qemu should be able to reconstruct the filename, so relative backing names
 # should work
 TEST_IMG="json:{'driver':'$IMGFMT','file':{'driver':'file','filename':'$TEST_IMG'}}" \
-    _img_info | _filter_img_info
+    _img_info | _filter_img_info | grep -v "backing file format"
 
 echo
 echo '=== Non-reconstructable filename ==='
@@ -78,7 +78,7 @@ TEST_IMG="json:{
             }
         ]
     }
-}" _img_info | _filter_img_info
+}" _img_info | _filter_img_info | grep -v "backing file format"
 
 echo
 echo '=== Backing name is always relative to the backed image ==='
@@ -110,7 +110,7 @@ TEST_IMG="json:{
             }
         ]
     }
-}" _img_info | _filter_img_info
+}" _img_info | _filter_img_info | grep -v "backing file format"
 
 
 # success, all done
tests/qemu-iotests/126 +1 -1
index 96dc048d59..1f7618c8a5 100755
@@ -63,7 +63,7 @@ TEST_IMG=$BASE_IMG _make_test_img 64M
 TEST_IMG=$TOP_IMG _make_test_img -b ./image:base.$IMGFMT
 
 # The default cluster size depends on the image format
-TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size'
+TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size\|backing file format'
 
 _rm_test_img "$BASE_IMG"
 _rm_test_img "$TOP_IMG"
@@ -79,7 +79,7 @@ TOP_IMG="file:image:top.$IMGFMT"
 TEST_IMG=$BASE_IMG _make_test_img 64M
 TEST_IMG=$TOP_IMG _make_test_img -b "$BASE_IMG"
 
Quoted 8 lines

tests/qemu-iotests/126 TOP_IMG="file:image:top.$IMGFMT" · line 85

Quoted 6 lines
tests/qemu-iotests/126 +1 -1
-TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size'
+TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size\|backing file format'
 
 _rm_test_img "$BASE_IMG"
 _rm_test_img "image:top.$IMGFMT"

... so please just send a patch with these fixes!

I already did, it's here:

http://lists.nongnu.org/archive/html/qemu-block/2019-04/msg00442.html

Max

#8 lore raw

Thanks Thomas, Thanks Max

So how do you want to proceed?

Apply Max’s RFC from here (http://lists.nongnu.org/archive/html/qemu-block/2019-04/msg00442.html <http://lists.nongnu.org/archive/html/qemu-block/2019-04/msg00442.html>) and add the commit id which is stable now? Or should I resubmit my fix (which is very similar to what Max did) without the original change?

Sam

Quoted 111 lines · Max Reitz
Quoted 94 lines · Thomas Huth

Hi Sam,

Quoted 33 lines · Sam Eiderman

Commit b69864e ("vmdk: Support version=3 in VMDK descriptor files") fixed the probe function to correctly guess vmdk descriptors with version=3.

This solves the issue where vmdk snapshot with parent vmdk descriptor containing "version=3" would be treated as raw instead vmdk.

In the future case where a new vmdk version is introduced, we will again experience this issue, even if the user will provide "-f vmdk" it will only apply to the tip image and not to the underlying "misprobed" parent image.

The code in vmdk.c already assumes that the backing file of vmdk must be vmdk (see vmdk_is_cid_valid which returns 0 if backing file is not vmdk).

So let's make it official by supplying the backing_format as vmdk.

---

block/vmdk.c           | 2 ++
tests/qemu-iotests/110 | 6 +++---
tests/qemu-iotests/126 | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)
block/vmdk.c +0 -0
index 8dec6ef767..de8cb859f8 100644

block/vmdk.c static int vmdk_parent_open(BlockDriverState *bs) · line 402

Quoted 6 lines
block/vmdk.c +2 -0
@@ -397,6 +397,8 @@ static int vmdk_parent_open(BlockDriverState *bs)
        pstrcpy(bs->auto_backing_file, end_name - p_name + 1, p_name);
        pstrcpy(bs->backing_file, sizeof(bs->backing_file),
                bs->auto_backing_file);
+        pstrcpy(bs->backing_format, sizeof(bs->backing_format),
+                "vmdk");
    }

Your patch with this change has already been merged into the QEMU master branch...

Quoted 48 lines
tests/qemu-iotests/110 +1 -1
index fad672c1ae..982569dbc5 100755
@@ -54,7 +54,7 @@ _make_test_img -b "$TEST_IMG_REL.base" 64M
 # qemu should be able to reconstruct the filename, so relative backing names
 # should work
 TEST_IMG="json:{'driver':'$IMGFMT','file':{'driver':'file','filename':'$TEST_IMG'}}" \
-    _img_info | _filter_img_info
+    _img_info | _filter_img_info | grep -v "backing file format"
 

echo
echo '=== Non-reconstructable filename ==='

tests/qemu-iotests/110 +1 -1
@@ -78,7 +78,7 @@ TEST_IMG="json:{
            }
        ]
    }
-}" _img_info | _filter_img_info
+}" _img_info | _filter_img_info | grep -v "backing file format"
 

echo
echo '=== Backing name is always relative to the backed image ==='

tests/qemu-iotests/110 +1 -1
@@ -110,7 +110,7 @@ TEST_IMG="json:{
            }
        ]
    }
-}" _img_info | _filter_img_info
+}" _img_info | _filter_img_info | grep -v "backing file format"
 
 
 # success, all done
tests/qemu-iotests/126 +0 -0
index 96dc048d59..1f7618c8a5 100755
@@ -63,7 +63,7 @@ TEST_IMG=$BASE_IMG _make_test_img 64M

TEST_IMG=$TOP_IMG _make_test_img -b ./image:base.$IMGFMT

# The default cluster size depends on the image format

tests/qemu-iotests/126 +1 -1
-TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size'
+TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size\|backing file format'

_rm_test_img "$BASE_IMG"
_rm_test_img "$TOP_IMG"

tests/qemu-iotests/126 +0 -0
@@ -79,7 +79,7 @@ TOP_IMG="file:image:top.$IMGFMT"

TEST_IMG=$BASE_IMG _make_test_img 64M
TEST_IMG=$TOP_IMG _make_test_img -b "$BASE_IMG"

Quoted 8 lines
Quoted 6 lines
tests/qemu-iotests/126 +1 -1
-TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size'
+TEST_IMG=$TOP_IMG _img_info | grep -v 'cluster_size\|backing file format'

_rm_test_img "$BASE_IMG"
_rm_test_img "image:top.$IMGFMT"

... so please just send a patch with these fixes!

I already did, it's here:

http://lists.nongnu.org/archive/html/qemu-block/2019-04/msg00442.html <http://lists.nongnu.org/archive/html/qemu-block/2019-04/msg00442.html>

Max