mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-03 12:55:45 +00:00
virsh: Add support for post-copy migration
Signed-off-by: Cristian Klein <cristiklein@gmail.com> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
51a3e4df72
commit
179d97283f
@ -9639,6 +9639,10 @@ static const vshCmdOptDef opts_migrate[] = {
|
|||||||
.type = VSH_OT_BOOL,
|
.type = VSH_OT_BOOL,
|
||||||
.help = N_("abort on soft errors during migration")
|
.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",
|
{.name = "migrateuri",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
.help = N_("migration URI, usually can be omitted")
|
.help = N_("migration URI, usually can be omitted")
|
||||||
@ -9817,6 +9821,9 @@ doMigrate(void *opaque)
|
|||||||
if (vshCommandOptBool(cmd, "abort-on-error"))
|
if (vshCommandOptBool(cmd, "abort-on-error"))
|
||||||
flags |= VIR_MIGRATE_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 (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct")) {
|
||||||
if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
|
if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
|
||||||
ret = '0';
|
ret = '0';
|
||||||
@ -10121,6 +10128,48 @@ cmdMigrateGetMaxSpeed(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return ret;
|
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
|
* "domdisplay" command
|
||||||
*/
|
*/
|
||||||
@ -12976,6 +13025,12 @@ const vshCmdDef domManagementCmds[] = {
|
|||||||
.info = info_migrate_getspeed,
|
.info = info_migrate_getspeed,
|
||||||
.flags = 0
|
.flags = 0
|
||||||
},
|
},
|
||||||
|
{.name = "migrate-postcopy",
|
||||||
|
.handler = cmdMigratePostCopy,
|
||||||
|
.opts = opts_migrate_postcopy,
|
||||||
|
.info = info_migrate_postcopy,
|
||||||
|
.flags = 0
|
||||||
|
},
|
||||||
{.name = "numatune",
|
{.name = "numatune",
|
||||||
.handler = cmdNumatune,
|
.handler = cmdNumatune,
|
||||||
.opts = opts_numatune,
|
.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>]]
|
=item B<migrate> [I<--live>] [I<--offline>] [I<--direct>] [I<--p2p> [I<--tunnelled>]]
|
||||||
[I<--persistent>] [I<--undefinesource>] [I<--suspend>] [I<--copy-storage-all>]
|
[I<--persistent>] [I<--undefinesource>] [I<--suspend>] [I<--copy-storage-all>]
|
||||||
[I<--copy-storage-inc>] [I<--change-protection>] [I<--unsafe>] [I<--verbose>]
|
[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<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<listen-address>]
|
||||||
[I<dname>] [I<--timeout> B<seconds>] [I<--xml> B<file>]
|
[I<dname>] [I<--timeout> B<seconds>] [I<--xml> B<file>]
|
||||||
[I<--migrate-disks> B<disk-list>] [I<--disks-port> B<port>]
|
[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
|
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
|
the migration if a soft error (for example I/O error) happens during the
|
||||||
migration. I<--auto-converge> forces convergence during live migration.
|
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
|
B<Note>: Individual hypervisors usually do not support all possible types of
|
||||||
migration. For example, QEMU does not support direct migration.
|
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.
|
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>]
|
=item B<numatune> I<domain> [I<--mode> B<mode>] [I<--nodeset> B<nodeset>]
|
||||||
[[I<--config>] [I<--live>] | [I<--current>]]
|
[[I<--config>] [I<--live>] | [I<--current>]]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user