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
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list