Remove qemuDomainSecretInfoNew

Replace it by a direct call to qemuDomainSecretAESSetupFromSecret.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-03-16 10:42:36 +01:00
parent 88663e59ef
commit f742461389

View File

@ -1661,33 +1661,6 @@ qemuDomainSecretInfoNewPlain(virSecretUsageType usageType,
} }
/* qemuDomainSecretInfoNew:
* @priv: pointer to domain private object
* @srcAlias: Alias base to use for TLS object
* @usageType: Secret usage type
* @username: username
* @looupDef: lookup def describing secret
* @isLuks: boolean for luks lookup
*
* Helper function to create a secinfo to be used for secinfo consumers. This
* sets up encrypted data to be used with qemu's 'secret' object.
*
* Returns @secinfo on success, NULL on failure. Caller is responsible
* to eventually free @secinfo.
*/
static qemuDomainSecretInfoPtr
qemuDomainSecretInfoNew(qemuDomainObjPrivatePtr priv,
const char *srcAlias,
virSecretUsageType usageType,
const char *username,
virSecretLookupTypeDefPtr lookupDef,
bool isLuks)
{
return qemuDomainSecretAESSetupFromSecret(priv, srcAlias, usageType, username,
lookupDef, isLuks);
}
/** /**
* qemuDomainSecretInfoTLSNew: * qemuDomainSecretInfoTLSNew:
* @priv: pointer to domain private object * @priv: pointer to domain private object
@ -1714,9 +1687,9 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
} }
seclookupdef.type = VIR_SECRET_LOOKUP_TYPE_UUID; seclookupdef.type = VIR_SECRET_LOOKUP_TYPE_UUID;
return qemuDomainSecretInfoNew(priv, srcAlias, return qemuDomainSecretAESSetupFromSecret(priv, srcAlias,
VIR_SECRET_USAGE_TYPE_TLS, NULL, VIR_SECRET_USAGE_TYPE_TLS,
&seclookupdef, false); NULL, &seclookupdef, false);
} }
@ -1806,11 +1779,11 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv,
src->auth->username, src->auth->username,
&src->auth->seclookupdef); &src->auth->seclookupdef);
} else { } else {
srcPriv->secinfo = qemuDomainSecretInfoNew(priv, authalias, srcPriv->secinfo = qemuDomainSecretAESSetupFromSecret(priv, authalias,
usageType, usageType,
src->auth->username, src->auth->username,
&src->auth->seclookupdef, &src->auth->seclookupdef,
false); false);
} }
if (!srcPriv->secinfo) if (!srcPriv->secinfo)
@ -1818,11 +1791,11 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv,
} }
if (hasEnc) { if (hasEnc) {
if (!(srcPriv->encinfo = if (!(srcPriv->encinfo = qemuDomainSecretAESSetupFromSecret(priv, encalias,
qemuDomainSecretInfoNew(priv, encalias, VIR_SECRET_USAGE_TYPE_VOLUME,
VIR_SECRET_USAGE_TYPE_VOLUME, NULL, NULL,
&src->encryption->secrets[0]->seclookupdef, &src->encryption->secrets[0]->seclookupdef,
true))) true)))
return -1; return -1;
} }