[libvirt] [PATCH 10/12] qemu: Rename TLS related migration parameters

Jiri Denemark jdenemar at redhat.com
Thu Oct 26 22:03:59 UTC 2017


The parameters used "migrate" prefix which is pretty redundant and
qemuMonitorMigrationParams structure is our internal representation of
QEMU migration parameters and it is supposed to use names which match
QEMU names.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_migration.c    | 23 +++++++++++------------
 src/qemu/qemu_monitor.c      |  7 +++----
 src/qemu/qemu_monitor.h      |  4 ++--
 src/qemu/qemu_monitor_json.c |  8 ++++----
 tests/qemumonitorjsontest.c  |  8 ++++----
 5 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index af744661f..e4e9e79cc 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -114,7 +114,7 @@ qemuMigrationCheckTLSCreds(virQEMUDriverPtr driver,
         goto cleanup;
 
     /* NB: Could steal NULL pointer too! Let caller decide what to do. */
-    VIR_STEAL_PTR(priv->migTLSAlias, migParams.migrateTLSAlias);
+    VIR_STEAL_PTR(priv->migTLSAlias, migParams.tlsCreds);
 
     ret = 0;
 
@@ -225,7 +225,7 @@ qemuMigrationAddTLSObjects(virQEMUDriverPtr driver,
                                 *tlsAlias, &tlsProps) < 0)
         goto error;
 
-    if (VIR_STRDUP(migParams->migrateTLSAlias, *tlsAlias) < 0)
+    if (VIR_STRDUP(migParams->tlsCreds, *tlsAlias) < 0)
         goto error;
 
     return 0;
@@ -2349,8 +2349,8 @@ qemuMigrationParamsClear(qemuMonitorMigrationParamsPtr migParams)
     if (!migParams)
         return;
 
-    VIR_FREE(migParams->migrateTLSAlias);
-    VIR_FREE(migParams->migrateTLSHostname);
+    VIR_FREE(migParams->tlsCreds);
+    VIR_FREE(migParams->tlsHostname);
 }
 
 
