[libvirt] [PATCHv5 4/7] storage: Add storage file backends for gluster

Eric Blake eblake at redhat.com
Wed Feb 12 18:48:28 UTC 2014


On 02/11/2014 09:26 AM, Peter Krempa wrote:
> Implement storage backend functions to deal with gluster volumes and
> implement the "stat" and "unlink" backend APIs.
> ---
> 

> +
> +static void
> +virStorageFileBackendGlusterDeinit(virStorageFilePtr file)
> +{
> +    VIR_DEBUG("deinitializing gluster storage file %p(%s@%s)",
> +              file, file->path, file->hosts[0].name);

A bit unusual to list file at host, instead of host/file, but not a
show-stopper.


> +static int
> +virStorageFileBackendGlusterInit(virStorageFilePtr file)
> +{
> +    virStorageFileBackendPrivPtr backPriv = file->priv;
> +    virStorageFileBackendGlusterPrivPtr priv = NULL;
> +    virDomainDiskHostDefPtr host = &(file->hosts[0]);
> +    const char *hostname = host->name;
> +    int port = 0;
> +
> +    VIR_DEBUG("initializing gluster storage file %p(%s@%s)",
> +              file, file->path, hostname);
> +
> +    if (VIR_ALLOC(priv) < 0)
> +        return -1;
> +
> +    if (VIR_STRDUP(priv->volname, file->path) < 0)
> +        goto error;
> +
> +    if (!(priv->path  = strchr(priv->volname, '/'))) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("invalid path of gluster volume: '%s'"),
> +                       file->path);
> +        goto error;
> +    }

This looks like a lot of shared code; any chance we use a common routine
as the basis of both this and virStorageBackendGlusterOpen()?

But what you have works, so ACK (a refactor can be a followup).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140212/79a039ab/attachment-0001.sig>


More information about the libvir-list mailing list