[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 05/50] vmdk: Fix converting to streamOptimized
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL v2 05/50] vmdk: Fix converting to streamOptimized |
Date: |
Tue, 2 Feb 2016 18:34:58 +0100 |
From: Fam Zheng <address@hidden>
Commit d62d9dc4b8 lifted streamOptimized images's version to 3, but we
now refuse to open version 3 images read-write. We need to make
streamOptimized an exception to allow converting to it. This fixes the
accidentally broken iotests case 059 for the same reason.
Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/vmdk.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 698679d..4a5850b 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -571,6 +571,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
VmdkExtent *extent;
BDRVVmdkState *s = bs->opaque;
int64_t l1_backup_offset = 0;
+ bool compressed;
ret = bdrv_pread(file->bs, sizeof(magic), &header, sizeof(header));
if (ret < 0) {
@@ -645,6 +646,8 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
header = footer.header;
}
+ compressed =
+ le16_to_cpu(header.compressAlgorithm) == VMDK4_COMPRESSION_DEFLATE;
if (le32_to_cpu(header.version) > 3) {
char buf[64];
snprintf(buf, sizeof(buf), "VMDK version %" PRId32,
@@ -652,7 +655,8 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
bdrv_get_device_or_node_name(bs), "vmdk", buf);
return -ENOTSUP;
- } else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) {
+ } else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR) &&
+ !compressed) {
/* 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
--
2.7.0
- [Qemu-devel] [PULL v2 00/50] Block patches, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 02/50] blockdev: Fix 'change' for slot devices, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 01/50] block: Add blk_dev_has_tray(), Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 04/50] block/qapi: Emit tray_open only if there is a tray, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 07/50] nbd: client_close on error in nbd_co_client_start, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 06/50] iotests: Limit supported formats for 118, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 03/50] Revert "hw/block/fdc: Implement tray status", Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 05/50] vmdk: Fix converting to streamOptimized,
Max Reitz <=
- [Qemu-devel] [PULL v2 09/50] iotests: Change coding style of _filter_nbd in 083, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 08/50] iotests: Rename filter_nbd to _filter_nbd in 083, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 10/50] iotests: Move _filter_nbd into common.filter, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 11/50] iotests: Make _filter_nbd drop log lines, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 12/50] iotests: Make _filter_nbd support more URL types, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 13/50] iotests: Make redirecting qemu's stderr optional, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 14/50] iotests: Add test for a nonexistent NBD export, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 16/50] block: Release named dirty bitmaps in bdrv_close(), Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 15/50] block: Remove unused struct definition BlockFinishData, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 18/50] block: Add BB-BDS remove/insert notifiers, Max Reitz, 2016/02/02