[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v2 21/36] rbd: Pass BlockdevOptionsRbd to qemu_r
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH v2 21/36] rbd: Pass BlockdevOptionsRbd to qemu_rbd_connect() |
Date: |
Fri, 23 Feb 2018 17:43:13 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 2018-02-23 17:19, Kevin Wolf wrote:
> Am 23.02.2018 um 00:25 hat Max Reitz geschrieben:
>> On 2018-02-21 14:53, Kevin Wolf wrote:
>>> With the conversion to a QAPI options object, the function is now
>>> prepared to be used in a .bdrv_co_create implementation.
>>>
>>> Signed-off-by: Kevin Wolf <address@hidden>
>
>>> - *s_snap = g_strdup(snap);
>>> - *s_image_name = g_strdup(image_name);
>>> + *s_snap = g_strdup(opts->snapshot);
>>> + *s_image_name = g_strdup(opts->image);
>>>
>>> /* try default location when conf=NULL, but ignore failure */
>>> - r = rados_conf_read_file(*cluster, conf);
>>> - if (conf && r < 0) {
>>> - error_setg_errno(errp, -r, "error reading conf file %s", conf);
>>> + r = rados_conf_read_file(*cluster, opts->conf);
>>> + if (opts->has_conf && r < 0) {
>>
>> Reading opts->conf without knowing whether opts->has_conf is true is a
>> bit weird. Would you mind "s->has_conf ? opts->conf : NULL" for the
>> rados_conf_read() call?
>>
>> On that thought, opts->snapshot and opts->user are optional, too. Are
>> they guaranteed to be NULL if they haven't been specified? Should we
>> guard those accesses with opts->has_* queries, too?
>
> These days, both the QMP marshalling code (for the outermost struct when
> called from x-blockdev-create) and the input visitor (for nested structs
> and non-QMP callers) initialise the objects with {0} and g_malloc0().
>
> I think Markus once told me that I shouldn't do pointless has_* checks
> any more in QMP commands, so I intentionally did the same here.
I'm a bit cautious because of non-zero defaults (like sslverify in the
ssh driver), but as long as you're aware...
Max
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-block] [PATCH v2 20/36] rbd: Remove non-schema options from runtime_opts, (continued)
[Qemu-block] [PATCH v2 24/36] rbd: Use qemu_rbd_connect() in qemu_rbd_do_create(), Kevin Wolf, 2018/02/21
[Qemu-block] [PATCH v2 23/36] rbd: Assing s->snap/image_name in qemu_rbd_open(), Kevin Wolf, 2018/02/21
[Qemu-block] [PATCH v2 25/36] nfs: Use QAPI options in nfs_client_open(), Kevin Wolf, 2018/02/21
[Qemu-block] [PATCH v2 22/36] rbd: Support .bdrv_co_create, Kevin Wolf, 2018/02/21
[Qemu-block] [PATCH v2 27/36] sheepdog: QAPIfy "redundacy" create option, Kevin Wolf, 2018/02/21