mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-07 01:13:49 +00:00
virsh: blockpull: Support --bytes and scaled integers
Use vshBlockJobOptionBandwidth to parse the bandwidth value which will allow users to specify bandwidth in bytes or as a scaled integer. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1288000
This commit is contained in:
parent
453a6d8092
commit
d40d18fb8f
@ -2761,6 +2761,10 @@ static const vshCmdOptDef opts_block_pull[] = {
|
|||||||
.type = VSH_OT_BOOL,
|
.type = VSH_OT_BOOL,
|
||||||
.help = N_("keep the backing chain relatively referenced")
|
.help = N_("keep the backing chain relatively referenced")
|
||||||
},
|
},
|
||||||
|
{.name = "bytes",
|
||||||
|
.type = VSH_OT_BOOL,
|
||||||
|
.help = N_("the bandwidth limit is in bytes/s rather than MiB/s")
|
||||||
|
},
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2772,6 +2776,7 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool blocking = vshCommandOptBool(cmd, "wait");
|
bool blocking = vshCommandOptBool(cmd, "wait");
|
||||||
bool verbose = vshCommandOptBool(cmd, "verbose");
|
bool verbose = vshCommandOptBool(cmd, "verbose");
|
||||||
bool async = vshCommandOptBool(cmd, "async");
|
bool async = vshCommandOptBool(cmd, "async");
|
||||||
|
bool bytes = vshCommandOptBool(cmd, "bytes");
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
const char *base = NULL;
|
const char *base = NULL;
|
||||||
@ -2788,7 +2793,7 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (vshCommandOptStringReq(ctl, cmd, "base", &base) < 0)
|
if (vshCommandOptStringReq(ctl, cmd, "base", &base) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptULWrap(ctl, cmd, "bandwidth", &bandwidth) < 0)
|
if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
|
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
|
||||||
@ -2806,10 +2811,16 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (base || flags) {
|
if (base || flags) {
|
||||||
|
if (bytes)
|
||||||
|
flags |= VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES;
|
||||||
|
|
||||||
if (virDomainBlockRebase(dom, path, base, bandwidth, flags) < 0)
|
if (virDomainBlockRebase(dom, path, base, bandwidth, flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
if (virDomainBlockPull(dom, path, bandwidth, 0) < 0)
|
if (bytes)
|
||||||
|
flags |= VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES;
|
||||||
|
|
||||||
|
if (virDomainBlockPull(dom, path, bandwidth, flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1049,7 +1049,7 @@ within a certain range. Specifying I<buf-size> will control how much data can
|
|||||||
be simultaneously in-flight during the copy; larger values use more memory but
|
be simultaneously in-flight during the copy; larger values use more memory but
|
||||||
may allow faster completion (the default value is usually correct).
|
may allow faster completion (the default value is usually correct).
|
||||||
|
|
||||||
=item B<blockpull> I<domain> I<path> [I<bandwidth>] [I<base>]
|
=item B<blockpull> I<domain> I<path> [I<bandwidth>] [I<--bytes>] [I<base>]
|
||||||
[I<--wait> [I<--verbose>] [I<--timeout> B<seconds>] [I<--async>]]
|
[I<--wait> [I<--verbose>] [I<--timeout> B<seconds>] [I<--async>]]
|
||||||
[I<--keep-relative>]
|
[I<--keep-relative>]
|
||||||
|
|
||||||
@ -1078,10 +1078,9 @@ I<path> specifies fully-qualified path of the disk; it corresponds
|
|||||||
to a unique target name (<target dev='name'/>) or source file (<source
|
to a unique target name (<target dev='name'/>) or source file (<source
|
||||||
file='name'/>) for one of the disk devices attached to I<domain> (see
|
file='name'/>) for one of the disk devices attached to I<domain> (see
|
||||||
also B<domblklist> for listing these names).
|
also B<domblklist> for listing these names).
|
||||||
I<bandwidth> specifies copying bandwidth limit in MiB/s. Specifying a negative
|
I<bandwidth> specifies copying bandwidth limit in MiB/s. For further information
|
||||||
value is interpreted as an unsigned long long value or essentially
|
on the I<bandwidth> argument see the corresponding section for the B<blockjob>
|
||||||
unlimited. The hypervisor can choose whether to reject the value or
|
command.
|
||||||
convert it to the maximum value allowed.
|
|
||||||
|
|
||||||
=item B<blkdeviotune> I<domain> I<device>
|
=item B<blkdeviotune> I<domain> I<device>
|
||||||
[[I<--config>] [I<--live>] | [I<--current>]]
|
[[I<--config>] [I<--live>] | [I<--current>]]
|
||||||
|
Loading…
Reference in New Issue
Block a user