|
|
ae23c9 |
From 54deefe8c7efcf53da58d1cc546ca34c27a975b8 Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
Date: Mon, 25 Jun 2018 13:04:46 +0200
|
|
|
ae23c9 |
Subject: [PATCH 046/268] qemu-io: Use purely string blockdev options
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180618163106.23010-2-mreitz@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 80775
|
|
|
ae23c9 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 1/3] qemu-io: Use purely string blockdev options
|
|
|
ae23c9 |
Bugzilla: 1576598
|
|
|
ae23c9 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Currently, qemu-io only uses string-valued blockdev options (as all are
|
|
|
ae23c9 |
converted directly from QemuOpts) -- with one exception: -U adds the
|
|
|
ae23c9 |
force-share option as a boolean. This in itself is already a bit
|
|
|
ae23c9 |
questionable, but a real issue is that it also assumes the value already
|
|
|
ae23c9 |
existing in the options QDict would be a boolean, which is wrong.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
That has the following effect:
|
|
|
ae23c9 |
|
|
|
ae23c9 |
$ ./qemu-io -r -U --image-opts \
|
|
|
ae23c9 |
driver=file,filename=/dev/null,force-share=off
|
|
|
ae23c9 |
[1] 15200 segmentation fault (core dumped) ./qemu-io -r -U
|
|
|
ae23c9 |
--image-opts driver=file,filename=/dev/null,force-share=off
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Since @opts is converted from QemuOpts, the value must be a string, and
|
|
|
ae23c9 |
we have to compare it as such. Consequently, it makes sense to also set
|
|
|
ae23c9 |
it as a string instead of a boolean.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Cc: qemu-stable@nongnu.org
|
|
|
ae23c9 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
Message-id: 20180502202051.15493-2-mreitz@redhat.com
|
|
|
ae23c9 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit 2a01c01f9ecb43af4c0a85fe6adc429ffc9c31b5)
|
|
|
ae23c9 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
qemu-io.c | 4 ++--
|
|
|
ae23c9 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/qemu-io.c b/qemu-io.c
|
|
|
ae23c9 |
index 72fee0d..73c638f 100644
|
|
|
ae23c9 |
--- a/qemu-io.c
|
|
|
ae23c9 |
+++ b/qemu-io.c
|
|
|
ae23c9 |
@@ -95,12 +95,12 @@ static int openfile(char *name, int flags, bool writethrough, bool force_share,
|
|
|
ae23c9 |
opts = qdict_new();
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
if (qdict_haskey(opts, BDRV_OPT_FORCE_SHARE)
|
|
|
ae23c9 |
- && !qdict_get_bool(opts, BDRV_OPT_FORCE_SHARE)) {
|
|
|
ae23c9 |
+ && strcmp(qdict_get_str(opts, BDRV_OPT_FORCE_SHARE), "on")) {
|
|
|
ae23c9 |
error_report("-U conflicts with image options");
|
|
|
ae23c9 |
qobject_unref(opts);
|
|
|
ae23c9 |
return 1;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
- qdict_put_bool(opts, BDRV_OPT_FORCE_SHARE, true);
|
|
|
ae23c9 |
+ qdict_put_str(opts, BDRV_OPT_FORCE_SHARE, "on");
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
qemuio_blk = blk_new_open(name, NULL, opts, flags, &local_err);
|
|
|
ae23c9 |
if (!qemuio_blk) {
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|