]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Introduce qemuMigrationParty enum
authorJiri Denemark <jdenemar@redhat.com>
Fri, 9 Mar 2018 10:23:49 +0000 (11:23 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 17 Apr 2018 08:46:23 +0000 (10:46 +0200)
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>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c
src/qemu/qemu_migration_params.c
src/qemu/qemu_migration_params.h

index 6e852e888730961a38ecd5a6c68b8e37b0f54e91..227a66cce436ee6d7890ea9cd62c4f47a23ee599 100644 (file)
@@ -12743,7 +12743,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)))
index a7b5ce385e8e8a34148d1d40ab7ce95b1e67df33..b55abc2e363b276cf88eaa65c0757b40827c23b8 100644 (file)
@@ -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
 
index 7ca667a507e260314e3955b80ba5ca1b6cea4120..d66fdb7cde774d482e4517d3af965936f142df65 100644 (file)
@@ -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);