On 2018-02-21 14:53, Kevin Wolf wrote: > The code to establish an RBD connection is duplicated between open and > create. In order to be able to share the code, factor out the code from > qemu_rbd_open() as a first step. > > Signed-off-by: Kevin Wolf > --- > block/rbd.c | 100 ++++++++++++++++++++++++++++++++++++------------------------ > 1 file changed, 60 insertions(+), 40 deletions(-) > > diff --git a/block/rbd.c b/block/rbd.c > index 27fa11b473..4bbcce4eca 100644 > --- a/block/rbd.c > +++ b/block/rbd.c > @@ -544,32 +544,17 @@ out: > return rados_str; > } > > -static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, > - Error **errp) > +static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx, > + char **s_snap, char **s_image_name, > + QDict *options, bool cache, Error **errp) Bikeshedding ahead: Maybe this should be called qemu_rados_connect()? I don't know anything about this, but there seems to be a distinction between rados_* functions and rbd_* functions -- the former work on the pool, the latter on the single block device. Since this function only connects to the pool and not to a single device within, I think it should be called qemu_rados_connect() instead of qemu_rbd_connect(). (Also because qemu_rbd_connect() seems so similar to qemu_rbd_open().) Up to you: Reviewed-by: Max Reitz