提交 15fac93b 编写于 作者: J Ján Tomko

Convert uuid to a string before printing it

Introduced by 1fa7946f.

https://bugzilla.redhat.com/show_bug.cgi?id=1019023
上级 342cd2dd
...@@ -3183,11 +3183,13 @@ qemuGetSecretString(virConnectPtr conn, ...@@ -3183,11 +3183,13 @@ qemuGetSecretString(virConnectPtr conn,
size_t secret_size; size_t secret_size;
virSecretPtr sec = NULL; virSecretPtr sec = NULL;
char *secret = NULL; char *secret = NULL;
char uuidStr[VIR_UUID_STRING_BUFLEN];
/* look up secret */ /* look up secret */
switch (diskSecretType) { switch (diskSecretType) {
case VIR_DOMAIN_DISK_SECRET_TYPE_UUID: case VIR_DOMAIN_DISK_SECRET_TYPE_UUID:
sec = virSecretLookupByUUID(conn, uuid); sec = virSecretLookupByUUID(conn, uuid);
virUUIDFormat(uuid, uuidStr);
break; break;
case VIR_DOMAIN_DISK_SECRET_TYPE_USAGE: case VIR_DOMAIN_DISK_SECRET_TYPE_USAGE:
sec = virSecretLookupByUsage(conn, secretUsageType, usage); sec = virSecretLookupByUsage(conn, secretUsageType, usage);
...@@ -3198,7 +3200,7 @@ qemuGetSecretString(virConnectPtr conn, ...@@ -3198,7 +3200,7 @@ qemuGetSecretString(virConnectPtr conn,
if (diskSecretType == VIR_DOMAIN_DISK_SECRET_TYPE_UUID) { if (diskSecretType == VIR_DOMAIN_DISK_SECRET_TYPE_UUID) {
virReportError(VIR_ERR_NO_SECRET, virReportError(VIR_ERR_NO_SECRET,
_("%s no secret matches uuid '%s'"), _("%s no secret matches uuid '%s'"),
scheme, uuid); scheme, uuidStr);
} else { } else {
virReportError(VIR_ERR_NO_SECRET, virReportError(VIR_ERR_NO_SECRET,
_("%s no secret matches usage value '%s'"), _("%s no secret matches usage value '%s'"),
...@@ -3214,7 +3216,7 @@ qemuGetSecretString(virConnectPtr conn, ...@@ -3214,7 +3216,7 @@ qemuGetSecretString(virConnectPtr conn,
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("could not get value of the secret for " _("could not get value of the secret for "
"username '%s' using uuid '%s'"), "username '%s' using uuid '%s'"),
username, uuid); username, uuidStr);
} else { } else {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("could not get value of the secret for " _("could not get value of the secret for "
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "virobject.h" #include "virobject.h"
#include "virrandom.h" #include "virrandom.h"
#include "virstring.h" #include "virstring.h"
#include "viruuid.h"
#define VIR_FROM_THIS VIR_FROM_STORAGE #define VIR_FROM_THIS VIR_FROM_STORAGE
...@@ -702,6 +703,7 @@ virStorageBackendISCSISetAuth(const char *portal, ...@@ -702,6 +703,7 @@ virStorageBackendISCSISetAuth(const char *portal,
unsigned char *secret_value = NULL; unsigned char *secret_value = NULL;
virStoragePoolAuthChap chap; virStoragePoolAuthChap chap;
int ret = -1; int ret = -1;
char uuidStr[VIR_UUID_STRING_BUFLEN];
if (def->source.authType == VIR_STORAGE_POOL_AUTH_NONE) if (def->source.authType == VIR_STORAGE_POOL_AUTH_NONE)
return 0; return 0;
...@@ -733,10 +735,11 @@ virStorageBackendISCSISetAuth(const char *portal, ...@@ -733,10 +735,11 @@ virStorageBackendISCSISetAuth(const char *portal,
VIR_SECRET_GET_VALUE_INTERNAL_CALL); VIR_SECRET_GET_VALUE_INTERNAL_CALL);
if (!secret_value) { if (!secret_value) {
if (chap.secret.uuidUsable) { if (chap.secret.uuidUsable) {
virUUIDFormat(chap.secret.uuid, uuidStr);
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("could not get the value of the secret " _("could not get the value of the secret "
"for username %s using uuid '%s'"), "for username %s using uuid '%s'"),
chap.username, chap.secret.uuid); chap.username, uuidStr);
} else { } else {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("could not get the value of the secret " _("could not get the value of the secret "
...@@ -747,9 +750,10 @@ virStorageBackendISCSISetAuth(const char *portal, ...@@ -747,9 +750,10 @@ virStorageBackendISCSISetAuth(const char *portal,
} }
} else { } else {
if (chap.secret.uuidUsable) { if (chap.secret.uuidUsable) {
virUUIDFormat(chap.secret.uuid, uuidStr);
virReportError(VIR_ERR_NO_SECRET, virReportError(VIR_ERR_NO_SECRET,
_("no secret matches uuid '%s'"), _("no secret matches uuid '%s'"),
chap.secret.uuid); uuidStr);
} else { } else {
virReportError(VIR_ERR_NO_SECRET, virReportError(VIR_ERR_NO_SECRET,
_("no secret matches usage value '%s'"), _("no secret matches usage value '%s'"),
......
...@@ -94,7 +94,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr, ...@@ -94,7 +94,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
if (pool->def->source.auth.cephx.secret.uuidUsable) { if (pool->def->source.auth.cephx.secret.uuidUsable) {
virReportError(VIR_ERR_NO_SECRET, virReportError(VIR_ERR_NO_SECRET,
_("no secret matches uuid '%s'"), _("no secret matches uuid '%s'"),
pool->def->source.auth.cephx.secret.uuid); secretUuid);
} else { } else {
virReportError(VIR_ERR_NO_SECRET, virReportError(VIR_ERR_NO_SECRET,
_("no secret matches usage value '%s'"), _("no secret matches usage value '%s'"),
...@@ -112,7 +112,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr, ...@@ -112,7 +112,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
_("could not get the value of the secret " _("could not get the value of the secret "
"for username '%s' using uuid '%s'"), "for username '%s' using uuid '%s'"),
pool->def->source.auth.cephx.username, pool->def->source.auth.cephx.username,
pool->def->source.auth.cephx.secret.uuid); secretUuid);
} else { } else {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("could not get the value of the secret " _("could not get the value of the secret "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册