[libvirt] [PATCH V2 4/4] libxl: add support for rbd qdisk

Jim Fehlig jfehlig at suse.com
Tue Feb 23 23:46:35 UTC 2016


Ján Tomko wrote:
> 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 at suse.com>
>> ---
>>  src/libxl/libxl_conf.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 191 insertions(+), 1 deletion(-)
>>
> 
> ACK with the whitespace fix.

I pushed a trivial fix for the whitespace.

> 
>> +
>> +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.

Agreed. Still working on this one as it's requiring a bit of code turmoil.

Regards,
Jim




More information about the libvir-list mailing list