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

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

 



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@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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]