qemu: domain: Rename and fix docs for qemuDomainSecretInfoNew

Rename it to qemuDomainSecretInfoNewPlain and annotate that it also may
set up a 'plain' secret in some cases. This will eventually be
refactored further.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-05-22 13:08:19 +02:00
parent a7f49b82bf
commit 5882a6d72f

View File

@ -1354,7 +1354,7 @@ qemuDomainSecretSetup(qemuDomainObjPrivatePtr priv,
} }
/* qemuDomainSecretInfoNew: /* qemuDomainSecretInfoNewPlain:
* @priv: pointer to domain private object * @priv: pointer to domain private object
* @srcAlias: Alias base to use for TLS object * @srcAlias: Alias base to use for TLS object
* @usageType: Secret usage type * @usageType: Secret usage type
@ -1362,18 +1362,19 @@ qemuDomainSecretSetup(qemuDomainObjPrivatePtr priv,
* @looupdef: lookup def describing secret * @looupdef: lookup def describing secret
* @isLuks: boolean for luks lookup * @isLuks: boolean for luks lookup
* *
* Helper function to create a secinfo to be used for secinfo consumers * Helper function to create a secinfo to be used for secinfo consumers. This
* possibly sets up a 'plain' (unencrypted) secret for legacy consumers.
* *
* Returns @secinfo on success, NULL on failure. Caller is responsible * Returns @secinfo on success, NULL on failure. Caller is responsible
* to eventually free @secinfo. * to eventually free @secinfo.
*/ */
static qemuDomainSecretInfoPtr static qemuDomainSecretInfoPtr
qemuDomainSecretInfoNew(qemuDomainObjPrivatePtr priv, qemuDomainSecretInfoNewPlain(qemuDomainObjPrivatePtr priv,
const char *srcAlias, const char *srcAlias,
virSecretUsageType usageType, virSecretUsageType usageType,
const char *username, const char *username,
virSecretLookupTypeDefPtr lookupDef, virSecretLookupTypeDefPtr lookupDef,
bool isLuks) bool isLuks)
{ {
qemuDomainSecretInfoPtr secinfo = NULL; qemuDomainSecretInfoPtr secinfo = NULL;
@ -1424,9 +1425,9 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
} }
seclookupdef.type = VIR_SECRET_LOOKUP_TYPE_UUID; seclookupdef.type = VIR_SECRET_LOOKUP_TYPE_UUID;
return qemuDomainSecretInfoNew(priv, srcAlias, return qemuDomainSecretInfoNewPlain(priv, srcAlias,
VIR_SECRET_USAGE_TYPE_TLS, NULL, VIR_SECRET_USAGE_TYPE_TLS, NULL,
&seclookupdef, false); &seclookupdef, false);
} }
@ -1523,18 +1524,18 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv,
usageType = VIR_SECRET_USAGE_TYPE_CEPH; usageType = VIR_SECRET_USAGE_TYPE_CEPH;
if (!(srcPriv->secinfo = if (!(srcPriv->secinfo =
qemuDomainSecretInfoNew(priv, authalias, qemuDomainSecretInfoNewPlain(priv, authalias,
usageType, src->auth->username, usageType, src->auth->username,
&src->auth->seclookupdef, false))) &src->auth->seclookupdef, false)))
return -1; return -1;
} }
if (hasEnc) { if (hasEnc) {
if (!(srcPriv->encinfo = if (!(srcPriv->encinfo =
qemuDomainSecretInfoNew(priv, encalias, qemuDomainSecretInfoNewPlain(priv, encalias,
VIR_SECRET_USAGE_TYPE_VOLUME, NULL, VIR_SECRET_USAGE_TYPE_VOLUME, NULL,
&src->encryption->secrets[0]->seclookupdef, &src->encryption->secrets[0]->seclookupdef,
true))) true)))
return -1; return -1;
} }