qemuDomainGetSecretAESAlias: Replace outstanding uses with qemuAliasForSecret

There are two last callers of this function. Replace them by
qemuAliasForSecret and delete qemuDomainGetSecretAESAlias.

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-09 08:03:34 +01:00
parent 70d2758a9c
commit 43a3d2e02e
4 changed files with 2 additions and 34 deletions

View File

@ -764,35 +764,6 @@ qemuDomainGetMasterKeyAlias(void)
} }
/* qemuDomainGetSecretAESAlias:
* @srcalias: Source alias used to generate the secret alias
* @isLuks: True when we are generating a secret for LUKS encrypt/decrypt
*
* Generate and return an alias for the encrypted secret
*
* Returns NULL or a string containing the alias
*/
char *
qemuDomainGetSecretAESAlias(const char *srcalias,
bool isLuks)
{
char *alias;
if (!srcalias) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("encrypted secret alias requires valid source alias"));
return NULL;
}
if (isLuks)
alias = g_strdup_printf("%s-luks-secret0", srcalias);
else
alias = g_strdup_printf("%s-secret0", srcalias);
return alias;
}
/* qemuAliasForSecret: /* qemuAliasForSecret:
* @parentalias: alias of the parent object * @parentalias: alias of the parent object
* @obj: optional sub-object of the parent device the secret is for * @obj: optional sub-object of the parent device the secret is for

View File

@ -83,9 +83,6 @@ char *qemuAliasFromHostdev(const virDomainHostdevDef *hostdev);
char *qemuDomainGetMasterKeyAlias(void); char *qemuDomainGetMasterKeyAlias(void);
char *qemuDomainGetSecretAESAlias(const char *srcalias,
bool isLuks);
char *qemuAliasForSecret(const char *parentalias, char *qemuAliasForSecret(const char *parentalias,
const char *obj); const char *obj);

View File

@ -1842,7 +1842,7 @@ qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver,
* secret UUID and we have a serial TCP chardev, then formulate a * secret UUID and we have a serial TCP chardev, then formulate a
* secAlias which we'll attempt to destroy. */ * secAlias which we'll attempt to destroy. */
if (cfg->chardevTLSx509secretUUID && if (cfg->chardevTLSx509secretUUID &&
!(secAlias = qemuDomainGetSecretAESAlias(inAlias, false))) !(secAlias = qemuAliasForSecret(inAlias, NULL)))
return -1; return -1;
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);

View File

@ -1080,7 +1080,7 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
return; return;
tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE); tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE);
secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE, false); secAlias = qemuAliasForSecret(QEMU_MIGRATION_TLS_ALIAS_BASE, NULL);
qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias); qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
g_clear_pointer(&QEMU_DOMAIN_PRIVATE(vm)->migSecinfo, qemuDomainSecretInfoFree); g_clear_pointer(&QEMU_DOMAIN_PRIVATE(vm)->migSecinfo, qemuDomainSecretInfoFree);