a41c76
From 160863c5cac5519c287462439b9ce8abc6a8237e Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <160863c5cac5519c287462439b9ce8abc6a8237e@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Mon, 16 Mar 2020 22:11:48 +0100
a41c76
Subject: [PATCH] Remove qemuDomainSecretInfoNew
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Replace it by a direct call to qemuDomainSecretAESSetupFromSecret.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit f742461389c11a7d4cc8bda941814c4128eadf94)
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
a41c76
Message-Id: <c14d98c90ae9d0e9c5e4fef6a8e5061411c43a78.1584391726.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_domain.c | 53 +++++++++++-------------------------------
a41c76
 1 file changed, 13 insertions(+), 40 deletions(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
a41c76
index c286f50650..af23079d5d 100644
a41c76
--- a/src/qemu/qemu_domain.c
a41c76
+++ b/src/qemu/qemu_domain.c
a41c76
@@ -1669,33 +1669,6 @@ qemuDomainSecretInfoNewPlain(virSecretUsageType usageType,
a41c76
 }
a41c76
 
a41c76
 
a41c76
-/* qemuDomainSecretInfoNew:
a41c76
- * @priv: pointer to domain private object
a41c76
- * @srcAlias: Alias base to use for TLS object
a41c76
- * @usageType: Secret usage type
a41c76
- * @username: username
a41c76
- * @looupDef: lookup def describing secret
a41c76
- * @isLuks: boolean for luks lookup
a41c76
- *
a41c76
- * Helper function to create a secinfo to be used for secinfo consumers. This
a41c76
- * sets up encrypted data to be used with qemu's 'secret' object.
a41c76
- *
a41c76
- * Returns @secinfo on success, NULL on failure. Caller is responsible
a41c76
- * to eventually free @secinfo.
a41c76
- */
a41c76
-static qemuDomainSecretInfoPtr
a41c76
-qemuDomainSecretInfoNew(qemuDomainObjPrivatePtr priv,
a41c76
-                        const char *srcAlias,
a41c76
-                        virSecretUsageType usageType,
a41c76
-                        const char *username,
a41c76
-                        virSecretLookupTypeDefPtr lookupDef,
a41c76
-                        bool isLuks)
a41c76
-{
a41c76
-    return qemuDomainSecretAESSetupFromSecret(priv, srcAlias, usageType, username,
a41c76
-                                              lookupDef, isLuks);
a41c76
-}
a41c76
-
a41c76
-
a41c76
 /**
a41c76
  * qemuDomainSecretInfoTLSNew:
a41c76
  * @priv: pointer to domain private object
a41c76
@@ -1722,9 +1695,9 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
a41c76
     }
a41c76
     seclookupdef.type = VIR_SECRET_LOOKUP_TYPE_UUID;
a41c76
 
a41c76
-    return qemuDomainSecretInfoNew(priv, srcAlias,
a41c76
-                                   VIR_SECRET_USAGE_TYPE_TLS, NULL,
a41c76
-                                   &seclookupdef, false);
a41c76
+    return qemuDomainSecretAESSetupFromSecret(priv, srcAlias,
a41c76
+                                              VIR_SECRET_USAGE_TYPE_TLS,
a41c76
+                                              NULL, &seclookupdef, false);
a41c76
 }
a41c76
 
a41c76
 
a41c76
@@ -1814,11 +1787,11 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv,
a41c76
                                                             src->auth->username,
a41c76
                                                             &src->auth->seclookupdef);
a41c76
         } else {
a41c76
-            srcPriv->secinfo = qemuDomainSecretInfoNew(priv, authalias,
a41c76
-                                                       usageType,
a41c76
-                                                       src->auth->username,
a41c76
-                                                       &src->auth->seclookupdef,
a41c76
-                                                       false);
a41c76
+            srcPriv->secinfo = qemuDomainSecretAESSetupFromSecret(priv, authalias,
a41c76
+                                                                  usageType,
a41c76
+                                                                  src->auth->username,
a41c76
+                                                                  &src->auth->seclookupdef,
a41c76
+                                                                  false);
a41c76
         }
a41c76
 
a41c76
         if (!srcPriv->secinfo)
a41c76
@@ -1826,11 +1799,11 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv,
a41c76
     }
a41c76
 
a41c76
     if (hasEnc) {
a41c76
-        if (!(srcPriv->encinfo =
a41c76
-              qemuDomainSecretInfoNew(priv, encalias,
a41c76
-                                      VIR_SECRET_USAGE_TYPE_VOLUME, NULL,
a41c76
-                                      &src->encryption->secrets[0]->seclookupdef,
a41c76
-                                      true)))
a41c76
+        if (!(srcPriv->encinfo = qemuDomainSecretAESSetupFromSecret(priv, encalias,
a41c76
+                                                                    VIR_SECRET_USAGE_TYPE_VOLUME,
a41c76
+                                                                    NULL,
a41c76
+                                                                    &src->encryption->secrets[0]->seclookupdef,
a41c76
+                                                                    true)))
a41c76
               return -1;
a41c76
     }
a41c76
 
a41c76
-- 
a41c76
2.25.1
a41c76