[libvirt] [PATCH v2 34/73] qemu: Introduce qemuMigrationParty enum

Jiri Denemark posted 73 patches 7 years, 1 month ago
[libvirt] [PATCH v2 34/73] qemu: Introduce qemuMigrationParty enum
Posted by Jiri Denemark 7 years, 1 month ago
Some migration parameters and capabilities are supposed to be set on
both sides of migration while others should only be set on one side. For
example, CPU throttling parameters make no sense on the destination and
they can be used even if the destination is too old to support them.

To make qemuMigrationParamsFromFlags more general and usable on both
sides of migration, we need to tell it what side it's been called on.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_driver.c           | 3 ++-
 src/qemu/qemu_migration_params.c | 9 ++++++---
 src/qemu/qemu_migration_params.h | 8 +++++++-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6e6fc130c5..d8a641f77d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12765,7 +12765,8 @@ qemuDomainMigratePerform3Params(virDomainPtr dom,
     if (nmigrate_disks < 0)
         goto cleanup;
 
-    if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags)))
+    if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
+                                                   QEMU_MIGRATION_SOURCE)))
         goto cleanup;
 
     if (!(compression = qemuMigrationAnyCompressionParse(params, nparams, flags)))
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index a7b5ce385e..b55abc2e36 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -80,7 +80,8 @@ qemuMigrationParamsFree(qemuMigrationParamsPtr migParams)
 qemuMigrationParamsPtr
 qemuMigrationParamsFromFlags(virTypedParameterPtr params,
                              int nparams,
-                             unsigned long flags)
+                             unsigned long flags,
+                             qemuMigrationParty party)
 {
     qemuMigrationParamsPtr migParams;
 
@@ -102,8 +103,10 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
             migParams->params.VAR ## _set = true; \
     } while (0)
 
-    GET(AUTO_CONVERGE_INITIAL, cpuThrottleInitial);
-    GET(AUTO_CONVERGE_INCREMENT, cpuThrottleIncrement);
+    if (party == QEMU_MIGRATION_SOURCE) {
+        GET(AUTO_CONVERGE_INITIAL, cpuThrottleInitial);
+        GET(AUTO_CONVERGE_INCREMENT, cpuThrottleIncrement);
+    }
 
 #undef GET
 
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 7ca667a507..d66fdb7cde 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -50,6 +50,11 @@ struct _qemuMigrationCompression {
 typedef struct _qemuMigrationParams qemuMigrationParams;
 typedef qemuMigrationParams *qemuMigrationParamsPtr;
 
+typedef enum {
+    QEMU_MIGRATION_SOURCE = (1 << 0),
+    QEMU_MIGRATION_DESTINATION = (1 << 1),
+} qemuMigrationParty;
+
 
 qemuMigrationParamsPtr
 qemuMigrationParamsNew(void);
@@ -57,7 +62,8 @@ qemuMigrationParamsNew(void);
 qemuMigrationParamsPtr
 qemuMigrationParamsFromFlags(virTypedParameterPtr params,
                              int nparams,
-                             unsigned long flags);
+                             unsigned long flags,
+                             qemuMigrationParty party);
 
 void
 qemuMigrationParamsFree(qemuMigrationParamsPtr migParams);
-- 
2.17.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 34/73] qemu: Introduce qemuMigrationParty enum
Posted by Ján Tomko 7 years, 1 month ago
On Wed, Apr 11, 2018 at 04:41:24PM +0200, Jiri Denemark wrote:
>Some migration parameters and capabilities are supposed to be set on
>both sides of migration while others should only be set on one side. For
>example, CPU throttling parameters make no sense on the destination and
>they can be used even if the destination is too old to support them.
>
>To make qemuMigrationParamsFromFlags more general and usable on both
>sides of migration, we need to tell it what side it's been called on.
>
>Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
>---
> src/qemu/qemu_driver.c           | 3 ++-
> src/qemu/qemu_migration_params.c | 9 ++++++---
> src/qemu/qemu_migration_params.h | 8 +++++++-
> 3 files changed, 15 insertions(+), 5 deletions(-)
>

That does sound like a party I could vote for.

Reviewed-by: Ján Tomko <jtomko@redhat.com>

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