aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2013-11-28 09:48:03 +0800
committerKevin Wolf <kwolf@redhat.com>2013-11-29 17:41:14 +0100
commit509d39aa22909c0ed1aabf896865f19c81fb38a1 (patch)
tree89ddb2fef129da3d636c8bdd1f29dcd3736bf538 /block
parentc34b8012e877f494c7be5abdfb67b51242a6935e (diff)
vmdk: Allow read only open of VMDK version 3
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/vmdk.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 5fb6c813ef..88d09e3e16 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -605,13 +605,20 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
header = footer.header;
}
- if (le32_to_cpu(header.version) >= 3) {
+ if (le32_to_cpu(header.version) > 3) {
char buf[64];
snprintf(buf, sizeof(buf), "VMDK version %d",
le32_to_cpu(header.version));
qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
bs->device_name, "vmdk", buf);
return -ENOTSUP;
+ } else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) {
+ /* VMware KB 2064959 explains that version 3 added support for
+ * persistent changed block tracking (CBT), and backup software can
+ * read it as version=1 if it doesn't care about the changed area
+ * information. So we are safe to enable read only. */
+ error_setg(errp, "VMDK version 3 must be read only");
+ return -EINVAL;
}
if (le32_to_cpu(header.num_gtes_per_gt) > 512) {