]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: block: Remove legacy spellings for InetSocketAddress
authorPeter Krempa <pkrempa@redhat.com>
Tue, 19 Jul 2022 13:45:22 +0000 (15:45 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 11 Aug 2022 12:38:32 +0000 (14:38 +0200)
In one of early iterations of the gluster driver 'tcp' was used instead
of 'inet' and 'socket' instead of 'path' for unix sockets. All of this
can be now removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_block.c

index 6a80f6a4d6492bc9422e6fd8eb67c5194e9cb08f..fe825f7c86d1380d0f2f400b0450c6806b186799 100644 (file)
@@ -431,36 +431,24 @@ qemuBlockStorageSourceGetURI(virStorageSource *src)
 /**
  * qemuBlockStorageSourceBuildJSONSocketAddress
  * @host: the virStorageNetHostDef * definition to build
- * @legacy: use old field names/values
  *
  * Formats @hosts into a json object conforming to the 'SocketAddress' type
  * in qemu.
  *
- * For compatibility with old approach used in the gluster driver of old qemus
- * use the old spelling for TCP transport and, the path field of the unix socket.
- *
  * Returns a virJSONValue * for a single server.
  */
 static virJSONValue *
-qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host,
-                                             bool legacy)
+qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host)
 {
     g_autoptr(virJSONValue) server = NULL;
-    const char *transport;
-    const char *field;
     g_autofree char *port = NULL;
 
     switch ((virStorageNetHostTransport) host->transport) {
     case VIR_STORAGE_NET_HOST_TRANS_TCP:
-        if (legacy)
-            transport = "tcp";
-        else
-            transport = "inet";
-
         port = g_strdup_printf("%u", host->port);
 
         if (virJSONValueObjectAdd(&server,
-                                  "s:type", transport,
+                                  "s:type", "inet",
                                   "s:host", host->name,
                                   "s:port", port,
                                   NULL) < 0)
@@ -468,14 +456,9 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host,
         break;
 
     case VIR_STORAGE_NET_HOST_TRANS_UNIX:
-        if (legacy)
-            field = "s:socket";
-        else
-            field = "s:path";
-
         if (virJSONValueObjectAdd(&server,
                                   "s:type", "unix",
-                                  field, host->socket,
+                                  "s:path", host->socket,
                                   NULL) < 0)
             return NULL;
         break;
@@ -495,14 +478,12 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host,
 /**
  * qemuBlockStorageSourceBuildHostsJSONSocketAddress:
  * @src: disk storage source
- * @legacy: use 'tcp' instead of 'inet' for compatibility reasons
  *
  * Formats src->hosts into a json object conforming to the 'SocketAddress' type
  * in qemu.
  */
 static virJSONValue *
-qemuBlockStorageSourceBuildHostsJSONSocketAddress(virStorageSource *src,
-                                                  bool legacy)
+qemuBlockStorageSourceBuildHostsJSONSocketAddress(virStorageSource *src)
 {
     g_autoptr(virJSONValue) servers = NULL;
     g_autoptr(virJSONValue) server = NULL;
@@ -514,7 +495,7 @@ qemuBlockStorageSourceBuildHostsJSONSocketAddress(virStorageSource *src,
     for (i = 0; i < src->nhosts; i++) {
         host = src->hosts + i;
 
-        if (!(server = qemuBlockStorageSourceBuildJSONSocketAddress(host, legacy)))
+        if (!(server = qemuBlockStorageSourceBuildJSONSocketAddress(host)))
               return NULL;
 
         if (virJSONValueArrayAppend(servers, &server) < 0)
@@ -613,13 +594,12 @@ qemuBlockStorageSourceBuildHostsJSONInetSocketAddress(virStorageSource *src)
 
 static virJSONValue *
 qemuBlockStorageSourceGetGlusterProps(virStorageSource *src,
-                                      bool legacy,
                                       bool onlytarget)
 {
     g_autoptr(virJSONValue) servers = NULL;
     g_autoptr(virJSONValue) props = NULL;
 
-    if (!(servers = qemuBlockStorageSourceBuildHostsJSONSocketAddress(src, legacy)))
+    if (!(servers = qemuBlockStorageSourceBuildHostsJSONSocketAddress(src)))
         return NULL;
 
      /* { driver:"gluster",
@@ -850,9 +830,7 @@ qemuBlockStorageSourceGetNBDProps(virStorageSource *src,
         return NULL;
     }
 
-    serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0],
-                                                               false);
-    if (!serverprops)
+    if (!(serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0])))
         return NULL;
 
     if (onlytarget) {
@@ -951,9 +929,7 @@ qemuBlockStorageSourceGetSheepdogProps(virStorageSource *src)
         return NULL;
     }
 
-    serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0],
-                                                               false);
-    if (!serverprops)
+    if (!(serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0])))
         return NULL;
 
     /* libvirt does not support the 'snap-id' and 'tag' properties */
@@ -1191,7 +1167,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src,
         switch ((virStorageNetProtocol) src->protocol) {
         case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
             driver = "gluster";
-            if (!(fileprops = qemuBlockStorageSourceGetGlusterProps(src, legacy, onlytarget)))
+            if (!(fileprops = qemuBlockStorageSourceGetGlusterProps(src, onlytarget)))
                 return NULL;
             break;
 
@@ -2611,7 +2587,7 @@ qemuBlockStorageSourceCreateGetStorageProps(virStorageSource *src,
         switch ((virStorageNetProtocol) src->protocol) {
         case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
             driver = "gluster";
-            if (!(location = qemuBlockStorageSourceGetGlusterProps(src, false, false)))
+            if (!(location = qemuBlockStorageSourceGetGlusterProps(src, false)))
                 return -1;
             break;