6ae9ed
From 1b72e7eada1d446f6ff981a21fb822c3a60110c0 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <1b72e7eada1d446f6ff981a21fb822c3a60110c0@dist-git>
6ae9ed
From: Peter Krempa <pkrempa@redhat.com>
6ae9ed
Date: Tue, 16 Aug 2016 13:35:12 +0200
6ae9ed
Subject: [PATCH] utils: storage: Fix JSON field name for uri based storage
6ae9ed
6ae9ed
qemu uses 'url' instead of 'uri'. They unfortunately look very similar.
6ae9ed
6ae9ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1367260
6ae9ed
(cherry picked from commit c2e12b01baaf660abcf87f4a6f470862ac7aca15)
6ae9ed
---
6ae9ed
 src/util/virstoragefile.c | 4 ++--
6ae9ed
 tests/virstoragetest.c    | 6 +++---
6ae9ed
 2 files changed, 5 insertions(+), 5 deletions(-)
6ae9ed
6ae9ed
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
6ae9ed
index 6f7d131..471aa1f 100644
6ae9ed
--- a/src/util/virstoragefile.c
6ae9ed
+++ b/src/util/virstoragefile.c
6ae9ed
@@ -2684,9 +2684,9 @@ virStorageSourceParseBackingJSONUri(virStorageSourcePtr src,
6ae9ed
 {
6ae9ed
     const char *uri;
6ae9ed
 
6ae9ed
-    if (!(uri = virJSONValueObjectGetString(json, "uri"))) {
6ae9ed
+    if (!(uri = virJSONValueObjectGetString(json, "url"))) {
6ae9ed
         virReportError(VIR_ERR_INVALID_ARG, "%s",
6ae9ed
-                       _("missing URI in JSON backing volume definition"));
6ae9ed
+                       _("missing 'url' in JSON backing volume definition"));
6ae9ed
         return -1;
6ae9ed
     }
6ae9ed
 
6ae9ed
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
6ae9ed
index 3b19f59..b3d59ad 100644
6ae9ed
--- a/tests/virstoragetest.c
6ae9ed
+++ b/tests/virstoragetest.c
6ae9ed
@@ -1377,19 +1377,19 @@ mymain(void)
6ae9ed
                              "\"file.filename\":\"/path/to/cdrom\"}",
6ae9ed
                        "<source dev='/path/to/cdrom'/>\n");
6ae9ed
     TEST_BACKING_PARSE("json:{\"file.driver\":\"http\", "
6ae9ed
-                             "\"file.uri\":\"http://example.com/file\"}",
6ae9ed
+                             "\"file.url\":\"http://example.com/file\"}",
6ae9ed
                        "<source protocol='http' name='file'>\n"
6ae9ed
                        "  <host name='example.com'/>\n"
6ae9ed
                        "</source>\n");
6ae9ed
     TEST_BACKING_PARSE("json:{\"file\":{ \"driver\":\"http\","
6ae9ed
-                                        "\"uri\":\"http://example.com/file\""
6ae9ed
+                                        "\"url\":\"http://example.com/file\""
6ae9ed
                                       "}"
6ae9ed
                             "}",
6ae9ed
                        "<source protocol='http' name='file'>\n"
6ae9ed
                        "  <host name='example.com'/>\n"
6ae9ed
                        "</source>\n");
6ae9ed
     TEST_BACKING_PARSE("json:{\"file.driver\":\"ftp\", "
6ae9ed
-                             "\"file.uri\":\"http://example.com/file\"}",
6ae9ed
+                             "\"file.url\":\"http://example.com/file\"}",
6ae9ed
                        NULL);
6ae9ed
     TEST_BACKING_PARSE("json:{\"file.driver\":\"gluster\", "
6ae9ed
                              "\"file.filename\":\"gluster://example.com/vol/file\"}",
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed