Blame SOURCES/libvirt-qemuDomainGetSecretAESAlias-Replace-outstanding-uses-with-qemuAliasForSecret.patch

a41c76
From a3072c4077a72bf85636a7f0fe63fb40b96410f4 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <a3072c4077a72bf85636a7f0fe63fb40b96410f4@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Mon, 16 Mar 2020 22:11:55 +0100
a41c76
Subject: [PATCH] qemuDomainGetSecretAESAlias: Replace outstanding uses with
a41c76
 qemuAliasForSecret
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
There are two last callers of this function. Replace them by
a41c76
qemuAliasForSecret and delete qemuDomainGetSecretAESAlias.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 43a3d2e02ed09fafa04b61815c23651b0a94ef58)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
a41c76
Message-Id: <b70522a89f40d60b92029c6c7c5d10842c175fbb.1584391727.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_alias.c            | 29 -----------------------------
a41c76
 src/qemu/qemu_alias.h            |  3 ---
a41c76
 src/qemu/qemu_hotplug.c          |  2 +-
a41c76
 src/qemu/qemu_migration_params.c |  2 +-
a41c76
 4 files changed, 2 insertions(+), 34 deletions(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
a41c76
index 50ad054c6c..7889f16bb2 100644
a41c76
--- a/src/qemu/qemu_alias.c
a41c76
+++ b/src/qemu/qemu_alias.c
a41c76
@@ -763,35 +763,6 @@ qemuDomainGetMasterKeyAlias(void)
a41c76
 }
a41c76
 
a41c76
 
a41c76
-/* qemuDomainGetSecretAESAlias:
a41c76
- * @srcalias: Source alias used to generate the secret alias
a41c76
- * @isLuks: True when we are generating a secret for LUKS encrypt/decrypt
a41c76
- *
a41c76
- * Generate and return an alias for the encrypted secret
a41c76
- *
a41c76
- * Returns NULL or a string containing the alias
a41c76
- */
a41c76
-char *
a41c76
-qemuDomainGetSecretAESAlias(const char *srcalias,
a41c76
-                            bool isLuks)
a41c76
-{
a41c76
-    char *alias;
a41c76
-
a41c76
-    if (!srcalias) {
a41c76
-        virReportError(VIR_ERR_INVALID_ARG, "%s",
a41c76
-                       _("encrypted secret alias requires valid source alias"));
a41c76
-        return NULL;
a41c76
-    }
a41c76
-
a41c76
-    if (isLuks)
a41c76
-        alias = g_strdup_printf("%s-luks-secret0", srcalias);
a41c76
-    else
a41c76
-        alias = g_strdup_printf("%s-secret0", srcalias);
a41c76
-
a41c76
-    return alias;
a41c76
-}
a41c76
-
a41c76
-
a41c76
 /* qemuAliasForSecret:
a41c76
  * @parentalias: alias of the parent object
a41c76
  * @obj: optional sub-object of the parent device the secret is for
a41c76
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
a41c76
index 645956d024..490aa568a9 100644
a41c76
--- a/src/qemu/qemu_alias.h
a41c76
+++ b/src/qemu/qemu_alias.h
a41c76
@@ -83,9 +83,6 @@ char *qemuAliasFromHostdev(const virDomainHostdevDef *hostdev);
a41c76
 
a41c76
 char *qemuDomainGetMasterKeyAlias(void);
a41c76
 
a41c76
-char *qemuDomainGetSecretAESAlias(const char *srcalias,
a41c76
-                                  bool isLuks);
a41c76
-
a41c76
 char *qemuAliasForSecret(const char *parentalias,
a41c76
                          const char *obj);
a41c76
 
a41c76
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
a41c76
index a473bab3e1..3ccc01f0b7 100644
a41c76
--- a/src/qemu/qemu_hotplug.c
a41c76
+++ b/src/qemu/qemu_hotplug.c
a41c76
@@ -1844,7 +1844,7 @@ qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver,
a41c76
      * secret UUID and we have a serial TCP chardev, then formulate a
a41c76
      * secAlias which we'll attempt to destroy. */
a41c76
     if (cfg->chardevTLSx509secretUUID &&
a41c76
-        !(secAlias = qemuDomainGetSecretAESAlias(inAlias, false)))
a41c76
+        !(secAlias = qemuAliasForSecret(inAlias, NULL)))
a41c76
         return -1;
a41c76
 
a41c76
     qemuDomainObjEnterMonitor(driver, vm);
a41c76
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
a41c76
index 0a3b0f8741..28fb006374 100644
a41c76
--- a/src/qemu/qemu_migration_params.c
a41c76
+++ b/src/qemu/qemu_migration_params.c
a41c76
@@ -1084,7 +1084,7 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
a41c76
         return;
a41c76
 
a41c76
     tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE);
a41c76
-    secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE, false);
a41c76
+    secAlias = qemuAliasForSecret(QEMU_MIGRATION_TLS_ALIAS_BASE, NULL);
a41c76
 
a41c76
     qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
a41c76
     g_clear_pointer(&QEMU_DOMAIN_PRIVATE(vm)->migSecinfo, qemuDomainSecretInfoFree);
a41c76
-- 
a41c76
2.25.1
a41c76