43fe83
From 8604ebe89c5267f34ee414fa62b69c5a5af3f62d Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <8604ebe89c5267f34ee414fa62b69c5a5af3f62d.1381871413.git.jdenemar@redhat.com>
43fe83
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
43fe83
Date: Tue, 15 Oct 2013 12:36:38 +0200
43fe83
Subject: [PATCH] Convert uuid to a string before printing it
43fe83
43fe83
Introduced by 1fa7946.
43fe83
43fe83
https://bugzilla.redhat.com/show_bug.cgi?id=1019023
43fe83
(cherry picked from commit 15fac93b951eb67553ca64443c740c1b975696a9)
43fe83
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 src/qemu/qemu_command.c             | 6 ++++--
43fe83
 src/storage/storage_backend_iscsi.c | 8 ++++++--
43fe83
 src/storage/storage_backend_rbd.c   | 4 ++--
43fe83
 3 files changed, 12 insertions(+), 6 deletions(-)
43fe83
43fe83
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
43fe83
index dcce432..d455847 100644
43fe83
--- a/src/qemu/qemu_command.c
43fe83
+++ b/src/qemu/qemu_command.c
43fe83
@@ -3113,11 +3113,13 @@ qemuGetSecretString(virConnectPtr conn,
43fe83
     size_t secret_size;
43fe83
     virSecretPtr sec = NULL;
43fe83
     char *secret = NULL;
43fe83
+    char uuidStr[VIR_UUID_STRING_BUFLEN];
43fe83
 
43fe83
     /* look up secret */
43fe83
     switch (diskSecretType) {
43fe83
     case VIR_DOMAIN_DISK_SECRET_TYPE_UUID:
43fe83
         sec = virSecretLookupByUUID(conn, uuid);
43fe83
+        virUUIDFormat(uuid, uuidStr);
43fe83
         break;
43fe83
     case VIR_DOMAIN_DISK_SECRET_TYPE_USAGE:
43fe83
         sec = virSecretLookupByUsage(conn, secretUsageType, usage);
43fe83
@@ -3128,7 +3130,7 @@ qemuGetSecretString(virConnectPtr conn,
43fe83
         if (diskSecretType == VIR_DOMAIN_DISK_SECRET_TYPE_UUID) {
43fe83
             virReportError(VIR_ERR_NO_SECRET,
43fe83
                            _("%s no secret matches uuid '%s'"),
43fe83
-                           scheme, uuid);
43fe83
+                           scheme, uuidStr);
43fe83
         } else {
43fe83
             virReportError(VIR_ERR_NO_SECRET,
43fe83
                            _("%s no secret matches usage value '%s'"),
43fe83
@@ -3144,7 +3146,7 @@ qemuGetSecretString(virConnectPtr conn,
43fe83
             virReportError(VIR_ERR_INTERNAL_ERROR,
43fe83
                            _("could not get value of the secret for "
43fe83
                              "username '%s' using uuid '%s'"),
43fe83
-                           username, uuid);
43fe83
+                           username, uuidStr);
43fe83
         } else {
43fe83
             virReportError(VIR_ERR_INTERNAL_ERROR,
43fe83
                            _("could not get value of the secret for "
43fe83
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
43fe83
index e71ea46..556c2cc 100644
43fe83
--- a/src/storage/storage_backend_iscsi.c
43fe83
+++ b/src/storage/storage_backend_iscsi.c
43fe83
@@ -44,6 +44,7 @@
43fe83
 #include "virobject.h"
43fe83
 #include "virrandom.h"
43fe83
 #include "virstring.h"
43fe83
+#include "viruuid.h"
43fe83
 
43fe83
 #define VIR_FROM_THIS VIR_FROM_STORAGE
43fe83
 
43fe83
@@ -702,6 +703,7 @@ virStorageBackendISCSISetAuth(const char *portal,
43fe83
     unsigned char *secret_value = NULL;
43fe83
     virStoragePoolAuthChap chap;
43fe83
     int ret = -1;
43fe83
+    char uuidStr[VIR_UUID_STRING_BUFLEN];
43fe83
 
43fe83
     if (def->source.authType == VIR_STORAGE_POOL_AUTH_NONE)
43fe83
         return 0;
43fe83
@@ -733,10 +735,11 @@ virStorageBackendISCSISetAuth(const char *portal,
43fe83
                                                VIR_SECRET_GET_VALUE_INTERNAL_CALL);
43fe83
         if (!secret_value) {
43fe83
             if (chap.secret.uuidUsable) {
43fe83
+                virUUIDFormat(chap.secret.uuid, uuidStr);
43fe83
                 virReportError(VIR_ERR_INTERNAL_ERROR,
43fe83
                                _("could not get the value of the secret "
43fe83
                                  "for username %s using uuid '%s'"),
43fe83
-                                 chap.username, chap.secret.uuid);
43fe83
+                                 chap.username, uuidStr);
43fe83
             } else {
43fe83
                 virReportError(VIR_ERR_INTERNAL_ERROR,
43fe83
                                _("could not get the value of the secret "
43fe83
@@ -747,9 +750,10 @@ virStorageBackendISCSISetAuth(const char *portal,
43fe83
         }
43fe83
     } else {
43fe83
         if (chap.secret.uuidUsable) {
43fe83
+            virUUIDFormat(chap.secret.uuid, uuidStr);
43fe83
             virReportError(VIR_ERR_NO_SECRET,
43fe83
                            _("no secret matches uuid '%s'"),
43fe83
-                           chap.secret.uuid);
43fe83
+                           uuidStr);
43fe83
         } else {
43fe83
             virReportError(VIR_ERR_NO_SECRET,
43fe83
                            _("no secret matches usage value '%s'"),
43fe83
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
43fe83
index d9e1789..60b48c2 100644
43fe83
--- a/src/storage/storage_backend_rbd.c
43fe83
+++ b/src/storage/storage_backend_rbd.c
43fe83
@@ -94,7 +94,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
43fe83
             if (pool->def->source.auth.cephx.secret.uuidUsable) {
43fe83
                 virReportError(VIR_ERR_NO_SECRET,
43fe83
                                _("no secret matches uuid '%s'"),
43fe83
-                                 pool->def->source.auth.cephx.secret.uuid);
43fe83
+                                 secretUuid);
43fe83
             } else {
43fe83
                 virReportError(VIR_ERR_NO_SECRET,
43fe83
                                _("no secret matches usage value '%s'"),
43fe83
@@ -112,7 +112,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
43fe83
                                _("could not get the value of the secret "
43fe83
                                  "for username '%s' using uuid '%s'"),
43fe83
                                pool->def->source.auth.cephx.username,
43fe83
-                               pool->def->source.auth.cephx.secret.uuid);
43fe83
+                               secretUuid);
43fe83
             } else {
43fe83
                 virReportError(VIR_ERR_INTERNAL_ERROR,
43fe83
                                _("could not get the value of the secret "
43fe83
-- 
43fe83
1.8.3.2
43fe83