[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 26/31] VMDK: bugfix, opening vSphere 4 exported imag
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 26/31] VMDK: bugfix, opening vSphere 4 exported image |
Date: |
Tue, 6 Sep 2011 17:39:41 +0200 |
From: Fam Zheng <address@hidden>
The vSphere 4 exported image is streamOptimized extent, which is not
quite correctly handled. Ignore rdgOffset when RGD flag bit not set.
Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vmdk.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 892b18e..6c8edfc 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -31,6 +31,7 @@
#define VMDK3_MAGIC (('C' << 24) | ('O' << 16) | ('W' << 8) | 'D')
#define VMDK4_MAGIC (('K' << 24) | ('D' << 16) | ('M' << 8) | 'V')
#define VMDK4_COMPRESSION_DEFLATE 1
+#define VMDK4_FLAG_RGD (1 << 1)
#define VMDK4_FLAG_COMPRESS (1 << 16)
#define VMDK4_FLAG_MARKER (1 << 17)
@@ -55,8 +56,8 @@ typedef struct {
int64_t desc_offset;
int64_t desc_size;
int32_t num_gtes_per_gte;
- int64_t rgd_offset;
int64_t gd_offset;
+ int64_t rgd_offset;
int64_t grain_offset;
char filler[1];
char check_bytes[4];
@@ -420,6 +421,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
uint32_t l1_size, l1_entry_sectors;
VMDK4Header header;
VmdkExtent *extent;
+ int64_t l1_backup_offset = 0;
ret = bdrv_pread(file, sizeof(magic), &header, sizeof(header));
if (ret < 0) {
@@ -435,10 +437,13 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
}
l1_size = (le64_to_cpu(header.capacity) + l1_entry_sectors - 1)
/ l1_entry_sectors;
+ if (le32_to_cpu(header.flags) & VMDK4_FLAG_RGD) {
+ l1_backup_offset = le64_to_cpu(header.rgd_offset) << 9;
+ }
extent = vmdk_add_extent(bs, file, false,
le64_to_cpu(header.capacity),
le64_to_cpu(header.gd_offset) << 9,
- le64_to_cpu(header.rgd_offset) << 9,
+ l1_backup_offset,
l1_size,
le32_to_cpu(header.num_gtes_per_gte),
le64_to_cpu(header.granularity));
--
1.7.6
- [Qemu-devel] [PATCH 20/31] VMDK: add twoGbMaxExtentSparse support, (continued)
- [Qemu-devel] [PATCH 20/31] VMDK: add twoGbMaxExtentSparse support, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 16/31] xen: Clean up pci_piix3_xen_ide_unplug()'s test for "not a CD", Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 22/31] VMDK: Opening compressed extent., Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 23/31] VMDK: read/write compressed extent, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 21/31] VMDK: separate vmdk_read_extent/vmdk_write_extent, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 19/31] VMDK: enable twoGbMaxExtentFlat, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 25/31] VMDK: bugfix, open Haiku vmdk image, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 24/31] VMDK: creating streamOptimized subformat, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 18/31] block: Declare qemu_blockalign() in block.h, not block_int.h, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 29/31] scsi: refine constants for READ CAPACITY 16, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 26/31] VMDK: bugfix, opening vSphere 4 exported image,
Kevin Wolf <=
- [Qemu-devel] [PATCH 31/31] scsi: improve MODE SENSE emulation, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 27/31] scsi: execute SYNCHRONIZE_CACHE asynchronously, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 30/31] scsi: fill in additional sense length correctly, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 28/31] scsi: fix accounting of writes, Kevin Wolf, 2011/09/06
- Re: [Qemu-devel] [PULL 00/31] Block patches, Anthony Liguori, 2011/09/08