[PATCH] storage: Fix incorrect format for <disk> <auth> XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

When creating a copy of the 'authdef', need to take into account the
slight variation between <disk> and <pool> before blindly copying
the 'authType' field. This ensures virStorageAuthDefFormat will
properly format the <auth> XML for a <disk>.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/util/virstoragefile.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 2aa1d90..0b72cb3 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1522,7 +1522,12 @@ virStorageAuthDefCopy(const virStorageAuthDef *src)
     /* Not present for storage pool, but used for disk source */
     if (VIR_STRDUP(ret->secrettype, src->secrettype) < 0)
         goto error;
-    ret->authType = src->authType;
+    /* A <disk> uses secrettype, while a <pool> uses authType, so
+     * if we have a secrettype, then don't copy authType; otherwise,
+     * we will format the authType in <disk>
+     */
+    if (!ret->secrettype)
+        ret->authType = src->authType;
     ret->secretType = src->secretType;
     if (ret->secretType == VIR_STORAGE_SECRET_TYPE_UUID) {
         memcpy(ret->secret.uuid, src->secret.uuid, sizeof(ret->secret.uuid));
-- 
2.1.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]