Blame SOURCES/kvm-tools-kvm_stat-print-error-messages-on-faulty-pid-fi.patch

9bac43
From 05cc1c1aab959dde7801cabe184c5f4b287835b6 Mon Sep 17 00:00:00 2001
9bac43
From: David Hildenbrand <david@redhat.com>
9bac43
Date: Tue, 17 Oct 2017 19:15:37 +0200
9bac43
Subject: [PATCH 32/69] tools/kvm_stat: print error messages on faulty pid
9bac43
 filter input
9bac43
MIME-Version: 1.0
9bac43
Content-Type: text/plain; charset=UTF-8
9bac43
Content-Transfer-Encoding: 8bit
9bac43
9bac43
RH-Author: David Hildenbrand <david@redhat.com>
9bac43
Message-id: <20171017191605.2378-12-david@redhat.com>
9bac43
Patchwork-id: 77321
9bac43
O-Subject: [RHEL-7.5 qemu-kvm-rhev PATCH 11/39] tools/kvm_stat: print error messages on faulty pid filter input
9bac43
Bugzilla: 1497137
9bac43
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9bac43
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
9bac43
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9bac43
9bac43
Upstream-status: linux.git 0152c20f0400498774ae56067f8076cef312abc7
9bac43
9bac43
commit 0152c20f0400498774ae56067f8076cef312abc7
9bac43
Author: Stefan Raspl <raspl@linux.vnet.ibm.com>
9bac43
Date:   Fri Mar 10 13:40:10 2017 +0100
9bac43
9bac43
    tools/kvm_stat: print error messages on faulty pid filter input
9bac43
9bac43
    Print helpful messages in case users enter invalid input or invalid pids in
9bac43
    the interactive pid filter dialogue.
9bac43
9bac43
    Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
9bac43
    Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
9bac43
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
9bac43
9bac43
Signed-off-by: David Hildenbrand <david@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 scripts/kvm/kvm_stat | 4 ++++
9bac43
 1 file changed, 4 insertions(+)
9bac43
9bac43
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
9bac43
index 9e9eb98..ced0cb9 100755
9bac43
--- a/scripts/kvm/kvm_stat
9bac43
+++ b/scripts/kvm/kvm_stat
9bac43
@@ -976,6 +976,7 @@ class Tui(object):
9bac43
         Asks for a pid until a valid pid or 0 has been entered.
9bac43
 
9bac43
         """
9bac43
+        msg = ''
9bac43
         while True:
9bac43
             self.screen.erase()
9bac43
             self.screen.addstr(0, 0,
9bac43
@@ -984,6 +985,7 @@ class Tui(object):
9bac43
             self.screen.addstr(1, 0,
9bac43
                                'This might limit the shown data to the trace '
9bac43
                                'statistics.')
9bac43
+            self.screen.addstr(5, 0, msg)
9bac43
 
9bac43
             curses.echo()
9bac43
             self.screen.addstr(3, 0, "Pid [0 or pid]: ")
9bac43
@@ -995,6 +997,7 @@ class Tui(object):
9bac43
                     pid = int(pid)
9bac43
                     if pid != 0 and not os.path.isdir(os.path.join('/proc/',
9bac43
                                                                    str(pid))):
9bac43
+                        msg = '"' + str(pid) + '": Not a running process'
9bac43
                         continue
9bac43
                 else:
9bac43
                     pid = 0
9bac43
@@ -1003,6 +1006,7 @@ class Tui(object):
9bac43
                 break
9bac43
 
9bac43
             except ValueError:
9bac43
+                msg = '"' + str(pid) + '": Not a valid pid'
9bac43
                 continue
9bac43
 
9bac43
     def show_stats(self):
9bac43
-- 
9bac43
1.8.3.1
9bac43