1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

virsh: use option aliases

Command line interfaces should use dash, not underscore, as many
keyboard layouts allow that to be typed with fewer shift key presses.

Also, the US spelling of --tunneled gets more google hits than the
UK spelling of --tunnelled.

* tools/virsh.c (opts_migrate): Allow US variant.
(opts_blkdeviotune): Prefer - over _.
* tools/virsh.pod (blkdeviotune): Fix spelling.
This commit is contained in:
Eric Blake 2012-03-02 11:18:00 -07:00
parent 1c56b9fe53
commit 3d150d328b
2 changed files with 43 additions and 27 deletions

View File

@ -7033,6 +7033,7 @@ static const vshCmdOptDef opts_migrate[] = {
{"live", VSH_OT_BOOL, 0, N_("live migration")},
{"p2p", VSH_OT_BOOL, 0, N_("peer-2-peer migration")},
{"direct", VSH_OT_BOOL, 0, N_("direct migration")},
{"tunneled", VSH_OT_ALIAS, 0, "tunnelled"},
{"tunnelled", VSH_OT_BOOL, 0, N_("tunnelled migration")},
{"persistent", VSH_OT_BOOL, 0, N_("persist VM on destination")},
{"undefinesource", VSH_OT_BOOL, 0, N_("undefine VM on source")},
@ -7728,17 +7729,23 @@ static const vshCmdInfo info_blkdeviotune[] = {
static const vshCmdOptDef opts_blkdeviotune[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"device", VSH_OT_DATA, VSH_OFLAG_REQ, N_("block device")},
{"total_bytes_sec", VSH_OT_INT, VSH_OFLAG_NONE,
{"total_bytes_sec", VSH_OT_ALIAS, 0, "total-bytes-sec"},
{"total-bytes-sec", VSH_OT_INT, VSH_OFLAG_NONE,
N_("total throughput limit in bytes per second")},
{"read_bytes_sec", VSH_OT_INT, VSH_OFLAG_NONE,
{"read_bytes_sec", VSH_OT_ALIAS, 0, "read-bytes-sec"},
{"read-bytes-sec", VSH_OT_INT, VSH_OFLAG_NONE,
N_("read throughput limit in bytes per second")},
{"write_bytes_sec", VSH_OT_INT, VSH_OFLAG_NONE,
{"write_bytes_sec", VSH_OT_ALIAS, 0, "write-bytes-sec"},
{"write-bytes-sec", VSH_OT_INT, VSH_OFLAG_NONE,
N_("write throughput limit in bytes per second")},
{"total_iops_sec", VSH_OT_INT, VSH_OFLAG_NONE,
{"total_iops_sec", VSH_OT_ALIAS, 0, "total-iops-sec"},
{"total-iops-sec", VSH_OT_INT, VSH_OFLAG_NONE,
N_("total I/O operations limit per second")},
{"read_iops_sec", VSH_OT_INT, VSH_OFLAG_NONE,
{"read_iops_sec", VSH_OT_ALIAS, 0, "read-iops-sec"},
{"read-iops-sec", VSH_OT_INT, VSH_OFLAG_NONE,
N_("read I/O operations limit per second")},
{"write_iops_sec", VSH_OT_INT, VSH_OFLAG_NONE,
{"write_iops_sec", VSH_OT_ALIAS, 0, "write-iops-sec"},
{"write-iops-sec", VSH_OT_INT, VSH_OFLAG_NONE,
N_("write I/O operations limit per second")},
{"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{"live", VSH_OT_BOOL, 0, N_("affect running domain")},
@ -7784,7 +7791,8 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptString(cmd, "device", &disk) < 0)
goto cleanup;
if ((rv = vshCommandOptULongLong(cmd, "total_bytes_sec", &total_bytes_sec)) < 0) {
if ((rv = vshCommandOptULongLong(cmd, "total-bytes-sec",
&total_bytes_sec)) < 0) {
vshError(ctl, "%s",
_("Unable to parse integer parameter"));
goto cleanup;
@ -7792,7 +7800,8 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
nparams++;
}
if ((rv = vshCommandOptULongLong(cmd, "read_bytes_sec", &read_bytes_sec)) < 0) {
if ((rv = vshCommandOptULongLong(cmd, "read-bytes-sec",
&read_bytes_sec)) < 0) {
vshError(ctl, "%s",
_("Unable to parse integer parameter"));
goto cleanup;
@ -7800,7 +7809,8 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
nparams++;
}
if ((rv = vshCommandOptULongLong(cmd, "write_bytes_sec", &write_bytes_sec)) < 0) {
if ((rv = vshCommandOptULongLong(cmd, "write-bytes-sec",
&write_bytes_sec)) < 0) {
vshError(ctl, "%s",
_("Unable to parse integer parameter"));
goto cleanup;
@ -7808,7 +7818,8 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
nparams++;
}
if ((rv = vshCommandOptULongLong(cmd, "total_iops_sec", &total_iops_sec)) < 0) {
if ((rv = vshCommandOptULongLong(cmd, "total-iops-sec",
&total_iops_sec)) < 0) {
vshError(ctl, "%s",
_("Unable to parse integer parameter"));
goto cleanup;
@ -7816,7 +7827,8 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
nparams++;
}
if ((rv = vshCommandOptULongLong(cmd, "read_iops_sec", &read_iops_sec)) < 0) {
if ((rv = vshCommandOptULongLong(cmd, "read-iops-sec",
&read_iops_sec)) < 0) {
vshError(ctl, "%s",
_("Unable to parse integer parameter"));
goto cleanup;
@ -7824,7 +7836,8 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
nparams++;
}
if ((rv = vshCommandOptULongLong(cmd, "write_iops_sec", &write_iops_sec)) < 0) {
if ((rv = vshCommandOptULongLong(cmd, "write-iops-sec",
&write_iops_sec)) < 0) {
vshError(ctl, "%s",
_("Unable to parse integer parameter"));
goto cleanup;
@ -7866,7 +7879,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
params = vshCalloc(ctl, nparams, sizeof(*params));
i = 0;
if ((i < nparams) && (vshCommandOptBool(cmd, "total_bytes_sec"))) {
if ((i < nparams) && (vshCommandOptBool(cmd, "total-bytes-sec"))) {
temp = &params[i];
temp->type = VIR_TYPED_PARAM_ULLONG;
strncpy(temp->field, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC,
@ -7875,7 +7888,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
i++;
}
if ((i < nparams) && (vshCommandOptBool(cmd, "read_bytes_sec"))) {
if ((i < nparams) && (vshCommandOptBool(cmd, "read-bytes-sec"))) {
temp = &params[i];
temp->type = VIR_TYPED_PARAM_ULLONG;
strncpy(temp->field, VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC,
@ -7884,7 +7897,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
i++;
}
if ((i < nparams) && (vshCommandOptBool(cmd, "write_bytes_sec"))) {
if ((i < nparams) && (vshCommandOptBool(cmd, "write-bytes-sec"))) {
temp = &params[i];
temp->type = VIR_TYPED_PARAM_ULLONG;
strncpy(temp->field, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC,
@ -7893,7 +7906,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
i++;
}
if ((i < nparams) && (vshCommandOptBool(cmd, "total_iops_sec"))) {
if ((i < nparams) && (vshCommandOptBool(cmd, "total-iops-sec"))) {
temp = &params[i];
temp->type = VIR_TYPED_PARAM_ULLONG;
strncpy(temp->field, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC,
@ -7902,7 +7915,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
i++;
}
if ((i < nparams) && (vshCommandOptBool(cmd, "read_iops_sec"))) {
if ((i < nparams) && (vshCommandOptBool(cmd, "read-iops-sec"))) {
temp = &params[i];
temp->type = VIR_TYPED_PARAM_ULLONG;
strncpy(temp->field, VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC,
@ -7911,7 +7924,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
i++;
}
if ((i < nparams) && (vshCommandOptBool(cmd, "write_iops_sec"))) {
if ((i < nparams) && (vshCommandOptBool(cmd, "write-iops-sec"))) {
temp = &params[i];
temp->type = VIR_TYPED_PARAM_ULLONG;
strncpy(temp->field, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC,

View File

@ -620,8 +620,8 @@ I<bandwidth> specifies copying bandwidth limit in Mbps.
=item B<blkdeviotune> I<domain> I<device>
[[I<--config>] [I<--live>] | [I<--current>]]
[[I<total_bytes_sec>] | [I<read_bytes_sec>] [I<write_bytes_sec>]]
[[I<total_iops_sec>] | [I<read_iops_sec>] [I<write_iops_sec>]]
[[I<total-bytes-sec>] | [I<read-bytes-sec>] [I<write-bytes-sec>]]
[[I<total-iops-sec>] | [I<read-iops-sec>] [I<write-iops-sec>]]
Set or query the block disk io parameters for a block device of I<domain>.
I<device> specifies a unique target name (<target dev='name'/>) or source
@ -630,15 +630,18 @@ I<domain> (see also B<domblklist> for listing these names).
If no limit is specified, it will query current I/O limits setting.
Otherwise, alter the limits with these flags:
I<--total_bytes_sec> specifies total throughput limit in bytes per second.
I<--read_bytes_sec> specifies read throughput limit in bytes per second.
I<--write_bytes_sec> specifies write throughput limit in bytes per second.
I<--total_iops_sec> specifies total I/O operations limit per second.
I<--read_iops_sec> specifies read I/O operations limit per second.
I<--write_iops_sec> specifies write I/O operations limit per second.
I<--total-bytes-sec> specifies total throughput limit in bytes per second.
I<--read-bytes-sec> specifies read throughput limit in bytes per second.
I<--write-bytes-sec> specifies write throughput limit in bytes per second.
I<--total-iops-sec> specifies total I/O operations limit per second.
I<--read-iops-sec> specifies read I/O operations limit per second.
I<--write-iops-sec> specifies write I/O operations limit per second.
Older versions of virsh only accepted these options with underscore
instead of dash, as in I<--total_bytes_sec>.
Bytes and iops values are independent, but setting only one value (such
as --read_bytes_sec) resets the other two in that category to unlimited.
as --read-bytes-sec) resets the other two in that category to unlimited.
An explicit 0 also clears any limit. A non-zero value for a given total
cannot be mixed with non-zero values for read or write.