提交 72f808c4 编写于 作者: M Matthias Gatto 提交者: Michal Privoznik

virsh: Add bps_max and friends to virsh

Add the new throttle options to virsh, and send them to libvirt.
Signed-off-by: NMatthias Gatto <matthias.gatto@outscale.com>
上级 12952bb1
...@@ -1111,6 +1111,62 @@ static const vshCmdOptDef opts_blkdeviotune[] = { ...@@ -1111,6 +1111,62 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
.type = VSH_OT_INT, .type = VSH_OT_INT,
.help = N_("write I/O operations limit per second") .help = N_("write I/O operations limit per second")
}, },
{.name = "total_bytes_sec_max",
.type = VSH_OT_ALIAS,
.help = "total-bytes-sec-max"
},
{.name = "total-bytes-sec-max",
.type = VSH_OT_INT,
.help = N_("total max in bytes")
},
{.name = "read_bytes_sec_max",
.type = VSH_OT_ALIAS,
.help = "read-bytes-sec-max"
},
{.name = "read-bytes-sec-max",
.type = VSH_OT_INT,
.help = N_("read max in bytes")
},
{.name = "write_bytes_sec_max",
.type = VSH_OT_ALIAS,
.help = "write-bytes-sec-max"
},
{.name = "write-bytes-sec-max",
.type = VSH_OT_INT,
.help = N_("write max in bytes")
},
{.name = "total_iops_sec_max",
.type = VSH_OT_ALIAS,
.help = "total-iops-sec-max"
},
{.name = "total-iops-sec-max",
.type = VSH_OT_INT,
.help = N_("total I/O operations max")
},
{.name = "read_iops_sec_max",
.type = VSH_OT_ALIAS,
.help = "read-iops-sec-max"
},
{.name = "read-iops-sec-max",
.type = VSH_OT_INT,
.help = N_("read I/O operations max")
},
{.name = "write_iops_sec_max",
.type = VSH_OT_ALIAS,
.help = "write-iops-sec-max"
},
{.name = "write-iops-sec-max",
.type = VSH_OT_INT,
.help = N_("write I/O operations max")
},
{.name = "size_iops_sec",
.type = VSH_OT_ALIAS,
.help = "size-iops-sec"
},
{.name = "size-iops-sec",
.type = VSH_OT_INT,
.help = N_("I/O size in bytes")
},
{.name = "config", {.name = "config",
.type = VSH_OT_BOOL, .type = VSH_OT_BOOL,
.help = N_("affect next boot") .help = N_("affect next boot")
...@@ -1184,6 +1240,33 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) ...@@ -1184,6 +1240,33 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
goto save_error; goto save_error;
} }
if ((rv = vshCommandOptULongLong(cmd, "total-bytes-sec-max", &value)) < 0) {
goto interror;
} else if (rv > 0) {
if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX,
value) < 0)
goto save_error;
}
if ((rv = vshCommandOptULongLong(cmd, "read-bytes-sec-max", &value)) < 0) {
goto interror;
} else if (rv > 0) {
if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX,
value) < 0)
goto save_error;
}
if ((rv = vshCommandOptULongLong(cmd, "write-bytes-sec-max", &value)) < 0) {
goto interror;
} else if (rv > 0) {
if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX,
value) < 0)
goto save_error;
}
if ((rv = vshCommandOptULongLong(cmd, "total-iops-sec", &value)) < 0) { if ((rv = vshCommandOptULongLong(cmd, "total-iops-sec", &value)) < 0) {
goto interror; goto interror;
} else if (rv > 0) { } else if (rv > 0) {
...@@ -1211,6 +1294,42 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) ...@@ -1211,6 +1294,42 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
goto save_error; goto save_error;
} }
if ((rv = vshCommandOptULongLong(cmd, "write-iops-sec-max", &value)) < 0) {
goto interror;
} else if (rv > 0) {
if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX,
value) < 0)
goto save_error;
}
if ((rv = vshCommandOptULongLong(cmd, "read-iops-sec-max", &value)) < 0) {
goto interror;
} else if (rv > 0) {
if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX,
value) < 0)
goto save_error;
}
if ((rv = vshCommandOptULongLong(cmd, "total-iops-sec-max", &value)) < 0) {
goto interror;
} else if (rv > 0) {
if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX,
value) < 0)
goto save_error;
}
if ((rv = vshCommandOptULongLong(cmd, "size-iops-sec", &value)) < 0) {
goto interror;
} else if (rv > 0) {
if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC,
value) < 0)
goto save_error;
}
if (nparams == 0) { if (nparams == 0) {
if (virDomainGetBlockIoTune(dom, NULL, NULL, &nparams, flags) != 0) { if (virDomainGetBlockIoTune(dom, NULL, NULL, &nparams, flags) != 0) {
vshError(ctl, "%s", vshError(ctl, "%s",
......
...@@ -1052,6 +1052,9 @@ convert it to the maximum value allowed. ...@@ -1052,6 +1052,9 @@ convert it to the maximum value allowed.
[[I<--config>] [I<--live>] | [I<--current>]] [[I<--config>] [I<--live>] | [I<--current>]]
[[I<total-bytes-sec>] | [I<read-bytes-sec>] [I<write-bytes-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>]] [[I<total-iops-sec>] | [I<read-iops-sec>] [I<write-iops-sec>]]
[[I<total-bytes-sec-max>] | [I<read-bytes-sec-max>] [I<write-bytes-sec-max>]]
[[I<total-iops-sec-max>] | [I<read-iops-sec-max>] [I<write-iops-sec-max>]]
[I<size-iops-sec>]
Set or query the block disk io parameters for a block device of I<domain>. 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 I<device> specifies a unique target name (<target dev='name'/>) or source
...@@ -1066,6 +1069,13 @@ I<--write-bytes-sec> specifies write throughput limit in bytes per second. ...@@ -1066,6 +1069,13 @@ 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<--total-iops-sec> specifies total I/O operations limit per second.
I<--read-iops-sec> specifies read 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<--write-iops-sec> specifies write I/O operations limit per second.
I<--total-bytes-sec-max> specifies maximum total throughput limit in bytes per second.
I<--read-bytes-sec-max> specifies maximum read throughput limit in bytes per second.
I<--write-bytes-sec-max> specifies maximum write throughput limit in bytes per second.
I<--total-iops-sec-max> specifies maximum total I/O operations limit per second.
I<--read-iops-sec-max> specifies maximum read I/O operations limit per second.
I<--write-iops-sec-max> specifies maximum write I/O operations limit per second.
I<--size-iops-sec> specifies size I/O operations limit per second.
Older versions of virsh only accepted these options with underscore Older versions of virsh only accepted these options with underscore
instead of dash, as in I<--total_bytes_sec>. instead of dash, as in I<--total_bytes_sec>.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册