d665afae2a
A couple of fixes, including one which gives confidence we can submit to Factory finally. OBS-URL: https://build.opensuse.org/request/show/612290 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=410
53 lines
2.1 KiB
Diff
53 lines
2.1 KiB
Diff
From 17f84e4f3e671f58c8c9fe909a5551ffd9dfdc87 Mon Sep 17 00:00:00 2001
|
|
From: Max Reitz <mreitz@redhat.com>
|
|
Date: Wed, 2 May 2018 22:20:49 +0200
|
|
Subject: [PATCH] qemu-io: Use purely string blockdev options
|
|
|
|
Currently, qemu-io only uses string-valued blockdev options (as all are
|
|
converted directly from QemuOpts) -- with one exception: -U adds the
|
|
force-share option as a boolean. This in itself is already a bit
|
|
questionable, but a real issue is that it also assumes the value already
|
|
existing in the options QDict would be a boolean, which is wrong.
|
|
|
|
That has the following effect:
|
|
|
|
$ ./qemu-io -r -U --image-opts \
|
|
driver=file,filename=/dev/null,force-share=off
|
|
[1] 15200 segmentation fault (core dumped) ./qemu-io -r -U
|
|
--image-opts driver=file,filename=/dev/null,force-share=off
|
|
|
|
Since @opts is converted from QemuOpts, the value must be a string, and
|
|
we have to compare it as such. Consequently, it makes sense to also set
|
|
it as a string instead of a boolean.
|
|
|
|
Cc: qemu-stable@nongnu.org
|
|
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
Message-id: 20180502202051.15493-2-mreitz@redhat.com
|
|
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
(cherry picked from commit 2a01c01f9ecb43af4c0a85fe6adc429ffc9c31b5)
|
|
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
|
---
|
|
qemu-io.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/qemu-io.c b/qemu-io.c
|
|
index e692c555e0..0755a30447 100644
|
|
--- a/qemu-io.c
|
|
+++ b/qemu-io.c
|
|
@@ -95,12 +95,12 @@ static int openfile(char *name, int flags, bool writethrough, bool force_share,
|
|
opts = qdict_new();
|
|
}
|
|
if (qdict_haskey(opts, BDRV_OPT_FORCE_SHARE)
|
|
- && !qdict_get_bool(opts, BDRV_OPT_FORCE_SHARE)) {
|
|
+ && strcmp(qdict_get_str(opts, BDRV_OPT_FORCE_SHARE), "on")) {
|
|
error_report("-U conflicts with image options");
|
|
QDECREF(opts);
|
|
return 1;
|
|
}
|
|
- qdict_put_bool(opts, BDRV_OPT_FORCE_SHARE, true);
|
|
+ qdict_put_str(opts, BDRV_OPT_FORCE_SHARE, "on");
|
|
}
|
|
qemuio_blk = blk_new_open(name, NULL, opts, flags, &local_err);
|
|
if (!qemuio_blk) {
|