[libvirt PATCH 1/4] qemu: Pass migration flags to qemuMigrationParamsApply

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

 



The flags will later be used to determine which parameters should
actually be applied.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c           |  6 +++---
 src/qemu/qemu_migration.c        |  8 ++++----
 src/qemu/qemu_migration_params.c | 11 ++++++++---
 src/qemu/qemu_migration_params.h |  3 ++-
 4 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3b5c3db67c..97c6ed95af 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13078,7 +13078,7 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
             goto endjob;
 
         if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE,
-                                     migParams) < 0)
+                                     migParams, 0) < 0)
             goto endjob;
     } else {
         qemuDomainObjEnterMonitor(driver, vm);
@@ -13260,7 +13260,7 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom,
             goto endjob;
 
         if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE,
-                                     migParams) < 0)
+                                     migParams, 0) < 0)
             goto endjob;
     } else {
         qemuDomainObjEnterMonitor(driver, vm);
@@ -13347,7 +13347,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom,
             goto endjob;
 
         if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE,
-                                     migParams) < 0)
+                                     migParams, 0) < 0)
             goto endjob;
     } else {
         int rc;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 9a10ce4abe..4ca2f8b600 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3213,7 +3213,7 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver,
     }
 
     if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN,
-                                 migParams) < 0)
+                                 migParams, flags) < 0)
         goto error;
 
     if (mig->nbd &&
@@ -4801,7 +4801,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
         goto error;
 
     if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT,
-                                 migParams) < 0)
+                                 migParams, flags) < 0)
         goto error;
 
     if (flags & VIR_MIGRATE_ZEROCOPY) {
@@ -6895,7 +6895,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
                                       QEMU_DOMAIN_MIG_BANDWIDTH_MAX * 1024 * 1024) < 0)
             return -1;
 
-        if (qemuMigrationParamsApply(driver, vm, asyncJob, migParams) < 0)
+        if (qemuMigrationParamsApply(driver, vm, asyncJob, migParams, 0) < 0)
             return -1;
 
         priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX;
@@ -6991,7 +6991,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
                                           QEMU_MIGRATION_PARAM_MAX_BANDWIDTH,
                                           saveMigBandwidth * 1024 * 1024) == 0)
                 ignore_value(qemuMigrationParamsApply(driver, vm, asyncJob,
-                                                      migParams));
+                                                      migParams, 0));
         } else {
             if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
                 qemuMonitorSetMigrationSpeed(priv->mon, saveMigBandwidth);
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index cc66ed8229..398c07efd0 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -833,8 +833,10 @@ qemuMigrationCapsToJSON(virBitmap *caps,
  * @vm: domain object
  * @asyncJob: migration job
  * @migParams: migration parameters to send to QEMU
+ * @apiFlags: migration flags, some of them may affect which parameters are applied
  *
- * Send all parameters stored in @migParams to QEMU.
+ * Send parameters stored in @migParams to QEMU. If @apiFlags is non-zero, some
+ * parameters that do not make sense for the enabled flags will be ignored.
  *
  * Returns 0 on success, -1 on failure.
  */
@@ -842,7 +844,8 @@ int
 qemuMigrationParamsApply(virQEMUDriver *driver,
                          virDomainObj *vm,
                          int asyncJob,
-                         qemuMigrationParams *migParams)
+                         qemuMigrationParams *migParams,
+                         unsigned long apiFlags G_GNUC_UNUSED)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
     bool xbzrleCacheSize_old = false;
@@ -1245,7 +1248,9 @@ qemuMigrationParamsReset(virQEMUDriver *driver,
     if (!virDomainObjIsActive(vm) || !origParams)
         goto cleanup;
 
-    if (qemuMigrationParamsApply(driver, vm, asyncJob, origParams) < 0)
+    /* Do not pass apiFlags to qemuMigrationParamsApply here to make sure all
+     * parameters and capabilities are reset. */
+    if (qemuMigrationParamsApply(driver, vm, asyncJob, origParams, 0) < 0)
         goto cleanup;
 
     qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags);
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index d1184acded..9e990e09bd 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -98,7 +98,8 @@ int
 qemuMigrationParamsApply(virQEMUDriver *driver,
                          virDomainObj *vm,
                          int asyncJob,
-                         qemuMigrationParams *migParams);
+                         qemuMigrationParams *migParams,
+                         unsigned long apiFlags);
 
 int
 qemuMigrationParamsEnableTLS(virQEMUDriver *driver,
-- 
2.35.1




[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