mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
virsh: Add support for setting post-copy migration bandwidth
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
12977fba8b
commit
f15789ecac
@ -10557,6 +10557,10 @@ static const vshCmdOptDef opts_migrate[] = {
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("use TLS for migration")
|
||||
},
|
||||
{.name = "postcopy-bandwidth",
|
||||
.type = VSH_OT_INT,
|
||||
.help = N_("post-copy migration bandwidth limit in MiB/s")
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
@ -10753,6 +10757,15 @@ doMigrate(void *opaque)
|
||||
goto save_error;
|
||||
}
|
||||
|
||||
if ((rv = vshCommandOptULongLong(ctl, cmd, "postcopy-bandwidth", &ullOpt)) < 0) {
|
||||
goto out;
|
||||
} else if (rv > 0) {
|
||||
if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
|
||||
VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY,
|
||||
ullOpt) < 0)
|
||||
goto save_error;
|
||||
}
|
||||
|
||||
if (vshCommandOptBool(cmd, "live"))
|
||||
flags |= VIR_MIGRATE_LIVE;
|
||||
if (vshCommandOptBool(cmd, "p2p"))
|
||||
@ -11150,6 +11163,10 @@ static const vshCmdOptDef opts_migrate_setspeed[] = {
|
||||
.flags = VSH_OFLAG_REQ,
|
||||
.help = N_("migration bandwidth limit in MiB/s")
|
||||
},
|
||||
{.name = "postcopy",
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("set post-copy migration bandwidth")
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
@ -11158,6 +11175,7 @@ cmdMigrateSetMaxSpeed(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virDomainPtr dom = NULL;
|
||||
unsigned long bandwidth = 0;
|
||||
unsigned int flags = 0;
|
||||
bool ret = false;
|
||||
|
||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||
@ -11166,7 +11184,10 @@ cmdMigrateSetMaxSpeed(vshControl *ctl, const vshCmd *cmd)
|
||||
if (vshCommandOptULWrap(ctl, cmd, "bandwidth", &bandwidth) < 0)
|
||||
goto done;
|
||||
|
||||
if (virDomainMigrateSetMaxSpeed(dom, bandwidth, 0) < 0)
|
||||
if (vshCommandOptBool(cmd, "postcopy"))
|
||||
flags |= VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY;
|
||||
|
||||
if (virDomainMigrateSetMaxSpeed(dom, bandwidth, flags) < 0)
|
||||
goto done;
|
||||
|
||||
ret = true;
|
||||
@ -11191,6 +11212,10 @@ static const vshCmdInfo info_migrate_getspeed[] = {
|
||||
|
||||
static const vshCmdOptDef opts_migrate_getspeed[] = {
|
||||
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
|
||||
{.name = "postcopy",
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("get post-copy migration bandwidth")
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
@ -11199,12 +11224,16 @@ cmdMigrateGetMaxSpeed(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virDomainPtr dom = NULL;
|
||||
unsigned long bandwidth;
|
||||
unsigned int flags = 0;
|
||||
bool ret = false;
|
||||
|
||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||
return false;
|
||||
|
||||
if (virDomainMigrateGetMaxSpeed(dom, &bandwidth, 0) < 0)
|
||||
if (vshCommandOptBool(cmd, "postcopy"))
|
||||
flags |= VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY;
|
||||
|
||||
if (virDomainMigrateGetMaxSpeed(dom, &bandwidth, flags) < 0)
|
||||
goto done;
|
||||
|
||||
vshPrint(ctl, "%lu\n", bandwidth);
|
||||
|
@ -1903,6 +1903,7 @@ I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<listen-address>] [I<dna
|
||||
[I<--comp-mt-level>] [I<--comp-mt-threads>] [I<--comp-mt-dthreads>]
|
||||
[I<--comp-xbzrle-cache>] [I<--auto-converge>] [I<auto-converge-initial>]
|
||||
[I<auto-converge-increment>] [I<--persistent-xml> B<file>] [I<--tls>]
|
||||
[I<--postcopy-bandwidth> B<bandwidth>]
|
||||
|
||||
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>
|
||||
@ -1933,6 +1934,8 @@ 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> along with I<--postcopy> to let libvirt
|
||||
automatically switch to post-copy after the first pass of pre-copy is finished.
|
||||
The maximum bandwidth consumed during the post-copy phase may be limited using
|
||||
I<--postcopy-bandwidth>.
|
||||
|
||||
I<--auto-converge> forces convergence during live migration. The initial
|
||||
guest CPU throttling rate can be set with I<auto-converge-initial>. If the
|
||||
@ -2098,17 +2101,21 @@ is supposed to be used while the domain is being live-migrated as a reaction
|
||||
to migration progress and increasing number of compression cache misses
|
||||
obtained from domjobinfo.
|
||||
|
||||
=item B<migrate-setspeed> I<domain> I<bandwidth>
|
||||
=item B<migrate-setspeed> I<domain> I<bandwidth> [I<--postcopy>]
|
||||
|
||||
Set the maximum migration bandwidth (in MiB/s) for a domain which is being
|
||||
migrated to another host. I<bandwidth> is interpreted as an unsigned long
|
||||
long value. Specifying a negative value results in an essentially unlimited
|
||||
value being provided to the hypervisor. The hypervisor can choose whether to
|
||||
reject the value or convert it to the maximum value allowed.
|
||||
reject the value or convert it to the maximum value allowed. If the
|
||||
I<--postcopy> option is specified, the command will set the maximum bandwidth
|
||||
allowed during a post-copy migration phase.
|
||||
|
||||
=item B<migrate-getspeed> I<domain>
|
||||
=item B<migrate-getspeed> I<domain> [I<--postcopy>]
|
||||
|
||||
Get the maximum migration bandwidth (in MiB/s) for a domain.
|
||||
Get the maximum migration bandwidth (in MiB/s) for a domain. If the
|
||||
I<--postcopy> option is specified, the command will get the maximum bandwidth
|
||||
allowed during a post-copy migration phase.
|
||||
|
||||
=item B<migrate-postcopy> I<domain>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user