]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: storage: make virStorageSourceParseBackingJSONGlusterHost universal
authorPeter Krempa <pkrempa@redhat.com>
Thu, 15 Jun 2017 15:23:15 +0000 (17:23 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 19 Jun 2017 13:50:29 +0000 (15:50 +0200)
The same json strucutre is used for NBD and sheepdog volumes for
specifying of the host. Rename the function and fix up error messages to
be more universal.

src/util/virstoragefile.c

index 6b0af521f9162aecd190fbb265ca1bfebbe661c8..92bc561a27e5624042c480913da00ae84734065d 100644 (file)
@@ -2795,8 +2795,8 @@ virStorageSourceParseBackingJSONUri(virStorageSourcePtr src,
 
 
 static int
-virStorageSourceParseBackingJSONGlusterHost(virStorageNetHostDefPtr host,
-                                            virJSONValuePtr json)
+virStorageSourceParseBackingJSONSocketAddress(virStorageNetHostDefPtr host,
+                                              virJSONValuePtr json)
 {
     const char *type = virJSONValueObjectGetString(json, "type");
     const char *hostname = virJSONValueObjectGetString(json, "host");
@@ -2817,7 +2817,7 @@ virStorageSourceParseBackingJSONGlusterHost(virStorageNetHostDefPtr host,
         if (!hostname) {
             virReportError(VIR_ERR_INVALID_ARG, "%s",
                            _("missing hostname for tcp backing server in "
-                             "JSON backing definition for gluster volume"));
+                             "JSON backing volume definition"));
             return -1;
         }
 
@@ -2830,7 +2830,7 @@ virStorageSourceParseBackingJSONGlusterHost(virStorageNetHostDefPtr host,
         if (!socket) {
             virReportError(VIR_ERR_INVALID_ARG, "%s",
                            _("missing socket path for udp backing server in "
-                             "JSON backing definition for gluster volume"));
+                             "JSON backing volume definition"));
             return -1;
         }
 
@@ -2897,8 +2897,8 @@ virStorageSourceParseBackingJSONGluster(virStorageSourcePtr src,
     src->nhosts = nservers;
 
     for (i = 0; i < nservers; i++) {
-        if (virStorageSourceParseBackingJSONGlusterHost(src->hosts + i,
-                                                        virJSONValueArrayGet(server, i)) < 0)
+        if (virStorageSourceParseBackingJSONSocketAddress(src->hosts + i,
+                                                          virJSONValueArrayGet(server, i)) < 0)
             return -1;
     }