libvirt/SOURCES/libvirt-qemuDomainGetSecretAESAlias-Replace-outstanding-uses-with-qemuAliasForSecret.patch
2021-09-10 11:58:15 +00:00

111 lines
3.9 KiB
Diff

From a3072c4077a72bf85636a7f0fe63fb40b96410f4 Mon Sep 17 00:00:00 2001
Message-Id: <a3072c4077a72bf85636a7f0fe63fb40b96410f4@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 16 Mar 2020 22:11:55 +0100
Subject: [PATCH] qemuDomainGetSecretAESAlias: Replace outstanding uses with
qemuAliasForSecret
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
(cherry picked from commit 43a3d2e02ed09fafa04b61815c23651b0a94ef58)
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
Message-Id: <b70522a89f40d60b92029c6c7c5d10842c175fbb.1584391727.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_alias.c | 29 -----------------------------
src/qemu/qemu_alias.h | 3 ---
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_migration_params.c | 2 +-
4 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index 50ad054c6c..7889f16bb2 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -763,35 +763,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:
* @parentalias: alias of the parent object
* @obj: optional sub-object of the parent device the secret is for
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index 645956d024..490aa568a9 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -83,9 +83,6 @@ char *qemuAliasFromHostdev(const virDomainHostdevDef *hostdev);
char *qemuDomainGetMasterKeyAlias(void);
-char *qemuDomainGetSecretAESAlias(const char *srcalias,
- bool isLuks);
-
char *qemuAliasForSecret(const char *parentalias,
const char *obj);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a473bab3e1..3ccc01f0b7 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1844,7 +1844,7 @@ qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver,
* secret UUID and we have a serial TCP chardev, then formulate a
* secAlias which we'll attempt to destroy. */
if (cfg->chardevTLSx509secretUUID &&
- !(secAlias = qemuDomainGetSecretAESAlias(inAlias, false)))
+ !(secAlias = qemuAliasForSecret(inAlias, NULL)))
return -1;
qemuDomainObjEnterMonitor(driver, vm);
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 0a3b0f8741..28fb006374 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -1084,7 +1084,7 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
return;
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);
g_clear_pointer(&QEMU_DOMAIN_PRIVATE(vm)->migSecinfo, qemuDomainSecretInfoFree);
--
2.25.1