Blob Blame History Raw
From 1e2350d96e59ae47fa03530ea7946ae229e99e02 Mon Sep 17 00:00:00 2001
Message-Id: <1e2350d96e59ae47fa03530ea7946ae229e99e02@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 6 Sep 2016 14:11:23 +0200
Subject: [PATCH] util: storage: Properly set protocol type when parsing
 gluster json string

Commit 2ed772cd forgot to set proper protocol. This was also present in
the test data.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1372251
(cherry picked from commit b7a650c97c717b1065c255a9be620fd2ba320180)
---
 src/util/virstoragefile.c | 3 +++
 tests/virstoragetest.c    | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index feeb061..02cae66 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2786,6 +2786,9 @@ virStorageSourceParseBackingJSONGluster(virStorageSourcePtr src,
         return -1;
     }
 
+    src->type = VIR_STORAGE_TYPE_NETWORK;
+    src->protocol = VIR_STORAGE_NET_PROTOCOL_GLUSTER;
+
     if (VIR_STRDUP(src->volume, volume) < 0 ||
         virAsprintf(&src->path, "/%s", path) < 0)
         return -1;
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index b3d59ad..623e911 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -1412,7 +1412,7 @@ mymain(void)
                                                   "]"
                                       "}"
                              "}",
-                        "<source protocol='none' name='testvol/img.qcow2'>\n"
+                        "<source protocol='gluster' name='testvol/img.qcow2'>\n"
                         "  <host name='example.com' port='1234'/>\n"
                         "  <host transport='unix' socket='/path/socket'/>\n"
                         "  <host name='example.com'/>\n"
@@ -1432,7 +1432,7 @@ mymain(void)
                                                "}"
                                              "]"
                             "}",
-                        "<source protocol='none' name='testvol/img.qcow2'>\n"
+                        "<source protocol='gluster' name='testvol/img.qcow2'>\n"
                         "  <host name='example.com' port='1234'/>\n"
                         "  <host transport='unix' socket='/path/socket'/>\n"
                         "  <host name='example.com'/>\n"
-- 
2.10.0