[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [libvirt] [PATCH V2 4/4] libxl: add support for rbd qdisk



On Wed, Feb 17, 2016 at 05:33:45PM -0700, Jim Fehlig wrote:
> xl/libxl already supports qemu's network-based block backends
> such as nbd and rbd. libvirt has supported configuring such
> <disk>s for long time too. This patch adds support for rbd
> disks in the libxl driver by generating a rbd device URL from
> the virDomainDiskDef object. The URL is passed to libxl via the
> pdev_path field of libxl_device_disk struct. libxl then passes
> the URL to qemu for cosumption by the rbd backend.
> 
> Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
> ---
>  src/libxl/libxl_conf.c | 192 
> ++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 191 insertions(+), 1 deletion(-)
> 

ACK with the whitespace fix.

> +
> +static int
> +libxlMakeNetworkDiskSrc(virStorageSourcePtr src, char **srcstr)
> +{
> +    virConnectPtr conn = NULL;
> +    char *secret = NULL;
> +    char *username = NULL;
> +    int ret = -1;
> +
> +    *srcstr = NULL;
> +    if (src->auth && src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD) {
> +        const char *protocol = 
> virStorageNetProtocolTypeToString(src->protocol);
> +
> +        username = src->auth->username;
> +        if (!(conn = virConnectOpen("xen:///system")))
> +            goto cleanup;
> +

Opening a connection feels out of place in this function, but I see it's
already done for NICs.

It would be nice to reuse it as is done in the qemu driver.

> +        if (!(secret = libxlGetSecretString(conn,
> +                                            protocol,
> +                                            true,
> +                                            src->auth,
> +                                            VIR_SECRET_USAGE_TYPE_CEPH)))
> +            goto cleanup;
> +    }
> +
> +    if (!(*srcstr = libxlMakeNetworkDiskSrcStr(src, username, secret)))
> +            goto cleanup;

The indentation looks off here.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.