mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemu: domain: Rename secrets setup function
Since there's just one type left, we can change the name to a more generic one. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
db66d0247a
commit
0151c092fb
@ -1065,7 +1065,7 @@ qemuDomainVideoPrivateDispose(void *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* qemuDomainSecretAESSetup:
|
/* qemuDomainSecretInfoSetup:
|
||||||
* @priv: pointer to domain private object
|
* @priv: pointer to domain private object
|
||||||
* @alias: alias of the secret
|
* @alias: alias of the secret
|
||||||
* @username: username to use (may be NULL)
|
* @username: username to use (may be NULL)
|
||||||
@ -1077,11 +1077,11 @@ qemuDomainVideoPrivateDispose(void *obj)
|
|||||||
* Returns qemuDomainSecretInfo *filled with the necessary information.
|
* Returns qemuDomainSecretInfo *filled with the necessary information.
|
||||||
*/
|
*/
|
||||||
static qemuDomainSecretInfo *
|
static qemuDomainSecretInfo *
|
||||||
qemuDomainSecretAESSetup(qemuDomainObjPrivate *priv,
|
qemuDomainSecretInfoSetup(qemuDomainObjPrivate *priv,
|
||||||
const char *alias,
|
const char *alias,
|
||||||
const char *username,
|
const char *username,
|
||||||
uint8_t *secret,
|
uint8_t *secret,
|
||||||
size_t secretlen)
|
size_t secretlen)
|
||||||
{
|
{
|
||||||
g_autoptr(qemuDomainSecretInfo) secinfo = NULL;
|
g_autoptr(qemuDomainSecretInfo) secinfo = NULL;
|
||||||
g_autofree uint8_t *raw_iv = NULL;
|
g_autofree uint8_t *raw_iv = NULL;
|
||||||
@ -1117,7 +1117,7 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivate *priv,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemuDomainSecretAESSetupFromSecret:
|
* qemuDomainSecretInfoSetupFromSecret:
|
||||||
* @priv: pointer to domain private object
|
* @priv: pointer to domain private object
|
||||||
* @srcalias: Alias of the disk/hostdev used to generate the secret alias
|
* @srcalias: Alias of the disk/hostdev used to generate the secret alias
|
||||||
* @secretuse: specific usage for the secret (may be NULL if main object is using it)
|
* @secretuse: specific usage for the secret (may be NULL if main object is using it)
|
||||||
@ -1130,12 +1130,12 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivate *priv,
|
|||||||
* secret in case if @srcalias requires more secrets for various usage cases.
|
* secret in case if @srcalias requires more secrets for various usage cases.
|
||||||
*/
|
*/
|
||||||
static qemuDomainSecretInfo *
|
static qemuDomainSecretInfo *
|
||||||
qemuDomainSecretAESSetupFromSecret(qemuDomainObjPrivate *priv,
|
qemuDomainSecretInfoSetupFromSecret(qemuDomainObjPrivate *priv,
|
||||||
const char *srcalias,
|
const char *srcalias,
|
||||||
const char *secretuse,
|
const char *secretuse,
|
||||||
virSecretUsageType usageType,
|
virSecretUsageType usageType,
|
||||||
const char *username,
|
const char *username,
|
||||||
virSecretLookupTypeDef *seclookupdef)
|
virSecretLookupTypeDef *seclookupdef)
|
||||||
{
|
{
|
||||||
qemuDomainSecretInfo *secinfo;
|
qemuDomainSecretInfo *secinfo;
|
||||||
g_autofree char *alias = qemuAliasForSecret(srcalias, secretuse);
|
g_autofree char *alias = qemuAliasForSecret(srcalias, secretuse);
|
||||||
@ -1154,7 +1154,7 @@ qemuDomainSecretAESSetupFromSecret(qemuDomainObjPrivate *priv,
|
|||||||
&secret, &secretlen) < 0)
|
&secret, &secretlen) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
secinfo = qemuDomainSecretAESSetup(priv, alias, username, secret, secretlen);
|
secinfo = qemuDomainSecretInfoSetup(priv, alias, username, secret, secretlen);
|
||||||
|
|
||||||
virSecureErase(secret, secretlen);
|
virSecureErase(secret, secretlen);
|
||||||
|
|
||||||
@ -1188,9 +1188,9 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivate *priv,
|
|||||||
}
|
}
|
||||||
seclookupdef.type = VIR_SECRET_LOOKUP_TYPE_UUID;
|
seclookupdef.type = VIR_SECRET_LOOKUP_TYPE_UUID;
|
||||||
|
|
||||||
return qemuDomainSecretAESSetupFromSecret(priv, srcAlias, NULL,
|
return qemuDomainSecretInfoSetupFromSecret(priv, srcAlias, NULL,
|
||||||
VIR_SECRET_USAGE_TYPE_TLS,
|
VIR_SECRET_USAGE_TYPE_TLS,
|
||||||
NULL, &seclookupdef);
|
NULL, &seclookupdef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1244,8 +1244,8 @@ qemuDomainSecretStorageSourcePrepareCookies(qemuDomainObjPrivate *priv,
|
|||||||
g_autofree char *secretalias = qemuAliasForSecret(aliasprotocol, "httpcookie");
|
g_autofree char *secretalias = qemuAliasForSecret(aliasprotocol, "httpcookie");
|
||||||
g_autofree char *cookies = qemuBlockStorageSourceGetCookieString(src);
|
g_autofree char *cookies = qemuBlockStorageSourceGetCookieString(src);
|
||||||
|
|
||||||
return qemuDomainSecretAESSetup(priv, secretalias, NULL,
|
return qemuDomainSecretInfoSetup(priv, secretalias, NULL,
|
||||||
(uint8_t *) cookies, strlen(cookies));
|
(uint8_t *) cookies, strlen(cookies));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1287,20 +1287,20 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivate *priv,
|
|||||||
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD)
|
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD)
|
||||||
usageType = VIR_SECRET_USAGE_TYPE_CEPH;
|
usageType = VIR_SECRET_USAGE_TYPE_CEPH;
|
||||||
|
|
||||||
if (!(srcPriv->secinfo = qemuDomainSecretAESSetupFromSecret(priv, aliasprotocol,
|
if (!(srcPriv->secinfo = qemuDomainSecretInfoSetupFromSecret(priv, aliasprotocol,
|
||||||
"auth",
|
"auth",
|
||||||
usageType,
|
usageType,
|
||||||
src->auth->username,
|
src->auth->username,
|
||||||
&src->auth->seclookupdef)))
|
&src->auth->seclookupdef)))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasEnc) {
|
if (hasEnc) {
|
||||||
if (!(srcPriv->encinfo = qemuDomainSecretAESSetupFromSecret(priv, aliasformat,
|
if (!(srcPriv->encinfo = qemuDomainSecretInfoSetupFromSecret(priv, aliasformat,
|
||||||
"encryption",
|
"encryption",
|
||||||
VIR_SECRET_USAGE_TYPE_VOLUME,
|
VIR_SECRET_USAGE_TYPE_VOLUME,
|
||||||
NULL,
|
NULL,
|
||||||
&src->encryption->secrets[0]->seclookupdef)))
|
&src->encryption->secrets[0]->seclookupdef)))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10740,12 +10740,12 @@ qemuDomainPrepareHostdev(virDomainHostdevDef *hostdev,
|
|||||||
virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;
|
virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;
|
||||||
qemuDomainStorageSourcePrivate *srcPriv = qemuDomainStorageSourcePrivateFetch(src);
|
qemuDomainStorageSourcePrivate *srcPriv = qemuDomainStorageSourcePrivateFetch(src);
|
||||||
|
|
||||||
if (!(srcPriv->secinfo = qemuDomainSecretAESSetupFromSecret(priv,
|
if (!(srcPriv->secinfo = qemuDomainSecretInfoSetupFromSecret(priv,
|
||||||
backendalias,
|
backendalias,
|
||||||
NULL,
|
NULL,
|
||||||
usageType,
|
usageType,
|
||||||
src->auth->username,
|
src->auth->username,
|
||||||
&src->auth->seclookupdef)))
|
&src->auth->seclookupdef)))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user