aboutsummaryrefslogtreecommitdiff
path: root/block/parallels.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-02-24 13:47:05 +0300
committerKevin Wolf <kwolf@redhat.com>2021-03-08 14:56:55 +0100
commitbaefd977002e72402f2cc42b11f2cb11b96aae9e (patch)
treec359e5e3915c850a4f63629ebd3c6d1491586944 /block/parallels.c
parente0b5207f54e45ccb7c733e736add47f7b06c5867 (diff)
parallels: support bitmap extension for read-only mode
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20210224104707.88430-5-vsementsov@virtuozzo.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/parallels.c')
-rw-r--r--block/parallels.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/block/parallels.c b/block/parallels.c
index 9594d84978..6ebad2a2bb 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -29,6 +29,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qapi/error.h"
#include "block/block_int.h"
#include "block/qdict.h"
@@ -843,6 +844,23 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
goto fail_options;
}
+ if (ph.ext_off) {
+ if (flags & BDRV_O_RDWR) {
+ /*
+ * It's unsafe to open image RW if there is an extension (as we
+ * don't support it). But parallels driver in QEMU historically
+ * ignores the extension, so print warning and don't care.
+ */
+ warn_report("Format Extension ignored in RW mode");
+ } else {
+ ret = parallels_read_format_extension(
+ bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp);
+ if (ret < 0) {
+ goto fail;
+ }
+ }
+ }
+
if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_INACTIVE)) {
s->header->inuse = cpu_to_le32(HEADER_INUSE_MAGIC);
ret = parallels_update_header(bs);