提交 e557bd28 编写于 作者: P Peter Krempa

virsh: blockcommit: 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
上级 e54b5484
...@@ -2010,6 +2010,10 @@ static const vshCmdOptDef opts_block_commit[] = { ...@@ -2010,6 +2010,10 @@ static const vshCmdOptDef opts_block_commit[] = {
.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}
}; };
...@@ -2024,6 +2028,7 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd) ...@@ -2024,6 +2028,7 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
bool active = vshCommandOptBool(cmd, "active") || pivot || finish; bool active = vshCommandOptBool(cmd, "active") || pivot || finish;
bool blocking = vshCommandOptBool(cmd, "wait") || pivot || finish; bool blocking = vshCommandOptBool(cmd, "wait") || pivot || finish;
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;
...@@ -2044,9 +2049,12 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd) ...@@ -2044,9 +2049,12 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptStringReq(ctl, cmd, "top", &top) < 0) if (vshCommandOptStringReq(ctl, cmd, "top", &top) < 0)
return false; return false;
if (vshCommandOptULWrap(ctl, cmd, "bandwidth", &bandwidth) < 0) if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0)
return false; return false;
if (bytes)
flags |= VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES;
if (vshCommandOptBool(cmd, "shallow")) if (vshCommandOptBool(cmd, "shallow"))
flags |= VIR_DOMAIN_BLOCK_COMMIT_SHALLOW; flags |= VIR_DOMAIN_BLOCK_COMMIT_SHALLOW;
......
...@@ -941,7 +941,7 @@ currently in use by a running domain. Other contexts that require a MAC ...@@ -941,7 +941,7 @@ currently in use by a running domain. Other contexts that require a MAC
address of virtual interface (such as I<detach-interface> or address of virtual interface (such as I<detach-interface> or
I<domif-setlink>) will accept the MAC address printed by this command. I<domif-setlink>) will accept the MAC address printed by this command.
=item B<blockcommit> I<domain> I<path> [I<bandwidth>] =item B<blockcommit> I<domain> I<path> [I<bandwidth>] [I<--bytes>]
[I<base>] [I<--shallow>] [I<top>] [I<--delete>] [I<--keep-relative>] [I<base>] [I<--shallow>] [I<top>] [I<--delete>] [I<--keep-relative>]
[I<--wait> [I<--async>] [I<--verbose>]] [I<--timeout> B<seconds>] [I<--wait> [I<--async>] [I<--verbose>]] [I<--timeout> B<seconds>]
[I<--active>] [{I<--pivot> | I<--keep-overlay>}] [I<--active>] [{I<--pivot> | I<--keep-overlay>}]
...@@ -987,10 +987,9 @@ to a unique target name (<target dev='name'/>) or source file (<source ...@@ -987,10 +987,9 @@ 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, although for I<bandwidth> specifies copying bandwidth limit in MiB/s, although for
qemu, it may be non-zero only for an online domain. Specifying a negative qemu, it may be non-zero only for an online domain. 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<blockcopy> I<domain> I<path> { I<dest> [I<format>] [I<--blockdev>] =item B<blockcopy> I<domain> I<path> { I<dest> [I<format>] [I<--blockdev>]
| I<--xml> B<file> } [I<--shallow>] [I<--reuse-external>] [I<bandwidth>] | I<--xml> B<file> } [I<--shallow>] [I<--reuse-external>] [I<bandwidth>]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册