render / rpms / libvirt

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