34b321
From 7777177c3c7291ff5c4b24040b075a1bd1c1db77 Mon Sep 17 00:00:00 2001
34b321
From: Fam Zheng <famz@redhat.com>
34b321
Date: Mon, 15 Feb 2016 09:28:29 +0100
34b321
Subject: [PATCH 16/18] vmdk: Create streamOptimized as version 3
34b321
34b321
RH-Author: Fam Zheng <famz@redhat.com>
34b321
Message-id: <1455528511-9357-17-git-send-email-famz@redhat.com>
34b321
Patchwork-id: 69182
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH 16/18] vmdk: Create streamOptimized as version 3
34b321
Bugzilla: 1299116
34b321
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
34b321
RH-Acked-by: Max Reitz <mreitz@redhat.com>
34b321
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
34b321
34b321
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1299116
34b321
34b321
VMware products accept only version 3 for streamOptimized, let's bump
34b321
the version.
34b321
34b321
Reported-by: Radoslav Gerganov <rgerganov@vmware.com>
34b321
Signed-off-by: Fam Zheng <famz@redhat.com>
34b321
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
34b321
(cherry picked from commit d62d9dc4b814950dcc8bd261a3e2e9300d9065e6)
34b321
Signed-off-by: Fam Zheng <famz@redhat.com>
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
---
34b321
 block/vmdk.c | 8 +++++++-
34b321
 1 file changed, 7 insertions(+), 1 deletion(-)
34b321
34b321
diff --git a/block/vmdk.c b/block/vmdk.c
34b321
index 7009660..7b3e397 100644
34b321
--- a/block/vmdk.c
34b321
+++ b/block/vmdk.c
34b321
@@ -1658,7 +1658,13 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
34b321
     }
34b321
     magic = cpu_to_be32(VMDK4_MAGIC);
34b321
     memset(&header, 0, sizeof(header));
34b321
-    header.version = zeroed_grain ? 2 : 1;
34b321
+    if (compress) {
34b321
+        header.version = 3;
34b321
+    } else if (zeroed_grain) {
34b321
+        header.version = 2;
34b321
+    } else {
34b321
+        header.version = 1;
34b321
+    }
34b321
     header.flags = VMDK4_FLAG_RGD | VMDK4_FLAG_NL_DETECT
34b321
                    | (compress ? VMDK4_FLAG_COMPRESS | VMDK4_FLAG_MARKER : 0)
34b321
                    | (zeroed_grain ? VMDK4_FLAG_ZERO_GRAIN : 0);
34b321
-- 
34b321
1.8.3.1
34b321