qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] vmdk: Allow version 3 read only open
@ 2013-11-27  2:06 Fam Zheng
  2013-11-27  2:06 ` [Qemu-devel] [PATCH 1/2] vmdk: Allow read only open of VMDK version 3 Fam Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Fam Zheng @ 2013-11-27  2:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, stefanha

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

-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 1/2] vmdk: Allow read only open of VMDK version 3
  2013-11-27  2:06 [Qemu-devel] [PATCH 0/2] vmdk: Allow version 3 read only open Fam Zheng
@ 2013-11-27  2:06 ` Fam Zheng
  2013-11-27 11:32   ` Paolo Bonzini
  2013-11-27  2:06 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Add sample image and test for " Fam Zheng
  2013-11-27 15:31 ` [Qemu-devel] [PATCH 0/2] vmdk: Allow version 3 read only open Stefan Hajnoczi
  2 siblings, 1 reply; 5+ messages in thread
From: Fam Zheng @ 2013-11-27  2:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, stefanha

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/vmdk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index a7ebd0f..7c64bed 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -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) {
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 2/2] qemu-iotests: Add sample image and test for VMDK version 3
  2013-11-27  2:06 [Qemu-devel] [PATCH 0/2] vmdk: Allow version 3 read only open Fam Zheng
  2013-11-27  2:06 ` [Qemu-devel] [PATCH 1/2] vmdk: Allow read only open of VMDK version 3 Fam Zheng
@ 2013-11-27  2:06 ` Fam Zheng
  2013-11-27 15:31 ` [Qemu-devel] [PATCH 0/2] vmdk: Allow version 3 read only open Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: Fam Zheng @ 2013-11-27  2:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, stefanha

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 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

diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
index 6a27ac9..4926645 100755
--- a/tests/qemu-iotests/059
+++ b/tests/qemu-iotests/059
@@ -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
diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out
index 2ded8a9..0aadd56 100644
--- a/tests/qemu-iotests/059.out
+++ b/tests/qemu-iotests/059.out
@@ -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
diff --git a/tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2 b/tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..30abf217e72d38e97b1e34a5db6add15ca3812d9
GIT binary patch
literal 414
zcmV;P0b%|^T4*^jL0KkKS-4ab^Z){!-`M?<SOa_FKX2WrKkwggU;qFBpa4(^umM=u
z+94F$O))(usK{+bfDHzK0MKX+G7S`-Q`Ge`dYS+L00uw+000t1nx~<uv^3HWP-tix
z00uw<K=hVO#1Ez%h~;8tm5}gs2_-azgp&-Agak%FkPaO6#E>Q}oWup($ZYNuP+onz
zC89&oo+5m#SRo3f$tj3j4cj-uY<9AFkA%eEJTaa)*;e;U06X$QBY(3aGcne4@Z5Q`
zOld1c2c2n5eaHx1cF@GqGfd88M9D~UB914v;WOL96@WSu-<9};viD>nCB_lZ=L5MA
zWAhh{E!lb{@J3L6J+%};gkaKNrNrxivB)qiB85a>b>(iaNAFyd9Z|7XRWs!&h*2TY
z2uM_*TOC2Lp=5yL%rudbN4;JP^)svmH_P%A-P+35?p=v$3M>tU*);6x0S=pmRj{{|
z7O<gW34|a7q?sHzkqRsX5{K7j5{vUyiDt@86*TlpddQ`yx%PYS=jA|vGbjHSaz!{$
IkhoM7^luBcZ~y=R

literal 0
HcmV?d00001

-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] vmdk: Allow read only open of VMDK version 3
  2013-11-27  2:06 ` [Qemu-devel] [PATCH 1/2] vmdk: Allow read only open of VMDK version 3 Fam Zheng
@ 2013-11-27 11:32   ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2013-11-27 11:32 UTC (permalink / raw)
  To: Fam Zheng; +Cc: kwolf, qemu-devel, stefanha

Il 27/11/2013 03:06, Fam Zheng ha scritto:
> +    } 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

> +        error_setg(errp, "VMDK version 3 must be read only");
> +        return -EINVAL;
>      }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] vmdk: Allow version 3 read only open
  2013-11-27  2:06 [Qemu-devel] [PATCH 0/2] vmdk: Allow version 3 read only open Fam Zheng
  2013-11-27  2:06 ` [Qemu-devel] [PATCH 1/2] vmdk: Allow read only open of VMDK version 3 Fam Zheng
  2013-11-27  2:06 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Add sample image and test for " Fam Zheng
@ 2013-11-27 15:31 ` Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2013-11-27 15:31 UTC (permalink / raw)
  To: Fam Zheng; +Cc: kwolf, qemu-devel

On Wed, Nov 27, 2013 at 10:06:29AM +0800, Fam Zheng wrote:
> 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.

Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-27 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-27  2:06 [Qemu-devel] [PATCH 0/2] vmdk: Allow version 3 read only open Fam Zheng
2013-11-27  2:06 ` [Qemu-devel] [PATCH 1/2] vmdk: Allow read only open of VMDK version 3 Fam Zheng
2013-11-27 11:32   ` Paolo Bonzini
2013-11-27  2:06 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Add sample image and test for " Fam Zheng
2013-11-27 15:31 ` [Qemu-devel] [PATCH 0/2] vmdk: Allow version 3 read only open Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).