218e99
From f9da89c13d9e9bde2d5da525ea6ad2ac92404ec4 Mon Sep 17 00:00:00 2001
218e99
From: Paolo Bonzini <pbonzini@redhat.com>
218e99
Date: Mon, 19 Aug 2013 18:54:28 +0800
218e99
Subject: [PATCH 13/13] vmdk: support vmfs files
218e99
218e99
Message-id: <1377573001-27070-14-git-send-email-famz@redhat.com>
218e99
Patchwork-id: 53793
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH 13/13] vmdk: support vmfs files
218e99
Bugzilla: 995866
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
218e99
VMware ESX hosts also use different create and extent types for flat
218e99
files, respectively "vmfs" and "VMFS".  This is not documented, but it
218e99
can be found at http://kb.vmware.com/kb/10002511 (Recreating a missing
218e99
virtual machine disk (VMDK) descriptor file).
218e99
218e99
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
Signed-off-by: Fam Zheng <famz@redhat.com>
218e99
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
(cherry picked from commit 04d542c8b826a1196ca4f03f5a35d83035976bd1)
218e99
Signed-off-by: Fam Zheng <famz@redhat.com>
218e99
---
218e99
 block/vmdk.c |    5 +++--
218e99
 1 files changed, 3 insertions(+), 2 deletions(-)
218e99
218e99
diff --git a/block/vmdk.c b/block/vmdk.c
218e99
index 4d0c82a..b0b419b 100644
218e99
--- a/block/vmdk.c
218e99
+++ b/block/vmdk.c
218e99
@@ -719,7 +719,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
218e99
 
218e99
         if (sectors <= 0 ||
218e99
             (strcmp(type, "FLAT") && strcmp(type, "SPARSE") &&
218e99
-             strcmp(type, "VMFSSPARSE")) ||
218e99
+             strcmp(type, "VMFS") && strcmp(type, "VMFSSPARSE")) ||
218e99
             (strcmp(access, "RW"))) {
218e99
             goto next_line;
218e99
         }
218e99
@@ -732,7 +732,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
218e99
         }
218e99
 
218e99
         /* save to extents array */
218e99
-        if (!strcmp(type, "FLAT")) {
218e99
+        if (!strcmp(type, "FLAT") || !strcmp(type, "VMFS")) {
218e99
             /* FLAT extent */
218e99
             VmdkExtent *extent;
218e99
 
218e99
@@ -790,6 +790,7 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags,
218e99
         goto exit;
218e99
     }
218e99
     if (strcmp(ct, "monolithicFlat") &&
218e99
+        strcmp(ct, "vmfs") &&
218e99
         strcmp(ct, "vmfsSparse") &&
218e99
         strcmp(ct, "twoGbMaxExtentSparse") &&
218e99
         strcmp(ct, "twoGbMaxExtentFlat")) {
218e99
-- 
218e99
1.7.1
218e99