[libvirt] [PATCH] storage: implement rudimentary glusterfs pool refresh

Eric Blake eblake at redhat.com
Thu Oct 31 23:02:00 UTC 2013


On 10/30/2013 05:30 PM, Eric Blake wrote:
> Actually put gfapi to use, by allowing the creation of a gluster
> pool.  Right now, all volumes are treated as raw; further patches
> will allow peering into files to allow for qcow2 files and backing
> chains, and reporting proper volume allocation.
> 

Needs a v2 for several reasons:

> +
> +static void
> +virStorageBackendGlusterClose(virStorageBackendGlusterStatePtr state)
> +{
> +    if (!state || !state->vol)
> +        return;
> +    /* Yuck - glusterfs-api-3.4.1 appears to always return -1 for
> +     * glfs_fini, with errno containing random data, so there's no way
> +     * to tell if it succeeded. 3.4.2 is supposed to fix this.*/
> +    if (glfs_fini(state->vol) < 0)
> +        VIR_DEBUG("shutdown of gluster failed with errno %d", errno);
> +}

Leaks state.

> +
> +static virStorageBackendGlusterStatePtr
> +virStorageBackendGlusterOpen(virStoragePoolObjPtr pool)
> +{
> +    virStorageBackendGlusterStatePtr ret = NULL;
> +
> +    if (VIR_ALLOC(ret) < 0)
> +        return NULL;
> +
> +    if (!(ret->vol = glfs_new(pool->def->source.name))) {

Fails for subdirectory access (qemu allows gluster://host/vol/dir/file,
so we should allow vol/dir as a pool name in the XML, but glfs requires
us to open vol then chdir to dir, rather than opening vol/dir in one go).

> +        virReportOOMError();
> +        goto error;
> +    }
> +
> +    /* FIXME: allow alternate transport in the pool xml */
> +    if (glfs_set_volfile_server(ret->vol, "tcp",
> +                                pool->def->source.hosts[0].name,
> +                                pool->def->source.hosts[0].port) < 0 ||
> +        glfs_init(ret->vol) < 0) {
> +        virReportSystemError(errno, _("failed to connect to gluster %s/%s"),
> +                             pool->def->source.hosts[0].name,
> +                             pool->def->name);

Reports the wrong name (should be pool->def->source.name).

And I'm still working on the followup patches for qcow2 metadata parsing...

-- 
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: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131031/6206bb07/attachment-0001.sig>


More information about the libvir-list mailing list