]> git.pld-linux.org Git - packages/qemu.git/blob - vmdk3ro.patch
more bconds
[packages/qemu.git] / vmdk3ro.patch
1 From: Fam Zheng
2 Subject: [Qemu-devel] [PATCH v2 1/2] vmdk: Allow read only open of VMDK version 3
3 Date: Thu, 28 Nov 2013 09:48:03 +0800
4 URL: https://lists.gnu.org/archive/html/qemu-devel/2013-11/msg03652.html
5
6 Signed-off-by: Fam Zheng <address@hidden>
7 ---
8  block/vmdk.c | 9 ++++++++-
9  1 file changed, 8 insertions(+), 1 deletion(-)
10
11 diff --git a/block/vmdk.c b/block/vmdk.c
12 index a7ebd0f..6fd20dc 100644
13 --- a/block/vmdk.c
14 +++ b/block/vmdk.c
15 @@ -605,13 +605,20 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
16          header = footer.header;
17      }
18  
19 -    if (le32_to_cpu(header.version) >= 3) {
20 +    if (le32_to_cpu(header.version) > 3) {
21          char buf[64];
22          snprintf(buf, sizeof(buf), "VMDK version %d",
23                   le32_to_cpu(header.version));
24          qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
25                  bs->device_name, "vmdk", buf);
26          return -ENOTSUP;
27 +    } else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) {
28 +        /* VMware KB 2064959 explains that version 3 added support for
29 +         * persistent changed block tracking (CBT), and backup software can
30 +         * read it as version=1 if it doesn't care about the changed area
31 +         * information. So we are safe to enable read only. */
32 +        error_setg(errp, "VMDK version 3 must be read only");
33 +        return -EINVAL;
34      }
35  
36      if (le32_to_cpu(header.num_gtes_per_gt) > 512) { -- 
37 1.8.4.2
This page took 0.021679 seconds and 3 git commands to generate.