[libvirt] [PATCH 3/5] virsh: Actually make blkdeviotune --group_name work

Martin Kletzander mkletzan at redhat.com
Wed Jan 25 09:16:12 UTC 2017


Function vshCommandOptStringReq() returns -1 on error and 0 on
success.  The code, however, used the 'group_name' variable only if it
returned 1 (never).

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 tools/virsh-domain.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 93587e8bc7c7..4360306989d8 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1398,11 +1398,12 @@ 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) {
+    if (vshCommandOptStringReq(ctl, cmd, "group_name", &group_name) < 0) {
         vshError(ctl, "%s", _("Unable to parse group parameter"));
         goto cleanup;
-    } else if (rv > 0) {
+    }
+
+    if (group_name) {
         if (virTypedParamsAddString(&params, &nparams, &maxparams,
                                     VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME,
                                     group_name) < 0)
-- 
2.11.0




More information about the libvir-list mailing list