From: Cristian Klein <cristiklein(a)gmail.com>
Signed-off-by: Cristian Klein <cristiklein(a)gmail.com>
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
tools/virsh-domain.c | 6 ++++++
tools/virsh.pod | 9 ++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 55ad342..d9db9fa 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9627,6 +9627,10 @@ static const vshCmdOptDef opts_migrate[] = {
.type = VSH_OT_BOOL,
.help = N_("enable post-copy migration; switch to it using migrate-postcopy
command")
},
+ {.name = "postcopy-after-precopy",
+ .type = VSH_OT_BOOL,
+ .help = N_("automatically switch to post-copy migration after one pass of
pre-copy")
+ },
{.name = "migrateuri",
.type = VSH_OT_STRING,
.help = N_("migration URI, usually can be omitted")
@@ -9804,6 +9808,8 @@ doMigrate(void *opaque)
if (vshCommandOptBool(cmd, "postcopy"))
flags |= VIR_MIGRATE_POSTCOPY;
+ if (vshCommandOptBool(cmd, "postcopy-after-precopy"))
+ flags |= VIR_MIGRATE_POSTCOPY_AFTER_PRECOPY;
if (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct"))
{
if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 64b4287..2ace976 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1530,8 +1530,9 @@ to the I<uri> namespace is displayed instead of being
modified.
[I<--persistent>] [I<--undefinesource>] [I<--suspend>]
[I<--copy-storage-all>]
[I<--copy-storage-inc>] [I<--change-protection>] [I<--unsafe>]
[I<--verbose>]
[I<--compressed>] [I<--abort-on-error>] [I<--auto-converge>]
[I<--postcopy>]
-I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>]
[I<listen-address>]
-[I<dname>] [I<--timeout> B<seconds> [I<--timeout-suspend> |
I<--timeout-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>]
Migrate domain to another host. Add I<--live> for live migration; <--p2p>
@@ -1562,7 +1563,9 @@ migration. I<--auto-converge> forces convergence during live
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.
+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.
B<Note>: Individual hypervisors usually do not support all possible types of
migration. For example, QEMU does not support direct migration.
--
2.7.0