render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 8604ebe89c5267f34ee414fa62b69c5a5af3f62d Mon Sep 17 00:00:00 2001
Message-Id: <8604ebe89c5267f34ee414fa62b69c5a5af3f62d.1381871413.git.jdenemar@redhat.com>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Tue, 15 Oct 2013 12:36:38 +0200
Subject: [PATCH] Convert uuid to a string before printing it

Introduced by 1fa7946.

https://bugzilla.redhat.com/show_bug.cgi?id=1019023
(cherry picked from commit 15fac93b951eb67553ca64443c740c1b975696a9)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_command.c             | 6 ++++--
 src/storage/storage_backend_iscsi.c | 8 ++++++--
 src/storage/storage_backend_rbd.c   | 4 ++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index dcce432..d455847 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3113,11 +3113,13 @@ qemuGetSecretString(virConnectPtr conn,
     size_t secret_size;
     virSecretPtr sec = NULL;
     char *secret = NULL;
+    char uuidStr[VIR_UUID_STRING_BUFLEN];
 
     /* look up secret */
     switch (diskSecretType) {
     case VIR_DOMAIN_DISK_SECRET_TYPE_UUID:
         sec = virSecretLookupByUUID(conn, uuid);
+        virUUIDFormat(uuid, uuidStr);
         break;
     case VIR_DOMAIN_DISK_SECRET_TYPE_USAGE:
         sec = virSecretLookupByUsage(conn, secretUsageType, usage);
@@ -3128,7 +3130,7 @@ qemuGetSecretString(virConnectPtr conn,
         if (diskSecretType == VIR_DOMAIN_DISK_SECRET_TYPE_UUID) {
             virReportError(VIR_ERR_NO_SECRET,
                            _("%s no secret matches uuid '%s'"),
-                           scheme, uuid);
+                           scheme, uuidStr);
         } else {
             virReportError(VIR_ERR_NO_SECRET,
                            _("%s no secret matches usage value '%s'"),
@@ -3144,7 +3146,7 @@ qemuGetSecretString(virConnectPtr conn,
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("could not get value of the secret for "
                              "username '%s' using uuid '%s'"),
-                           username, uuid);
+                           username, uuidStr);
         } else {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("could not get value of the secret for "
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index e71ea46..556c2cc 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -44,6 +44,7 @@
 #include "virobject.h"
 #include "virrandom.h"
 #include "virstring.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
@@ -702,6 +703,7 @@ virStorageBackendISCSISetAuth(const char *portal,
     unsigned char *secret_value = NULL;
     virStoragePoolAuthChap chap;
     int ret = -1;
+    char uuidStr[VIR_UUID_STRING_BUFLEN];
 
     if (def->source.authType == VIR_STORAGE_POOL_AUTH_NONE)
         return 0;
@@ -733,10 +735,11 @@ virStorageBackendISCSISetAuth(const char *portal,
                                                VIR_SECRET_GET_VALUE_INTERNAL_CALL);
         if (!secret_value) {
             if (chap.secret.uuidUsable) {
+                virUUIDFormat(chap.secret.uuid, uuidStr);
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("could not get the value of the secret "
                                  "for username %s using uuid '%s'"),
-                                 chap.username, chap.secret.uuid);
+                                 chap.username, uuidStr);
             } else {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("could not get the value of the secret "
@@ -747,9 +750,10 @@ virStorageBackendISCSISetAuth(const char *portal,
         }
     } else {
         if (chap.secret.uuidUsable) {
+            virUUIDFormat(chap.secret.uuid, uuidStr);
             virReportError(VIR_ERR_NO_SECRET,
                            _("no secret matches uuid '%s'"),
-                           chap.secret.uuid);
+                           uuidStr);
         } else {
             virReportError(VIR_ERR_NO_SECRET,
                            _("no secret matches usage value '%s'"),
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index d9e1789..60b48c2 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -94,7 +94,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
             if (pool->def->source.auth.cephx.secret.uuidUsable) {
                 virReportError(VIR_ERR_NO_SECRET,
                                _("no secret matches uuid '%s'"),
-                                 pool->def->source.auth.cephx.secret.uuid);
+                                 secretUuid);
             } else {
                 virReportError(VIR_ERR_NO_SECRET,
                                _("no secret matches usage value '%s'"),
@@ -112,7 +112,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
                                _("could not get the value of the secret "
                                  "for username '%s' using uuid '%s'"),
                                pool->def->source.auth.cephx.username,
-                               pool->def->source.auth.cephx.secret.uuid);
+                               secretUuid);
             } else {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("could not get the value of the secret "
-- 
1.8.3.2