[libvirt] [PATCH 1/3] storage: Fix formatting and parsing of qemu type 'UnixSocketAddress'

Peter Krempa pkrempa at redhat.com
Mon Feb 12 15:20:58 UTC 2018


The documentation for the JSON/qapi type 'UnixSocketAddress' states that
the unix socket path field is named 'path'. We used 'socket' by
mistake. Fix both the formatter and parser and test suite.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1544325

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_block.c     | 2 +-
 src/util/virstoragefile.c | 2 +-
 tests/virstoragetest.c    | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 585f0255ee..eb63139ca0 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -509,7 +509,7 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDefPtr host,
     case VIR_STORAGE_NET_HOST_TRANS_UNIX:
         if (virJSONValueObjectCreate(&server,
                                      "s:type", "unix",
-                                     "s:socket", host->socket,
+                                     "s:path", host->socket,
                                      NULL) < 0)
             goto cleanup;
         break;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 7f878039ba..5705bb055b 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2893,7 +2893,7 @@ virStorageSourceParseBackingJSONSocketAddress(virStorageNetHostDefPtr host,
     } else if (STREQ(type, "unix")) {
         host->transport = VIR_STORAGE_NET_HOST_TRANS_UNIX;

-        if (!(socket = virJSONValueObjectGetString(json, "socket"))) {
+        if (!(socket = virJSONValueObjectGetString(json, "path"))) {
             virReportError(VIR_ERR_INVALID_ARG, "%s",
                            _("missing socket path for udp backing server in "
                              "JSON backing volume definition"));
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 6eed7134ed..ea3d2833dd 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -1420,7 +1420,7 @@ mymain(void)
                                                       "\"port\":\"1234\""
                                                     "},"
                                                     "{ \"type\":\"unix\","
-                                                      "\"socket\":\"/path/socket\""
+                                                      "\"path\":\"/path/socket\""
                                                     "},"
                                                     "{ \"type\":\"tcp\","
                                                       "\"host\":\"example.com\""
@@ -1441,7 +1441,7 @@ mymain(void)
                                                  "\"port\":\"1234\""
                                                "},"
                                                "{ \"type\":\"unix\","
-                                                 "\"socket\":\"/path/socket\""
+                                                 "\"path\":\"/path/socket\""
                                                "},"
                                                "{ \"type\":\"inet\","
                                                  "\"host\":\"example.com\""
-- 
2.15.0




More information about the libvir-list mailing list