From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?B?SuFu?= Tomko Subject: Re: [libvirt] [PATCH V2 4/4] libxl: add support for rbd qdisk Date: Mon, 22 Feb 2016 15:35:23 +0100 Message-ID: <20160222143523.GF2228@dnr.brq.redhat.com> References: <1455755625-13329-1-git-send-email-jfehlig@suse.com> <1455755625-13329-5-git-send-email-jfehlig@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1455755625-13329-5-git-send-email-jfehlig@suse.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jim Fehlig Cc: libvirt-list@redhat.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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 > 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 > --- > 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