]> git.proxmox.com Git - mirror_qemu.git/commit
rbd: Fix bugs around -drive parameter "server"
authorMarkus Armbruster <armbru@redhat.com>
Tue, 28 Mar 2017 08:56:08 +0000 (10:56 +0200)
committerJeff Cody <jcody@redhat.com>
Tue, 28 Mar 2017 14:01:21 +0000 (10:01 -0400)
commit2836284db603775af557e969d5a800efb0190324
tree33c143122cb1658732c7ad2d8f57f46f3219221d
parent577d8c9a811fc697b4cc68fbbe5c509b028e0768
rbd: Fix bugs around -drive parameter "server"

qemu_rbd_open() takes option parameters as a flattened QDict, with
keys of the form server.%d.host, server.%d.port, where %d counts up
from zero.

qemu_rbd_array_opts() extracts these values as follows.  First, it
calls qdict_array_entries() to find the list's length.  For each list
element, it formats the list's key prefix (e.g. "server.0."), then
creates a new QDict holding the options with that key prefix, then
converts that to a QemuOpts, so it can finally get the member values
from there.

If there's one surefire way to make code using QDict more awkward,
it's creating more of them and mixing in QemuOpts for good measure.

The extraction of keys starting with server.%d into another QDict
makes us ignore parameters like server.0.neither-host-nor-port
silently.

The conversion to QemuOpts abuses runtime_opts, as described a few
commits ago.

Rewrite to simply get the values straight from the options QDict.

Fixes -drive not to crash when server.*.* are present, but
server.*.host is absent.

Fixes -drive to reject invalid server.*.*.

Permits cleaning up runtime_opts.  Do that, and fix -drive to reject
bogus parameters host and port instead of silently ignoring them.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 1490691368-32099-11-git-send-email-armbru@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
block/rbd.c