aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/file-posix.c6
-rw-r--r--block/nbd.c8
-rw-r--r--block/nfs.c7
-rw-r--r--block/rbd.c6
-rw-r--r--block/ssh.c8
5 files changed, 35 insertions, 0 deletions
diff --git a/block/file-posix.c b/block/file-posix.c
index 0841a08785..0c4896876e 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -2193,6 +2193,12 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
int ret;
#if defined(__APPLE__) && defined(__MACH__)
+ /*
+ * Caution: while qdict_get_str() is fine, getting non-string types
+ * would require more care. When @options come from -blockdev or
+ * blockdev_add, its members are typed according to the QAPI
+ * schema, but when they come from -drive, they're all QString.
+ */
const char *filename = qdict_get_str(options, "filename");
char bsd_path[MAXPATHLEN] = "";
bool error_occurred = false;
diff --git a/block/nbd.c b/block/nbd.c
index 36ea617989..11e3ba75fa 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -278,6 +278,14 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, Error **errp)
goto done;
}
+ /*
+ * FIXME .numeric, .to, .ipv4 or .ipv6 don't work with -drive
+ * server.type=inet. .to doesn't matter, it's ignored anyway.
+ * That's because when @options come from -blockdev or
+ * blockdev_add, members are typed according to the QAPI schema,
+ * but when they come from -drive, they're all QString. The
+ * visitor expects the former.
+ */
iv = qobject_input_visitor_new(crumpled_addr);
visit_type_SocketAddress(iv, NULL, &saddr, &local_err);
if (local_err) {
diff --git a/block/nfs.c b/block/nfs.c
index 3f43f6e26a..0816678307 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -474,6 +474,13 @@ static NFSServer *nfs_config(QDict *options, Error **errp)
goto out;
}
+ /*
+ * Caution: this works only because all scalar members of
+ * NFSServer are QString in @crumpled_addr. The visitor expects
+ * @crumpled_addr to be typed according to the QAPI schema. It
+ * is when @options come from -blockdev or blockdev_add. But when
+ * they come from -drive, they're all QString.
+ */
iv = qobject_input_visitor_new(crumpled_addr);
visit_type_NFSServer(iv, NULL, &server, &local_error);
if (local_error) {
diff --git a/block/rbd.c b/block/rbd.c
index fbdb131a68..1ceeeb5a60 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -385,6 +385,12 @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp)
goto exit;
}
+ /*
+ * Caution: while qdict_get_try_str() is fine, getting non-string
+ * types would require more care. When @options come from -blockdev
+ * or blockdev_add, its members are typed according to the QAPI
+ * schema, but when they come from -drive, they're all QString.
+ */
pool = qdict_get_try_str(options, "pool");
conf = qdict_get_try_str(options, "conf");
clientname = qdict_get_try_str(options, "user");
diff --git a/block/ssh.c b/block/ssh.c
index 278e66faa6..471ba8a260 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -601,6 +601,14 @@ static InetSocketAddress *ssh_config(QDict *options, Error **errp)
goto out;
}
+ /*
+ * FIXME .numeric, .to, .ipv4 or .ipv6 don't work with -drive.
+ * .to doesn't matter, it's ignored anyway.
+ * That's because when @options come from -blockdev or
+ * blockdev_add, members are typed according to the QAPI schema,
+ * but when they come from -drive, they're all QString. The
+ * visitor expects the former.
+ */
iv = qobject_input_visitor_new(crumpled_addr);
visit_type_InetSocketAddress(iv, NULL, &inet, &local_error);
if (local_error) {