On 11/25/2013 08:52 AM, Daniel P. Berrange wrote:
On Fri, Nov 22, 2013 at 08:20:25PM -0700, Eric Blake wrote:
> Actually put gfapi to use, by allowing the creation of a gluster
> pool. Right now, all volumes are treated as raw and directories
> are skipped; further patches will allow peering into files to
> allow for qcow2 files and backing chains, and reporting proper
> volume allocation. This implementation was tested against Fedora
> 19's glusterfs 3.4.1; it might be made simpler by requiring a
> higher minimum, and/or require more hacks to work with a lower
> minimum.
>
> * src/storage/storage_backend_gluster.c
> (virStorageBackendGlusterRefreshPool): Initial implementation.
> (virStorageBackendGlusterOpen, virStorageBackendGlusterClose)
> (virStorageBackendGlusterRefreshVol): New helper functions.
>
> Signed-off-by: Eric Blake <eblake(a)redhat.com>
ACK
Squashed this in and pushed (in reviewing 2/8, I noticed that I had
documented that <key> should NOT start with a slash, but just the volume
name).
diff --git i/src/storage/storage_backend_gluster.c
w/src/storage/storage_backend_gluster.c
index 120cf0f..d57427e 100644
--- i/src/storage/storage_backend_gluster.c
+++ w/src/storage/storage_backend_gluster.c
@@ -41,8 +41,8 @@ struct _virStorageBackendGlusterState {
*
gluster[+transport]://[server[:port]]/vol/[dir/]image[?socket=...] */
virURI *uri;
- char *volname; /* vol from URI */
- char *dir; /* dir from URI, or "/"; always ends in '/' */
+ char *volname; /* vol from URI, no '/' */
+ char *dir; /* dir from URI, or "/"; always starts and ends in '/'
*/
};
typedef struct _virStorageBackendGlusterState
virStorageBackendGlusterState;
@@ -86,7 +86,7 @@ virStorageBackendGlusterOpen(virStoragePoolObjPtr pool)
if (dir) {
if (*dir != '/') {
virReportError(VIR_ERR_XML_ERROR,
- _("gluster pool path '%s' must start with /"),
+ _("gluster pool path '%s' must start with
/"),
dir);
return NULL;
}
@@ -173,7 +173,7 @@
virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
goto cleanup;
if (VIR_STRDUP(vol->name, name) < 0)
goto cleanup;
- if (virAsprintf(&vol->key, "/%s%s%s", state->volname,
state->dir,
+ if (virAsprintf(&vol->key, "%s%s%s", state->volname,
state->dir,
vol->name) < 0)
goto cleanup;
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org