]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: storage: Remove detected authentication data for backing chains
authorPeter Krempa <pkrempa@redhat.com>
Wed, 14 Feb 2018 13:12:23 +0000 (14:12 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 14 Feb 2018 15:04:46 +0000 (16:04 +0100)
We can't really detect all the authentication data in a sane manner for
disk backing chains. Since the old RBD parser parses it in some cases as
the argv->XML convertor requires it, we can't just drop it.

Instead clear any detected authentication data in the code paths related
to disk backing chain lookup and fix the tests to cope with the change.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/util/virstoragefile.c
tests/virstoragetest.c

index ebfb0a860ae8589224791af97e9417f19933b16b..f0b1d329c3074554ecb23251fbe826b27f10f19e 100644 (file)
@@ -3405,6 +3405,14 @@ virStorageSourceNewFromBackingAbsolute(const char *path)
             goto error;
 
         virStorageSourceNetworkAssignDefaultPorts(ret);
+
+        /* Some of the legacy parsers parse authentication data since they are
+         * also used in other places. For backing store detection the
+         * authentication data would be invalid anyways, so we clear it */
+        if (ret->auth) {
+            virStorageAuthDefFree(ret->auth);
+            ret->auth = NULL;
+        }
     }
 
     return ret;
index 16c271c7810281881af876f2923eca6e111be0d4..b032d8b93fd95e258db68fcd918852cf9b734198 100644 (file)
@@ -308,8 +308,7 @@ static const char testStorageChainFormat[] =
     "type:%d\n"
     "format:%d\n"
     "protocol:%s\n"
-    "hostname:%s\n"
-    "secret:%s\n";
+    "hostname:%s\n";
 
 static int
 testStorageChain(const void *args)
@@ -374,8 +373,7 @@ testStorageChain(const void *args)
                         data->files[i]->type,
                         data->files[i]->format,
                         virStorageNetProtocolTypeToString(data->files[i]->protocol),
-                        NULLSTR(data->files[i]->hostname),
-                        NULLSTR(data->files[i]->secret)) < 0 ||
+                        NULLSTR(data->files[i]->hostname)) < 0 ||
             virAsprintf(&actual,
                         testStorageChainFormat, i,
                         NULLSTR(elt->path),
@@ -386,8 +384,7 @@ testStorageChain(const void *args)
                         elt->type,
                         elt->format,
                         virStorageNetProtocolTypeToString(elt->protocol),
-                        NULLSTR(elt->nhosts ? elt->hosts[0].name : NULL),
-                        NULLSTR(elt->auth ? elt->auth->username : NULL)) < 0) {
+                        NULLSTR(elt->nhosts ? elt->hosts[0].name : NULL)) < 0) {
             VIR_FREE(expect);
             VIR_FREE(actual);
             goto cleanup;
@@ -1361,9 +1358,6 @@ mymain(void)
     TEST_BACKING_PARSE("rbd:testshare:id=asdf:mon_host=example.com",
                        "<source protocol='rbd' name='testshare'>\n"
                        "  <host name='example.com'/>\n"
-                       "  <auth username='asdf'>\n"
-                       "    <secret type='ceph'/>\n"
-                       "  </auth>\n"
                        "</source>\n");
     TEST_BACKING_PARSE("nbd:example.org:6000:exportname=blah",
                        "<source protocol='nbd' name='blah'>\n"
@@ -1538,9 +1532,6 @@ mymain(void)
                             "}",
                        "<source protocol='rbd' name='testshare'>\n"
                        "  <host name='example.com'/>\n"
-                       "  <auth username='asdf'>\n"
-                       "    <secret type='ceph'/>\n"
-                       "  </auth>\n"
                        "</source>\n");
     TEST_BACKING_PARSE("json:{\"file\":{\"driver\":\"rbd\","
                                        "\"image\":\"test\","