]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Add group name to blkdeviotune output
authorJohn Ferlan <jferlan@redhat.com>
Sun, 2 Oct 2016 12:42:31 +0000 (08:42 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 5 Dec 2016 23:30:38 +0000 (18:30 -0500)
https://bugzilla.redhat.com/show_bug.cgi?id=1336564

Add the ability to set/display the group_name for block device iotune

Signed-off-by: John Ferlan <jferlan@redhat.com>
tools/virsh-domain.c
tools/virsh.pod

index e359bfc8328b62b514243b03415725d9b1d5849d..3a6fa5c700b839eb7a63609cf938f25f294349ba 100644 (file)
@@ -1263,6 +1263,10 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
      .type = VSH_OT_INT,
      .help = N_("I/O size in bytes")
     },
+    {.name = "group_name",
+     .type = VSH_OT_STRING,
+     .help = N_("group name to share I/O quota between multiple drives")
+    },
     {.name = "total_bytes_sec_max_length",
      .type = VSH_OT_ALIAS,
      .help = "total-bytes-sec-max-length"
@@ -1322,6 +1326,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
 {
     virDomainPtr dom = NULL;
     const char *name, *disk;
+    const char *group_name = NULL;
     unsigned long long value;
     int nparams = 0;
     int maxparams = 0;
@@ -1393,6 +1398,18 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
     VSH_ADD_IOTUNE(write-iops-sec-max-length, WRITE_IOPS_SEC_MAX_LENGTH);
 #undef VSH_ADD_IOTUNE
 
+    rv = vshCommandOptStringReq(ctl, cmd, "group_name", &group_name);
+    if (rv < 0) {
+        vshError(ctl, "%s", _("Unable to parse group parameter"));
+        goto cleanup;
+    } else if (rv > 0) {
+        if (virTypedParamsAddString(&params, &nparams, &maxparams,
+                                    VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME,
+                                    group_name) < 0)
+            goto save_error;
+    }
+
+
     if (nparams == 0) {
         if (virDomainGetBlockIoTune(dom, NULL, NULL, &nparams, flags) != 0) {
             vshError(ctl, "%s",
index 247d2357b7076d57595be85697168f4045c66de1..6b838eea44d2aefeb9a79e0561b26d43397c142a 100644 (file)
@@ -1139,7 +1139,7 @@ command.
 [I<read-bytes-sec-max-length>] [I<write-bytes-sec-max-length>]]
 [[I<total-iops-sec-max-length>] |
 [I<read-iops-sec-max-length>] [I<write-iops-sec-max-length>]]
-[I<size-iops-sec>]
+[I<size-iops-sec>] [I<group_name>]
 
 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
@@ -1179,6 +1179,9 @@ read I/O operations limit.
 I<--write-iops-sec-max-length> specifies duration in seconds to allow maximum
 write I/O operations limit.
 I<--size-iops-sec> specifies size I/O operations limit per second.
+I<--group_name> specifies group name to share I/O quota between multiple drives.
+For a qemu domain, if no name is provided, then the default is to have a single
+group for each I<device>.
 
 Older versions of virsh only accepted these options with underscore
 instead of dash, as in I<--total_bytes_sec>.