[libvirt] [PATCH 07/11] Add auto convergence migration parameters

Jiri Denemark jdenemar at redhat.com
Tue Jun 21 11:47:13 UTC 2016


They can be used to tune auto-convergence algorithm (which is enabled
with VIR_MIGRATE_AUTO_CONVERGE).

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 include/libvirt/libvirt-domain.h | 19 +++++++++++++++++++
 tools/virsh-domain.c             | 26 ++++++++++++++++++++++++++
 tools/virsh.pod                  | 16 ++++++++++------
 3 files changed, 55 insertions(+), 6 deletions(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index cba4fa5..0ca621b 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -845,6 +845,25 @@ typedef enum {
  */
 # define VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE "compression.xbzrle.cache"
 
+/**
+ * VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL:
+ *
+ * virDomainMigrate* params field: the initial percentage guest CPUs are
+ * throttled to when auto-convergence decides migration is not converging.
+ * As VIR_TYPED_PARAM_INT.
+ */
+# define VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL    "auto_converge.initial"
+
+/**
+ * VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT:
+ *
+ * virDomainMigrate* params field: the increment added to
+ * VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL whenever the hypervisor decides
+ * the current rate is not enough to ensure convergence of the migration.
+ * As VIR_TYPED_PARAM_INT.
+ */
+# define VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT  "auto_converge.increment"
+
 /* Domain migration. */
 virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
                                unsigned long flags, const char *dname,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 7c3fc86..f4d1156 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9873,6 +9873,14 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_INT,
      .help = N_("page cache size for xbzrle compression")
     },
+    {.name = "auto-converge-initial",
+     .type = VSH_OT_INT,
+     .help = N_("initial CPU throttling rate for auto-convergence")
+    },
+    {.name = "auto-converge-increment",
+     .type = VSH_OT_INT,
+     .help = N_("CPU throttling rate increment for auto-convergence")
+    },
     {.name = NULL}
 };
 
@@ -10033,6 +10041,24 @@ doMigrate(void *opaque)
         VIR_FREE(xml);
     }
 
+    if ((rv = vshCommandOptInt(ctl, cmd, "auto-converge-initial", &intOpt)) < 0) {
+        goto out;
+    } else if (rv > 0) {
+        if (virTypedParamsAddInt(&params, &nparams, &maxparams,
+                                 VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL,
+                                 intOpt) < 0)
+            goto save_error;
+    }
+
+    if ((rv = vshCommandOptInt(ctl, cmd, "auto-converge-increment", &intOpt)) < 0) {
+        goto out;
+    } else if (rv > 0) {
+        if (virTypedParamsAddInt(&params, &nparams, &maxparams,
+                                 VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT,
+                                 intOpt) < 0)
+            goto save_error;
+    }
+
     if (vshCommandOptBool(cmd, "live"))
         flags |= VIR_MIGRATE_LIVE;
     if (vshCommandOptBool(cmd, "p2p"))
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 8e3ba69..73edd82 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1550,14 +1550,14 @@ to the I<uri> namespace is displayed instead of being modified.
 =item B<migrate> [I<--live>] [I<--offline>] [I<--direct>] [I<--p2p> [I<--tunnelled>]]
 [I<--persistent>] [I<--undefinesource>] [I<--suspend>] [I<--copy-storage-all>]
 [I<--copy-storage-inc>] [I<--change-protection>] [I<--unsafe>] [I<--verbose>]
-[I<--abort-on-error>] [I<--auto-converge>] [I<--postcopy>]
-[I<--postcopy-after-precopy>] I<domain> I<desturi> [I<migrateuri>]
-[I<graphicsuri>] [I<listen-address>] [I<dname>]
+[I<--abort-on-error>] [I<--postcopy>] [I<--postcopy-after-precopy>]
+I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<listen-address>] [I<dname>]
 [I<--timeout> B<seconds> [I<--timeout-suspend> | I<--timeout-postcopy>]]
 [I<--xml> B<file>] [I<--migrate-disks> B<disk-list>] [I<--disks-port> B<port>]
 [I<--compressed>] [I<--comp-methods> B<method-list>]
 [I<--comp-mt-level>] [I<--comp-mt-threads>] [I<--comp-mt-dthreads>]
-[I<--comp-xbzrle-cache>]
+[I<--comp-xbzrle-cache>] [I<--auto-converge>] [I<auto-converge-initial>]
+[I<auto-converge-increment>]
 
 Migrate domain to another host.  Add I<--live> for live migration; <--p2p>
 for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled>
@@ -1582,14 +1582,18 @@ by the hypervisor, but can be explicitly used to reject the migration if the
 hypervisor lacks change protection support.  I<--verbose> displays the progress
 of migration.  I<--abort-on-error> cancels
 the migration if a soft error (for example I/O error) happens during the
-migration. I<--auto-converge> forces convergence during live migration.
-I<--postcopy> enables post-copy logic in migration, but does not
+migration. I<--postcopy> enables post-copy logic in migration, but does not
 actually start post-copy, i.e., migration is started in pre-copy mode.
 Once migration is running, the user may switch to post-copy using the
 B<migrate-postcopy> command sent from another virsh instance or use
 I<--postcopy-after-precopy> to let libvirt automatically switch to
 post-copy after the first pass of pre-copy is finished.
 
+I<--auto-converge> forces convergence during live migration. The initial
+guest CPU throttling rate can be set with I<auto-converge-initial>. If the
+initial throttling rate is not enough to ensure convergence, the rate is
+periodically increased by I<auto-converge-increment>.
+
 B<Note>: Individual hypervisors usually do not support all possible types of
 migration. For example, QEMU does not support direct migration.
 
-- 
2.9.0




More information about the libvir-list mailing list