[libvirt] [PATCHv4 3/8] storage: implement rudimentary glusterfs pool refresh

Eric Blake eblake at redhat.com
Mon Nov 25 18:56:40 UTC 2013


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

-------------- 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/20131125/92a77135/attachment-0001.sig>


More information about the libvir-list mailing list