diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 5b80b85246..9caf4722b1 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 3c11be6f72..a28fffebd9 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9960,6 +9960,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} }; @@ -10120,6 +10128,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(¶ms, &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(¶ms, &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 2b1d83fa41..601cb44557 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1550,14 +1550,14 @@ to the I namespace is displayed instead of being modified. =item B [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 I [I] -[I] [I] [I] +[I<--abort-on-error>] [I<--postcopy>] [I<--postcopy-after-precopy>] +I I [I] [I] [I] [I] [I<--timeout> B [I<--timeout-suspend> | I<--timeout-postcopy>]] [I<--xml> B] [I<--migrate-disks> B] [I<--disks-port> B] [I<--compressed>] [I<--comp-methods> B] [I<--comp-mt-level>] [I<--comp-mt-threads>] [I<--comp-mt-dthreads>] -[I<--comp-xbzrle-cache>] +[I<--comp-xbzrle-cache>] [I<--auto-converge>] [I] +[I] 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 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. If the +initial throttling rate is not enough to ensure convergence, the rate is +periodically increased by I. + B: Individual hypervisors usually do not support all possible types of migration. For example, QEMU does not support direct migration.