@@ -420,11 +420,13 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
header.sector_size, SECTOR_SIZE);
ret = -ENOTSUP;
goto fail;
- } else if (header.block_size != 1 * MiB) {
- error_setg(errp, "unsupported VDI image (sector size %u is not %u)",
- header.block_size, 1 * MiB);
+#if !defined(CONFIG_VDI_BLOCK_SIZE)
+ } else if (header.block_size != DEFAULT_CLUSTER_SIZE) {
+ error_setg(errp, "unsupported VDI image (block size %u is not %u)",
+ header.block_size, DEFAULT_CLUSTER_SIZE);
ret = -ENOTSUP;
goto fail;
+#endif
} else if (header.disk_size >
(uint64_t)header.blocks_in_image * header.block_size) {
error_setg(errp, "unsupported VDI image (disk size %" PRIu64 ", "
* Fix wrong error message (copy+paste bug from commit 5b7aa9b56d1bfc79916262f380c3fc7961becb50). * Replace the default cluster size of 1 * MiB by DEFAULT_CLUSTER_SIZE. * Don't check for the default cluster size if we support other sizes, too. Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> --- block/vdi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)