[PATCH 7/8] qemu: Simplify qemuMigrationResetTLS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's only called from qemuMigrationReset now so it doesn't need to be
exported and {tls,sec}Alias are always NULL.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 37 +++++++++++++------------------------
 src/qemu/qemu_migration.h |  7 -------
 2 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 739b595ac..cc3e58c16 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2406,45 +2406,36 @@ qemuMigrationSetParams(virQEMUDriverPtr driver,
  * @driver: pointer to qemu driver
  * @vm: domain object
  * @asyncJob: migration job to join
- * @tlsAlias: alias generated for TLS object (may be NULL)
- * @secAlias: alias generated for a secinfo object (may be NULL)
  *
  * Deconstruct all the setup possibly done for TLS - delete the TLS and
- * security objects, fre the secinfo, and reset the migration params to "".
+ * security objects, free the secinfo, and reset the migration params to "".
  *
  * Returns 0 on success, -1 on failure
  */
-int
+static int
 qemuMigrationResetTLS(virQEMUDriverPtr driver,
                       virDomainObjPtr vm,
-                      qemuDomainAsyncJob asyncJob,
-                      char *in_tlsAlias,
-                      char *in_secAlias)
+                      qemuDomainAsyncJob asyncJob)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
-    char *tlsAlias = in_tlsAlias;
-    char *secAlias = in_secAlias;
+    char *tlsAlias = NULL;
+    char *secAlias = NULL;
     qemuMonitorMigrationParams migParams = { 0 };
     int ret = -1;
 
-    /* If coming from a path that doesn't know whether it's been used or not,
-     * let's first check we need to do this. If the tls-creds doesn't exist
-     * or if they're set to "" then there's nothing to do since we never set
-     * anything up */
-    if (!in_tlsAlias && qemuMigrationCheckTLSCreds(driver, vm, asyncJob) < 0)
+    if (qemuMigrationCheckTLSCreds(driver, vm, asyncJob) < 0)
         return -1;
 
+    /* If the tls-creds doesn't exist or if they're set to "" then there's
+     * nothing to do since we never set anything up */
     if (!priv->migTLSAlias || !*priv->migTLSAlias)
         return 0;
 
     /* NB: If either or both fail to allocate memory we can still proceed
      *     since the next time we migrate another deletion attempt will be
      *     made after successfully generating the aliases. */
-    if (!tlsAlias)
-        tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE);
-    if (!secAlias)
-        secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE,
-                                               false);
+    tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE);
+    secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE, false);
 
     qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
     qemuDomainSecretInfoFree(&priv->migSecinfo);
@@ -2457,10 +2448,8 @@ qemuMigrationResetTLS(virQEMUDriverPtr driver,
     ret = 0;
 
  cleanup:
-    if (!in_tlsAlias)
-        VIR_FREE(tlsAlias);
-    if (!in_secAlias)
-        VIR_FREE(secAlias);
+    VIR_FREE(tlsAlias);
+    VIR_FREE(secAlias);
     qemuMigrationParamsClear(&migParams);
 
     return ret;
@@ -5887,6 +5876,6 @@ qemuMigrationReset(virQEMUDriverPtr driver,
     if (!virDomainObjIsActive(vm))
         return;
 
-    if (qemuMigrationResetTLS(driver, vm, job, NULL, NULL) < 0)
+    if (qemuMigrationResetTLS(driver, vm, job) < 0)
         return;
 }
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 28eb55056..b392b8fff 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -278,13 +278,6 @@ int qemuMigrationRunIncoming(virQEMUDriverPtr driver,
 void qemuMigrationPostcopyFailed(virQEMUDriverPtr driver,
                                  virDomainObjPtr vm);
 
-int
-qemuMigrationResetTLS(virQEMUDriverPtr driver,
-                      virDomainObjPtr vm,
-                      qemuDomainAsyncJob asyncJob,
-                      char *in_tlsAlias,
-                      char *in_secAlias);
-
 void
 qemuMigrationReset(virQEMUDriverPtr driver,
                    virDomainObjPtr vm,
-- 
2.12.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux