vmdk: Allow version 3 read only open
cover vmdk: Allow version 3 read only open
According to an update on VMware Knowledge Base [KB 2064959], we should be safe to open version 3 as read only. This is meaningful as an compatibility improvement, so let's enable it.
Fam
Fam Zheng (2):
vmdk: Allow read only open of VMDK version 3
qemu-iotests: Add sample image and test for VMDK version 3
block/vmdk.c | 5 ++++- tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 5 +++++ tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2 | Bin 0 -> 414 bytes 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2
Signature · 1 line
1.8.4.2
PATCH 1/2 vmdk: Allow read only open of VMDK version 3
--- block/vmdk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
block/vmdk.c +4 -1
@@ -605,13 +605,16 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, header = footer.header; } -if (le32_to_cpu (header.version) >=3 ) { +if (le32_to_cpu (header.version) >3 ) {char buf[64 ];snprintf (buf,sizeof (buf),"VMDK version %d" ,le32_to_cpu (header.version));qerror_report (QERR_UNKNOWN_BLOCK_FORMAT_FEATURE , bs->device_name,"vmdk" , buf);return -ENOTSUP ; + }else if (le32_to_cpu (header.version) ==3 && flags &BDRV_O_RDWR ) { +error_setg (errp,"VMDK version 3 must be read only" ); +return -EINVAL ; }if (le32_to_cpu (header.num_gtes_per_gt) >512 ) {
Signature · 1 line
1.8.4.2
Re: [Qemu-devel] [PATCH 1/2] vmdk: Allow read only open of VMDK version 3
Il 27/11/2013 03:06, Fam Zheng ha scritto:
Quoted 1 line
+ } else if (
le32_to_cpu(header.version)== 3 && flags &BDRV_O_RDWR) {
Parentheses around "flags & BDRV_O_RDWR", please.
I'll try to patch checkpatch.pl to flag this.
Paolo
Quoted 3 lines
block/vmdk.c +2
-0+error_setg (errp,"VMDK version 3 must be read only" ); +return -EINVAL ; }
PATCH 2/2 qemu-iotests: Add sample image and test for VMDK version 3
In reply to Fam Zheng--- tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 5 +++++ tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2 | Bin 0 -> 414 bytes 3 files changed, 10 insertions(+) create mode 100644 tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2
tests/qemu-iotests/059 +5 -0
@@ -75,6 +75,11 @@ echo echo "=== Testing monolithicFlat with zeroed_grain ===" IMGOPTS="subformat=monolithicFlat,zeroed_grain=on" _make_test_img 2G +echo +echo "=== Testing version 3 ===" +_use_sample_img iotest-version3.vmdk.bz2 +_img_info + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/059.out +5 -0
@@ -25,4 +25,9 @@ virtual size: 2.0G (2147483648 bytes) === Testing monolithicFlat with zeroed_grain === qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 + +=== Testing version 3 === +image: TEST_DIR/iotest-version3.IMGFMT +file format: IMGFMT +virtual size: 1.0G (1073741824 bytes) *** done
tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2 new file binary +0 -0
Signature · 1 line
1.8.4.2
Quoted 3 lines · Fam Zheng
According to an update on VMware Knowledge Base [KB 2064959], we should be safe to open version 3 as read only. This is meaningful as an compatibility improvement, so let's enable it.
But please add a comment in vmdk.c that links to the Knowledge Base or explains that version 3 simply adds the new CBT file which we can ignore for reads.