[libvirt] [PATCH v2] Don't print extra newline in virsh domstats output

Nitesh Konkar posted 1 patch 7 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1486739082-5613-1-git-send-email-niteshkonkar.libvirt@gmail.com
tools/virsh-domain-monitor.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
[libvirt] [PATCH v2] Don't print extra newline in virsh domstats output
Posted by Nitesh Konkar 7 years, 2 months ago
Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
---
virsh domstats --perf
Domain: 'Fedora123'
  perf.cache_misses=394986

Domain: 'Fedora'
  perf.cache_misses=447017

virsh domstats
Domain: 'Fedora123'
  state.state=1
  state.reason=1
  cpu.time=562472167198
  cpu.user=228340000000
  cpu.system=303250000000
  balloon.current=1048576
  balloon.maximum=1048576
  perf.cache_misses=634012

Domain: 'Fedora'
  state.state=1
  state.reason=1
  cpu.time=19303277561180
  cpu.user=5634250000000
  cpu.system=9536140000000
  balloon.current=1048576
  balloon.maximum=1048576
  perf.cache_misses=699207

 tools/virsh-domain-monitor.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 77aa272..901a6eb 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -2047,7 +2047,6 @@ virshDomainStatsPrintRecord(vshControl *ctl ATTRIBUTE_UNUSED,
         VIR_FREE(param);
     }
 
-    vshPrint(ctl, "\n");
     return true;
 }
 
@@ -2145,9 +2144,13 @@ cmdDomstats(vshControl *ctl, const vshCmd *cmd)
            goto cleanup;
     }
 
-    for (next = records; *next; next++) {
+    next = records;
+    while (*next) {
         if (!virshDomainStatsPrintRecord(ctl, *next, raw))
             goto cleanup;
+
+        if (*(++next))
+            vshPrint(ctl, "\n");
     }
 
     ret = true;
-- 
1.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Don't print extra newline in virsh domstats output
Posted by Nitesh Konkar 7 years, 1 month ago
Polite PIng.

On Fri, Feb 10, 2017 at 8:34 PM, Nitesh Konkar <
niteshkonkar.libvirt@gmail.com> wrote:

> Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
> ---
> virsh domstats --perf
> Domain: 'Fedora123'
>   perf.cache_misses=394986
>
> Domain: 'Fedora'
>   perf.cache_misses=447017
>
> virsh domstats
> Domain: 'Fedora123'
>   state.state=1
>   state.reason=1
>   cpu.time=562472167198
>   cpu.user=228340000000
>   cpu.system=303250000000
>   balloon.current=1048576
>   balloon.maximum=1048576
>   perf.cache_misses=634012
>
> Domain: 'Fedora'
>   state.state=1
>   state.reason=1
>   cpu.time=19303277561180
>   cpu.user=5634250000000
>   cpu.system=9536140000000
>   balloon.current=1048576
>   balloon.maximum=1048576
>   perf.cache_misses=699207
>
>  tools/virsh-domain-monitor.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
> index 77aa272..901a6eb 100644
> --- a/tools/virsh-domain-monitor.c
> +++ b/tools/virsh-domain-monitor.c
> @@ -2047,7 +2047,6 @@ virshDomainStatsPrintRecord(vshControl *ctl
> ATTRIBUTE_UNUSED,
>          VIR_FREE(param);
>      }
>
> -    vshPrint(ctl, "\n");
>      return true;
>  }
>
> @@ -2145,9 +2144,13 @@ cmdDomstats(vshControl *ctl, const vshCmd *cmd)
>             goto cleanup;
>      }
>
> -    for (next = records; *next; next++) {
> +    next = records;
> +    while (*next) {
>          if (!virshDomainStatsPrintRecord(ctl, *next, raw))
>              goto cleanup;
> +
> +        if (*(++next))
> +            vshPrint(ctl, "\n");
>      }
>
>      ret = true;
> --
> 1.9.3
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Don't print extra newline in virsh domstats output
Posted by John Ferlan 7 years, 1 month ago

On 02/10/2017 10:04 AM, Nitesh Konkar wrote:
> Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
> ---
> virsh domstats --perf
> Domain: 'Fedora123'
>   perf.cache_misses=394986
> 
> Domain: 'Fedora'
>   perf.cache_misses=447017
> 
> virsh domstats
> Domain: 'Fedora123'
>   state.state=1
>   state.reason=1
>   cpu.time=562472167198
>   cpu.user=228340000000
>   cpu.system=303250000000
>   balloon.current=1048576
>   balloon.maximum=1048576
>   perf.cache_misses=634012
> 
> Domain: 'Fedora'
>   state.state=1
>   state.reason=1
>   cpu.time=19303277561180
>   cpu.user=5634250000000
>   cpu.system=9536140000000
>   balloon.current=1048576
>   balloon.maximum=1048576
>   perf.cache_misses=699207
> 
>  tools/virsh-domain-monitor.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 

ACK (and pushed),

John

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