On 07/25/2018 10:10 AM, Markus Armbruster wrote:
qemu_rbd_parse_filename() builds a keypairs QList, converts it to JSON, and
stores the resulting QString in a QDict.
qemu_rbd_co_create_opts() and qemu_rbd_open() get the QString from the
QDict, pass it to qemu_rbd_set_keypairs(), which converts it back into
a QList.
Drop both conversions, store the QList instead.
This affects output of qemu-img info. Before this patch:
$ qemu-img info
rbd:rbd/testimg.raw:mon_host=192.168.15.180:rbd_cache=true:conf=/tmp/ceph.conf
[junk printed by Ceph library code...]
image: json:{"driver": "raw", "file": {"pool": "rbd", "image": "testimg.raw", "conf": "/tmp/ceph.conf", "driver": "rbd",
"=keyvalue-pairs": "[\"mon_host\", \"192.168.15.180\", \"rbd_cache\", \"true\"]"}}
[more output, not interesting here]
After this patch, we get
image: json:{"driver": "raw", "file": {"pool": "rbd", "image": "testimg.raw", "conf": "/tmp/ceph.conf", "driver": "rbd",
"=keyvalue-pairs": ["mon_host", "192.168.15.180", "rbd_cache", "true"]}}
The value of member "=keyvalue-pairs" changes from a string containing
a JSON array to that JSON array. That's an improvement of sorts. However:
* Should "=keyvalue-pairs" even be visible here? It's supposed to be
purely internal...
I'd argue that since it is supposed to be internal (as evidenced by the
leading '=' that does not name a normal variable), changing it doesn't
hurt stability. But yes, it would be nicer if we could filter it
entirely so that it does not appear in json: output, if it doesn't truly
affect the contents that the guest would see.
* Is this a stable interface we need to preserve, warts and all?
I hope not.
Signed-off-by: Markus Armbruster <arm...@redhat.com>
---
block/rbd.c | 50 ++++++++++++++++++++++----------------------------
1 file changed, 22 insertions(+), 28 deletions(-)
I'm not yet convinced if we want this patch for 3.0 without more
comments from the RBD experts, nor do I see too much of an issue if this
doesn't go in until 3.1. But as to the code changes itself, I find them
nice.
Reviewed-by: Eric Blake <ebl...@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org