[PATCH] cmdPerf: Display enabled/disabled message on perf event enable/disable

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

 



Currently, the code to display enabled/disabled message is
a dead code as its misplaced in if block instead of else.
This patch fixes that issue.

Signed-off-by: Nitesh Konkar <nitkon12@xxxxxxxxxxxxxxxxxx>
---
 tools/virsh-domain.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 3a6fa5c..624a36a 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8891,18 +8891,19 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
             vshError(ctl, "%s", _("Unable to get perf events"));
             goto cleanup;
         }
-        for (i = 0; i < nparams; i++) {
-            if (params[i].type == VIR_TYPED_PARAM_BOOLEAN &&
-                params[i].value.b) {
-                vshPrint(ctl, "%-15s: %s\n", params[i].field, _("enabled"));
-            } else {
-                vshPrint(ctl, "%-15s: %s\n", params[i].field, _("disabled"));
-            }
-        }
     } else {
         if (virDomainSetPerfEvents(dom, params, nparams, flags) != 0) {
             vshError(ctl, "%s", _("Unable to enable/disable perf events"));
             goto cleanup;
+        } else {
+            for (i = 0; i < nparams; i++) {
+                if (params[i].type == VIR_TYPED_PARAM_BOOLEAN &&
+                    params[i].value.b) {
+                    vshPrint(ctl, "%-15s: %s\n", params[i].field, _("enabled"));
+                } else {
+                    vshPrint(ctl, "%-15s: %s\n", params[i].field, _("disabled"));
+                }
+            }
         }
     }
 
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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