提交 179d9728 编写于 作者: C Cristian Klein 提交者: Jiri Denemark

virsh: Add support for post-copy migration

Signed-off-by: NCristian Klein <cristiklein@gmail.com>
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 51a3e4df
......@@ -9639,6 +9639,10 @@ static const vshCmdOptDef opts_migrate[] = {
.type = VSH_OT_BOOL,
.help = N_("abort on soft errors during migration")
},
{.name = "postcopy",
.type = VSH_OT_BOOL,
.help = N_("enable post-copy migration; switch to it using migrate-postcopy command")
},
{.name = "migrateuri",
.type = VSH_OT_STRING,
.help = N_("migration URI, usually can be omitted")
......@@ -9817,6 +9821,9 @@ doMigrate(void *opaque)
if (vshCommandOptBool(cmd, "abort-on-error"))
flags |= VIR_MIGRATE_ABORT_ON_ERROR;
if (vshCommandOptBool(cmd, "postcopy"))
flags |= VIR_MIGRATE_POSTCOPY;
if (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct")) {
if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
ret = '0';
......@@ -10121,6 +10128,48 @@ cmdMigrateGetMaxSpeed(vshControl *ctl, const vshCmd *cmd)
return ret;
}
/*
* "migrate-postcopy" command
*/
static const vshCmdInfo info_migrate_postcopy[] = {
{.name = "help",
.data = N_("Switch running migration from pre-copy to post-copy")
},
{.name = "desc",
.data = N_("Switch running migration from pre-copy to post-copy. "
"The migration must have been started with --postcopy option.")
},
{.name = NULL}
};
static const vshCmdOptDef opts_migrate_postcopy[] = {
{.name = "domain",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("domain name, id or uuid")
},
{.name = NULL}
};
static bool
cmdMigratePostCopy(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
bool ret = false;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
if (virDomainMigrateStartPostCopy(dom, 0) < 0)
goto cleanup;
ret = true;
cleanup:
virDomainFree(dom);
return ret;
}
/*
* "domdisplay" command
*/
......@@ -12976,6 +13025,12 @@ const vshCmdDef domManagementCmds[] = {
.info = info_migrate_getspeed,
.flags = 0
},
{.name = "migrate-postcopy",
.handler = cmdMigratePostCopy,
.opts = opts_migrate_postcopy,
.info = info_migrate_postcopy,
.flags = 0
},
{.name = "numatune",
.handler = cmdNumatune,
.opts = opts_numatune,
......
......@@ -1529,7 +1529,7 @@ 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<--compressed>] [I<--abort-on-error>] [I<--auto-converge>]
[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<--xml> B<file>]
[I<--migrate-disks> B<disk-list>] [I<--disks-port> B<port>]
......@@ -1559,6 +1559,10 @@ of migration. I<--compressed> activates compression of memory pages that have
to be transferred repeatedly during live 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
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<Note>: Individual hypervisors usually do not support all possible types of
migration. For example, QEMU does not support direct migration.
......@@ -1692,6 +1696,11 @@ reject the value or convert it to the maximum value allowed.
Get the maximum migration bandwidth (in MiB/s) for a domain.
=item B<migrate-postcopy> I<domain>
Switch the current migration from pre-copy to post-copy. This is only
supported for a migration started with I<--postcopy> option.
=item B<numatune> I<domain> [I<--mode> B<mode>] [I<--nodeset> B<nodeset>]
[[I<--config>] [I<--live>] | [I<--current>]]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册