[PATCH 12/28] virsh: Require option flags for 'blkdeviotune' arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make all of the tunable parameter flags require the option name (don't
parse them positionally).

While techically this would be a breaking change if anyone were to
specify the tunable values positionally this is not the case as the
first two tunables are not compatible with each other:

  $ virsh blkdeviotune cd vda 4 5
  error: Unable to change block I/O throttle
  error: invalid argument: total and read/write of bytes_sec cannot be set at the same time

The above is produced by all implementations of the API (qemu and test
drivers). It is true that the first tunable can be specified
positionally (--total-bytes-sec) but it is misleading and shoud not be
allowed either.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tools/virsh-domain.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 801b01bb42..c8b0896eb6 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1204,6 +1204,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "total-bytes-sec",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("total throughput limit, as scaled integer (default bytes)")
     },
     {.name = "read_bytes_sec",
@@ -1212,6 +1213,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "read-bytes-sec",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("read throughput limit, as scaled integer (default bytes)")
     },
     {.name = "write_bytes_sec",
@@ -1220,6 +1222,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "write-bytes-sec",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help =  N_("write throughput limit, as scaled integer (default bytes)")
     },
     {.name = "total_iops_sec",
@@ -1228,6 +1231,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "total-iops-sec",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("total I/O operations limit per second")
     },
     {.name = "read_iops_sec",
@@ -1236,6 +1240,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "read-iops-sec",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("read I/O operations limit per second")
     },
     {.name = "write_iops_sec",
@@ -1244,6 +1249,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "write-iops-sec",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("write I/O operations limit per second")
     },
     {.name = "total_bytes_sec_max",
@@ -1252,6 +1258,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "total-bytes-sec-max",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("total max, as scaled integer (default bytes)")
     },
     {.name = "read_bytes_sec_max",
@@ -1260,6 +1267,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "read-bytes-sec-max",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("read max, as scaled integer (default bytes)")
     },
     {.name = "write_bytes_sec_max",
@@ -1268,6 +1276,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "write-bytes-sec-max",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("write max, as scaled integer (default bytes)")
     },
     {.name = "total_iops_sec_max",
@@ -1276,6 +1285,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "total-iops-sec-max",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("total I/O operations max")
     },
     {.name = "read_iops_sec_max",
@@ -1284,6 +1294,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "read-iops-sec-max",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("read I/O operations max")
     },
     {.name = "write_iops_sec_max",
@@ -1292,6 +1303,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "write-iops-sec-max",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("write I/O operations max")
     },
     {.name = "size_iops_sec",
@@ -1300,6 +1312,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "size-iops-sec",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("I/O size in bytes")
     },
     {.name = "group_name",
@@ -1308,6 +1321,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "group-name",
      .type = VSH_OT_STRING,
+     .flags = VSH_OFLAG_REQ_OPT,
      .completer = virshCompleteEmpty,
      .help = N_("group name to share I/O quota between multiple drives")
     },
@@ -1317,6 +1331,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "total-bytes-sec-max-length",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("duration in seconds to allow total max bytes")
     },
     {.name = "read_bytes_sec_max_length",
@@ -1325,6 +1340,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "read-bytes-sec-max-length",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("duration in seconds to allow read max bytes")
     },
     {.name = "write_bytes_sec_max_length",
@@ -1333,6 +1349,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "write-bytes-sec-max-length",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("duration in seconds to allow write max bytes")
     },
     {.name = "total_iops_sec_max_length",
@@ -1341,6 +1358,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "total-iops-sec-max-length",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("duration in seconds to allow total I/O operations max")
     },
     {.name = "read_iops_sec_max_length",
@@ -1349,6 +1367,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "read-iops-sec-max-length",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("duration in seconds to allow read I/O operations max")
     },
     {.name = "write_iops_sec_max_length",
@@ -1357,6 +1376,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "write-iops-sec-max-length",
      .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("duration in seconds to allow write I/O operations max")
     },
     VIRSH_COMMON_OPT_DOMAIN_CONFIG,
-- 
2.44.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux