vmdk: Allow version 3 read only open
v2 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.
v2: [01] Parentheses around "flags & BDRV_O_RDWR". (Paolo)
Add comments. (Stefan)
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 | 9 ++++++++- 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, 18 insertions(+), 1 deletion(-) create mode 100644 tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2
Signature · 1 line
1.8.4.2
PATCH v2 1/2 vmdk: Allow read only open of VMDK version 3
--- block/vmdk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
block/vmdk.c +8 -1
@@ -605,13 +605,20 @@ 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 )) { +/* VMware KB 2064959 explains that version 3 added support for +* persistent changed block tracking (CBT), and backup software can +* read it as version=1 if it doesn't care about the changed area +* information. So we are safe to enable read only. */ +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
PATCH v2 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
Kevin Wolf
AppliedAm 28.11.2013 um 02:48 hat Fam Zheng geschrieben:
Quoted 12 lines
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.
v2: [01] Parentheses around "flags &
BDRV_O_RDWR". (Paolo)
Add comments. (Stefan)Fam Zheng (2):
vmdk: Allow read only open of VMDK version 3
qemu-iotests: Add sample image and test for VMDK version 3
Quoted 6 lines
block/vmdk.c | 9 ++++++++- 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, 18 insertions(+), 1 deletion(-) create mode 100644 tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2
Thanks, applied to the block branch.
Kevin