[libvirt] [PATCH] utils: storage: Fix JSON field name for uri based storage

Peter Krempa pkrempa at redhat.com
Tue Aug 16 07:47:52 UTC 2016


qemu uses 'url' instead of 'uri'. They unfortunately look very similar.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1367260
---
 src/util/virstoragefile.c | 2 +-
 tests/virstoragetest.c    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 6f7d131..8d3895d 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2684,7 +2684,7 @@ virStorageSourceParseBackingJSONUri(virStorageSourcePtr src,
 {
     const char *uri;

-    if (!(uri = virJSONValueObjectGetString(json, "uri"))) {
+    if (!(uri = virJSONValueObjectGetString(json, "url"))) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("missing URI in JSON backing volume definition"));
         return -1;
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 3b19f59..b3d59ad 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -1377,19 +1377,19 @@ mymain(void)
                              "\"file.filename\":\"/path/to/cdrom\"}",
                        "<source dev='/path/to/cdrom'/>\n");
     TEST_BACKING_PARSE("json:{\"file.driver\":\"http\", "
-                             "\"file.uri\":\"http://example.com/file\"}",
+                             "\"file.url\":\"http://example.com/file\"}",
                        "<source protocol='http' name='file'>\n"
                        "  <host name='example.com'/>\n"
                        "</source>\n");
     TEST_BACKING_PARSE("json:{\"file\":{ \"driver\":\"http\","
-                                        "\"uri\":\"http://example.com/file\""
+                                        "\"url\":\"http://example.com/file\""
                                       "}"
                             "}",
                        "<source protocol='http' name='file'>\n"
                        "  <host name='example.com'/>\n"
                        "</source>\n");
     TEST_BACKING_PARSE("json:{\"file.driver\":\"ftp\", "
-                             "\"file.uri\":\"http://example.com/file\"}",
+                             "\"file.url\":\"http://example.com/file\"}",
                        NULL);
     TEST_BACKING_PARSE("json:{\"file.driver\":\"gluster\", "
                              "\"file.filename\":\"gluster://example.com/vol/file\"}",
-- 
2.9.2




More information about the libvir-list mailing list