[PATCH 17/68] qemu: Drop qemuMigrationParamsCheckTLSCreds

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

 



The function checks whether QEMU supports TLS migration and stores the
original value of tls-creds parameter to priv->migTLSAlias. This is no
longer needed because we already have the original value stored in
priv->migParams.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c           |  2 --
 src/qemu/qemu_domain.h           |  4 ---
 src/qemu/qemu_migration.c        |  8 ++---
 src/qemu/qemu_migration_params.c | 62 ++------------------------------
 src/qemu/qemu_migration_params.h |  4 +--
 5 files changed, 6 insertions(+), 74 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7528ec9dc8..55b88e35e0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1905,8 +1905,6 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv)
     virDomainUSBAddressSetFree(priv->usbaddrs);
     priv->usbaddrs = NULL;
 
-    /* clean up migration data */
-    VIR_FREE(priv->migTLSAlias);
     virCPUDefFree(priv->origCPU);
     priv->origCPU = NULL;
 
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 2c474ae4a4..2bb3e0a788 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -330,10 +330,6 @@ struct _qemuDomainObjPrivate {
     /* private XML). */
     qemuDomainSecretInfoPtr migSecinfo;
 
-    /* Used when fetching/storing the current 'tls-creds' migration setting */
-    /* (not to be saved in our private XML). */
-    char *migTLSAlias;
-
     /* CPU def used to start the domain when it differs from the one actually
      * provided by QEMU. */
     virCPUDefPtr origCPU;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 072a5c95ae..8cd5426ed9 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2465,9 +2465,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
             goto stopjob;
 
     } else {
-        if (qemuMigrationParamsSetEmptyTLS(driver, vm,
-                                           QEMU_ASYNC_JOB_MIGRATION_IN,
-                                           migParams) < 0)
+        if (qemuMigrationParamsSetEmptyTLS(vm, migParams) < 0)
             goto stopjob;
     }
 
@@ -3429,9 +3427,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
                 goto error;
         }
     } else {
-        if (qemuMigrationParamsSetEmptyTLS(driver, vm,
-                                           QEMU_ASYNC_JOB_MIGRATION_OUT,
-                                           migParams) < 0)
+        if (qemuMigrationParamsSetEmptyTLS(vm, migParams) < 0)
             goto error;
     }
 
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index bee7d9796f..fd4fc6c6a8 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -133,52 +133,6 @@ qemuMigrationParamsSet(virQEMUDriverPtr driver,
 }
 
 
-/* qemuMigrationParamsCheckTLSCreds
- * @driver: pointer to qemu driver
- * @vm: domain object
- * @asyncJob: migration job to join
- *
- * Query the migration parameters looking for the 'tls-creds' parameter.
- * If found, then we can support setting or clearing the parameters and thus
- * can support TLS for migration.
- *
- * Returns 0 if we were able to successfully fetch the params and
- * additionally if the tls-creds parameter exists, saves it in the
- * private domain structure. Returns -1 on failure.
- */
-static int
-qemuMigrationParamsCheckTLSCreds(virQEMUDriverPtr driver,
-                                 virDomainObjPtr vm,
-                                 int asyncJob)
-{
-    int ret = -1;
-    qemuDomainObjPrivatePtr priv = vm->privateData;
-    qemuMigrationParamsPtr migParams = NULL;
-
-    if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
-        return -1;
-
-    if (!(migParams = qemuMigrationParamsNew()))
-        goto cleanup;
-
-    if (qemuMonitorGetMigrationParams(priv->mon, &migParams->params) < 0)
-        goto cleanup;
-
-    /* NB: Could steal NULL pointer too! Let caller decide what to do. */
-    VIR_STEAL_PTR(priv->migTLSAlias, migParams->params.tlsCreds);
-
-    ret = 0;
-
- cleanup:
-    if (qemuDomainObjExitMonitor(driver, vm) < 0)
-        ret = -1;
-
-    qemuMigrationParamsFree(migParams);
-
-    return ret;
-}
-
-
 /* qemuMigrationParamsAddTLSObjects
  * @driver: pointer to qemu driver
  * @vm: domain object
@@ -213,10 +167,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
         goto error;
     }
 
-    if (qemuMigrationParamsCheckTLSCreds(driver, vm, asyncJob) < 0)
-        goto error;
-
-    if (!priv->migTLSAlias) {
+    if ((!priv->job.migParams->params.tlsCreds)) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("TLS migration is not supported with this "
                          "QEMU binary"));
@@ -260,9 +211,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
 
 
 /* qemuMigrationParamsSetEmptyTLS
- * @driver: pointer to qemu driver
  * @vm: domain object
- * @asyncJob: migration job to join
  * @migParams: Pointer to a migration parameters block
  *
  * If we support setting the tls-creds, then set both tls-creds and
@@ -272,17 +221,12 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
  * Returns 0 on success, -1 on failure
  */
 int
-qemuMigrationParamsSetEmptyTLS(virQEMUDriverPtr driver,
-                               virDomainObjPtr vm,
-                               int asyncJob,
+qemuMigrationParamsSetEmptyTLS(virDomainObjPtr vm,
                                qemuMigrationParamsPtr migParams)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    if (qemuMigrationParamsCheckTLSCreds(driver, vm, asyncJob) < 0)
-        return -1;
-
-    if (!priv->migTLSAlias)
+    if (!priv->job.migParams->params.tlsCreds)
         return 0;
 
     if (VIR_STRDUP(migParams->params.tlsCreds, "") < 0 ||
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 1c41a5620f..b8c29cddd8 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -82,9 +82,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
                                  qemuMigrationParamsPtr migParams);
 
 int
-qemuMigrationParamsSetEmptyTLS(virQEMUDriverPtr driver,
-                               virDomainObjPtr vm,
-                               int asyncJob,
+qemuMigrationParamsSetEmptyTLS(virDomainObjPtr vm,
                                qemuMigrationParamsPtr migParams);
 
 int
-- 
2.17.0

--
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