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

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