@@ -2391,8 +2391,8 @@ qemuMigrationSetEmptyTLSParams(virQEMUDriverPtr driver,
    if (!priv->migTLSAlias)
        return 0;
 
-   if (VIR_STRDUP(migParams->migrateTLSAlias, "") < 0 ||
-       VIR_STRDUP(migParams->migrateTLSHostname, "") < 0)
+   if (VIR_STRDUP(migParams->tlsCreds, "") < 0 ||
+       VIR_STRDUP(migParams->tlsHostname, "") < 0)
        return -1;
 
     return 0;
@@ -2508,8 +2508,8 @@ qemuMigrationResetTLS(virQEMUDriverPtr driver,
     qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
     qemuDomainSecretInfoFree(&priv->migSecinfo);
 
-    if (VIR_STRDUP(migParams.migrateTLSAlias, "") < 0 ||
-        VIR_STRDUP(migParams.migrateTLSHostname, "") < 0 ||
+    if (VIR_STRDUP(migParams.tlsCreds, "") < 0 ||
+        VIR_STRDUP(migParams.tlsHostname, "") < 0 ||
         qemuMigrationSetParams(driver, vm, asyncJob, &migParams) < 0)
         goto cleanup;
 
@@ -2774,7 +2774,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
             goto stopjob;
 
         /* Force reset of 'tls-hostname', it's a source only parameter */
-        if (VIR_STRDUP(migParams.migrateTLSHostname, "") < 0)
+        if (VIR_STRDUP(migParams.tlsHostname, "") < 0)
             goto stopjob;
 
     } else {
@@ -3737,12 +3737,11 @@ qemuMigrationRun(virQEMUDriverPtr driver,
          * connect directly to the destination. */
         if (spec->destType == MIGRATION_DEST_CONNECT_HOST ||
             spec->destType == MIGRATION_DEST_FD) {
-            if (VIR_STRDUP(migParams->migrateTLSHostname,
-                           spec->dest.host.name) < 0)
+            if (VIR_STRDUP(migParams->tlsHostname, spec->dest.host.name) < 0)
                 goto error;
         } else {
             /* Be sure there's nothing from a previous migration */
-            if (VIR_STRDUP(migParams->migrateTLSHostname, "") < 0)
+            if (VIR_STRDUP(migParams->tlsHostname, "") < 0)
                 goto error;
         }
     } else {
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index c88726735..3e2c69a9a 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2606,15 +2606,14 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
 {
     VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d "
               "decompressThreads=%d:%d cpuThrottleInitial=%d:%d "
-              "cpuThrottleIncrement=%d:%d tlsAlias=%s "
-              "tlsHostname=%s downtimeLimit=%d:%llu",
+              "cpuThrottleIncrement=%d:%d tlsCreds=%s tlsHostname=%s "
+              "downtimeLimit=%d:%llu",
               params->compressLevel_set, params->compressLevel,
               params->compressThreads_set, params->compressThreads,
               params->decompressThreads_set, params->decompressThreads,
               params->cpuThrottleInitial_set, params->cpuThrottleInitial,
               params->cpuThrottleIncrement_set, params->cpuThrottleIncrement,
-              NULLSTR(params->migrateTLSAlias),
-              NULLSTR(params->migrateTLSHostname),
+              NULLSTR(params->tlsCreds), NULLSTR(params->tlsHostname),
               params->downtimeLimit_set, params->downtimeLimit);
 
     QEMU_CHECK_MONITOR_JSON(mon);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index bc8494fae..e123baaae 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -625,8 +625,8 @@ struct _qemuMonitorMigrationParams {
 
     /* Value is either NULL, "", or some string. NULL indicates no support;
      * whereas, some string value indicates we can support setting/clearing */
-    char *migrateTLSAlias;
-    char *migrateTLSHostname;
+    char *tlsCreds;
+    char *tlsHostname;
 
     bool downtimeLimit_set;
     unsigned long long downtimeLimit;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index a2f3e3317..9f238bc30 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2704,8 +2704,8 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
     PARSE_INT(decompressThreads, "decompress-threads");
     PARSE_INT(cpuThrottleInitial, "cpu-throttle-initial");
     PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment");
-    PARSE_STR(migrateTLSAlias, "tls-creds");
-    PARSE_STR(migrateTLSHostname, "tls-hostname");
+    PARSE_STR(tlsCreds, "tls-creds");
+    PARSE_STR(tlsHostname, "tls-hostname");
     PARSE_ULONG(downtimeLimit, "downtime-limit");
 
 #undef PARSE_SET
@@ -2762,8 +2762,8 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
     APPEND_INT(decompressThreads, "decompress-threads");
     APPEND_INT(cpuThrottleInitial, "cpu-throttle-initial");
     APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment");
-    APPEND_STR(migrateTLSAlias, "tls-creds");
-    APPEND_STR(migrateTLSHostname, "tls-hostname");
+    APPEND_STR(tlsCreds, "tls-creds");
+    APPEND_STR(tlsHostname, "tls-hostname");
     APPEND_ULONG(downtimeLimit, "downtime-limit");
 
 #undef APPEND
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index cc55b0c43..aa5da8be9 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1853,8 +1853,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
     CHECK_INT(decompressThreads, "decompress-threads", 2);
     CHECK_INT(cpuThrottleInitial, "cpu-throttle-initial", 20);
     CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10);
-    CHECK_STR(migrateTLSAlias, "tls-creds", "tls0");
-    CHECK_STR(migrateTLSHostname, "tls-hostname", "");
+    CHECK_STR(tlsCreds, "tls-creds", "tls0");
+    CHECK_STR(tlsHostname, "tls-hostname", "");
     CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL);
 
 #undef CHECK_NUM
@@ -1865,8 +1865,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
     ret = 0;
 
  cleanup:
-    VIR_FREE(params.migrateTLSAlias);
-    VIR_FREE(params.migrateTLSHostname);
+    VIR_FREE(params.tlsCreds);
+    VIR_FREE(params.tlsHostname);
     qemuMonitorTestFree(test);
     return ret;
 }
-- 
2.14.3




More information about the libvir-list mailing list