|
|
ae23c9 |
From 36c5bfa7a0dbc9812400390e446ae8198df189d1 Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
ae23c9 |
Date: Mon, 18 Jun 2018 08:43:18 +0200
|
|
|
ae23c9 |
Subject: [PATCH 020/268] block: Fix -drive for certain non-string scalars
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180618084330.30009-12-armbru@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 80737
|
|
|
ae23c9 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 11/23] block: Fix -drive for certain non-string scalars
|
|
|
ae23c9 |
Bugzilla: 1557995
|
|
|
ae23c9 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
The previous commit fixed -blockdev breakage due to misuse of the
|
|
|
ae23c9 |
qobject input visitor's keyval flavor in bdrv_file_open(). The commit
|
|
|
ae23c9 |
message explain why using the plain flavor would be just as wrong; it
|
|
|
ae23c9 |
would break -drive. Turns out we break it in three places:
|
|
|
ae23c9 |
nbd_open(), sd_open() and ssh_file_open(). They are even marked
|
|
|
ae23c9 |
FIXME. Example breakage:
|
|
|
ae23c9 |
|
|
|
ae23c9 |
$ qemu-system-x86 -drive node-name=n1,driver=nbd,server.type=inet,server.host=localhost,server.port=1234,server.numeric=off
|
|
|
ae23c9 |
qemu-system-x86: -drive node-name=n1,driver=nbd,server.type=inet,server.host=localhost,server.port=1234,server.numeric=off: Invalid parameter type for 'numeric', expected: boolean
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Fix it the same way: replace qdict_crumple() by
|
|
|
ae23c9 |
qdict_crumple_for_keyval_qiv(), and switch from plain to the keyval
|
|
|
ae23c9 |
flavor.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit 374c52467a38c2e811f6c0db4edc9ea7d5f34341)
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
block/nbd.c | 12 ++----------
|
|
|
ae23c9 |
block/sheepdog.c | 12 ++----------
|
|
|
ae23c9 |
block/ssh.c | 12 ++----------
|
|
|
ae23c9 |
3 files changed, 6 insertions(+), 30 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/block/nbd.c b/block/nbd.c
|
|
|
ae23c9 |
index f499830..b0be357 100644
|
|
|
ae23c9 |
--- a/block/nbd.c
|
|
|
ae23c9 |
+++ b/block/nbd.c
|
|
|
ae23c9 |
@@ -273,20 +273,12 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options,
|
|
|
ae23c9 |
goto done;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- crumpled_addr = qdict_crumple(addr, errp);
|
|
|
ae23c9 |
+ crumpled_addr = qdict_crumple_for_keyval_qiv(addr, errp);
|
|
|
ae23c9 |
if (!crumpled_addr) {
|
|
|
ae23c9 |
goto done;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- /*
|
|
|
ae23c9 |
- * FIXME .numeric, .to, .ipv4 or .ipv6 don't work with -drive
|
|
|
ae23c9 |
- * server.type=inet. .to doesn't matter, it's ignored anyway.
|
|
|
ae23c9 |
- * That's because when @options come from -blockdev or
|
|
|
ae23c9 |
- * blockdev_add, members are typed according to the QAPI schema,
|
|
|
ae23c9 |
- * but when they come from -drive, they're all QString. The
|
|
|
ae23c9 |
- * visitor expects the former.
|
|
|
ae23c9 |
- */
|
|
|
ae23c9 |
- iv = qobject_input_visitor_new(crumpled_addr);
|
|
|
ae23c9 |
+ iv = qobject_input_visitor_new_keyval(crumpled_addr);
|
|
|
ae23c9 |
visit_type_SocketAddress(iv, NULL, &saddr, &local_err);
|
|
|
ae23c9 |
if (local_err) {
|
|
|
ae23c9 |
error_propagate(errp, local_err);
|
|
|
ae23c9 |
diff --git a/block/sheepdog.c b/block/sheepdog.c
|
|
|
ae23c9 |
index 821a3c4..dd582d5 100644
|
|
|
ae23c9 |
--- a/block/sheepdog.c
|
|
|
ae23c9 |
+++ b/block/sheepdog.c
|
|
|
ae23c9 |
@@ -546,20 +546,12 @@ static SocketAddress *sd_server_config(QDict *options, Error **errp)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
qdict_extract_subqdict(options, &server, "server.");
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- crumpled_server = qdict_crumple(server, errp);
|
|
|
ae23c9 |
+ crumpled_server = qdict_crumple_for_keyval_qiv(server, errp);
|
|
|
ae23c9 |
if (!crumpled_server) {
|
|
|
ae23c9 |
goto done;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- /*
|
|
|
ae23c9 |
- * FIXME .numeric, .to, .ipv4 or .ipv6 don't work with -drive
|
|
|
ae23c9 |
- * server.type=inet. .to doesn't matter, it's ignored anyway.
|
|
|
ae23c9 |
- * That's because when @options come from -blockdev or
|
|
|
ae23c9 |
- * blockdev_add, members are typed according to the QAPI schema,
|
|
|
ae23c9 |
- * but when they come from -drive, they're all QString. The
|
|
|
ae23c9 |
- * visitor expects the former.
|
|
|
ae23c9 |
- */
|
|
|
ae23c9 |
- iv = qobject_input_visitor_new(crumpled_server);
|
|
|
ae23c9 |
+ iv = qobject_input_visitor_new_keyval(crumpled_server);
|
|
|
ae23c9 |
visit_type_SocketAddress(iv, NULL, &saddr, &local_err);
|
|
|
ae23c9 |
if (local_err) {
|
|
|
ae23c9 |
error_propagate(errp, local_err);
|
|
|
ae23c9 |
diff --git a/block/ssh.c b/block/ssh.c
|
|
|
ae23c9 |
index 5931064..2fc7cd9 100644
|
|
|
ae23c9 |
--- a/block/ssh.c
|
|
|
ae23c9 |
+++ b/block/ssh.c
|
|
|
ae23c9 |
@@ -623,20 +623,12 @@ static BlockdevOptionsSsh *ssh_parse_options(QDict *options, Error **errp)
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
/* Create the QAPI object */
|
|
|
ae23c9 |
- crumpled = qdict_crumple(options, errp);
|
|
|
ae23c9 |
+ crumpled = qdict_crumple_for_keyval_qiv(options, errp);
|
|
|
ae23c9 |
if (crumpled == NULL) {
|
|
|
ae23c9 |
goto fail;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- /*
|
|
|
ae23c9 |
- * FIXME .numeric, .to, .ipv4 or .ipv6 don't work with -drive.
|
|
|
ae23c9 |
- * .to doesn't matter, it's ignored anyway.
|
|
|
ae23c9 |
- * That's because when @options come from -blockdev or
|
|
|
ae23c9 |
- * blockdev_add, members are typed according to the QAPI schema,
|
|
|
ae23c9 |
- * but when they come from -drive, they're all QString. The
|
|
|
ae23c9 |
- * visitor expects the former.
|
|
|
ae23c9 |
- */
|
|
|
ae23c9 |
- v = qobject_input_visitor_new(crumpled);
|
|
|
ae23c9 |
+ v = qobject_input_visitor_new_keyval(crumpled);
|
|
|
ae23c9 |
visit_type_BlockdevOptionsSsh(v, NULL, &result, &local_err);
|
|
|
ae23c9 |
visit_free(v);
|
|
|
ae23c9 |
qobject_unref(crumpled);
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|