[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 21/36] rbd: Pass BlockdevOptionsRbd to qemu_r
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v2 21/36] rbd: Pass BlockdevOptionsRbd to qemu_rbd_connect() |
Date: |
Fri, 23 Feb 2018 18:09:21 +0100 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
Am 23.02.2018 um 17:43 hat Max Reitz geschrieben:
> 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...
I still hope that QAPI will allow specifying default values in the
schema sometime. But yes, for the time being, not checking has_*
obviously only works when the default is 0/false/NULL.
Kevin
signature.asc
Description: PGP signature
- [Qemu-devel] [PATCH v2 16/36] file-win32: Support .bdrv_co_create, (continued)
[Qemu-devel] [PATCH v2 25/36] nfs: Use QAPI options in nfs_client_open(), Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 22/36] rbd: Support .bdrv_co_create, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 26/36] nfs: Support .bdrv_co_create, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 27/36] sheepdog: QAPIfy "redundacy" create option, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 28/36] sheepdog: Support .bdrv_co_create, Kevin Wolf, 2018/02/21
[Qemu-devel] [PATCH v2 30/36] ssh: QAPIfy host-key-check option, Kevin Wolf, 2018/02/21