[Qemu-devel] [PATCH] vmdk: Support version=3 in VMDK descriptor files

Sam Eiderman posted 1 patch 4 days ago
Test asan passed
Test docker-clang@ubuntu passed
Test docker-mingw@fedora passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190314141437.35517-1-shmuel.eiderman@oracle.com
block/vmdk.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

[Qemu-devel] [PATCH] vmdk: Support version=3 in VMDK descriptor files

Posted by Sam Eiderman 4 days ago
Commit 509d39aa22909c0ed1aabf896865f19c81fb38a1 added support for read
only VMDKs of version 3.

This commit fixes the probe function to correctly handle descriptors of
version 3.

This commit has two effects:
    1. We no longer need to supply '-f vmdk' when pointing to descriptor
       files of version 3 in qemu/qemu-img command line arguments.
    2. This fixes the scenario where a VMDK points to a parent version 3
       descriptor file which is being probed as "raw" instead of "vmdk".

Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Reviewed-by: Mark Kanda <mark.kanda@oracle.com>
Signed-off-by: Shmuel Eiderman <shmuel.eiderman@oracle.com>
---
 block/vmdk.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index d8c0c50390..8dec6ef767 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -195,13 +195,15 @@ static int vmdk_probe(const uint8_t *buf, int buf_size, const char *filename)
             }
             if (end - p >= strlen("version=X\n")) {
                 if (strncmp("version=1\n", p, strlen("version=1\n")) == 0 ||
-                    strncmp("version=2\n", p, strlen("version=2\n")) == 0) {
+                    strncmp("version=2\n", p, strlen("version=2\n")) == 0 ||
+                    strncmp("version=3\n", p, strlen("version=3\n")) == 0) {
                     return 100;
                 }
             }
             if (end - p >= strlen("version=X\r\n")) {
                 if (strncmp("version=1\r\n", p, strlen("version=1\r\n")) == 0 ||
-                    strncmp("version=2\r\n", p, strlen("version=2\r\n")) == 0) {
+                    strncmp("version=2\r\n", p, strlen("version=2\r\n")) == 0 ||
+                    strncmp("version=3\r\n", p, strlen("version=3\r\n")) == 0) {
                     return 100;
                 }
             }
-- 
2.13.3


Re: [Qemu-devel] [PATCH] vmdk: Support version=3 in VMDK descriptor files

Posted by Kevin Wolf 4 days ago
Am 14.03.2019 um 15:14 hat Sam Eiderman geschrieben:
> Commit 509d39aa22909c0ed1aabf896865f19c81fb38a1 added support for read
> only VMDKs of version 3.
> 
> This commit fixes the probe function to correctly handle descriptors of
> version 3.
> 
> This commit has two effects:
>     1. We no longer need to supply '-f vmdk' when pointing to descriptor
>        files of version 3 in qemu/qemu-img command line arguments.
>     2. This fixes the scenario where a VMDK points to a parent version 3
>        descriptor file which is being probed as "raw" instead of "vmdk".
> 
> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
> Reviewed-by: Mark Kanda <mark.kanda@oracle.com>
> Signed-off-by: Shmuel Eiderman <shmuel.eiderman@oracle.com>

Thanks, applied to the block branch.

Kevin