Blame SOURCES/kvm-tools-kvm_stat-fix-misc-glitches.patch

4a2fec
From 8654f68785c5ddddfd92b8fd2b0e550481e3099c Mon Sep 17 00:00:00 2001
4a2fec
From: David Hildenbrand <david@redhat.com>
4a2fec
Date: Tue, 17 Oct 2017 19:15:30 +0200
4a2fec
Subject: [PATCH 25/69] tools/kvm_stat: fix misc glitches
4a2fec
MIME-Version: 1.0
4a2fec
Content-Type: text/plain; charset=UTF-8
4a2fec
Content-Transfer-Encoding: 8bit
4a2fec
4a2fec
RH-Author: David Hildenbrand <david@redhat.com>
4a2fec
Message-id: <20171017191605.2378-5-david@redhat.com>
4a2fec
Patchwork-id: 77313
4a2fec
O-Subject: [RHEL-7.5 qemu-kvm-rhev PATCH 04/39] tools/kvm_stat: fix misc glitches
4a2fec
Bugzilla: 1497137
4a2fec
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
4a2fec
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
4a2fec
Upstream-status: linux.git e0ba38765c1d1d670246d6f6c518594aa8e62587
4a2fec
4a2fec
commit e0ba38765c1d1d670246d6f6c518594aa8e62587
4a2fec
Author: Stefan Raspl <raspl@linux.vnet.ibm.com>
4a2fec
Date:   Fri Mar 10 13:40:03 2017 +0100
4a2fec
4a2fec
    tools/kvm_stat: fix misc glitches
4a2fec
4a2fec
    Addresses
4a2fec
    - eliminate extra import
4a2fec
    - missing variable initialization
4a2fec
    - type redefinition from int to float
4a2fec
    - passing of int type argument instead of string
4a2fec
    - a couple of PEP8-reported indentation/formatting glitches
4a2fec
    - remove unused variable drilldown in class Tui
4a2fec
4a2fec
    Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
4a2fec
    Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
4a2fec
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
4a2fec
4a2fec
Signed-off-by: David Hildenbrand <david@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 scripts/kvm/kvm_stat | 24 +++++++++++-------------
4a2fec
 1 file changed, 11 insertions(+), 13 deletions(-)
4a2fec
4a2fec
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
4a2fec
index 14536c0..231186a 100755
4a2fec
--- a/scripts/kvm/kvm_stat
4a2fec
+++ b/scripts/kvm/kvm_stat
4a2fec
@@ -31,7 +31,6 @@ import resource
4a2fec
 import struct
4a2fec
 import re
4a2fec
 from collections import defaultdict
4a2fec
-from time import sleep
4a2fec
 
4a2fec
 VMX_EXIT_REASONS = {
4a2fec
     'EXCEPTION_NMI':        0,
4a2fec
@@ -657,6 +656,7 @@ class DebugfsProvider(object):
4a2fec
         self._fields = self.get_available_fields()
4a2fec
         self._pid = 0
4a2fec
         self.do_read = True
4a2fec
+        self.paths = []
4a2fec
 
4a2fec
     def get_available_fields(self):
4a2fec
         """"Returns a list of available fields.
4a2fec
@@ -794,7 +794,6 @@ class Tui(object):
4a2fec
     def __init__(self, stats):
4a2fec
         self.stats = stats
4a2fec
         self.screen = None
4a2fec
-        self.drilldown = False
4a2fec
         self.update_drilldown()
4a2fec
 
4a2fec
     def __enter__(self):
4a2fec
@@ -950,11 +949,10 @@ class Tui(object):
4a2fec
         while True:
4a2fec
             self.refresh(sleeptime)
4a2fec
             curses.halfdelay(int(sleeptime * 10))
4a2fec
-            sleeptime = 3
4a2fec
+            sleeptime = 3.0
4a2fec
             try:
4a2fec
                 char = self.screen.getkey()
4a2fec
                 if char == 'x':
4a2fec
-                    self.drilldown = not self.drilldown
4a2fec
                     self.update_drilldown()
4a2fec
                 if char == 'q':
4a2fec
                     break
4a2fec
@@ -1064,12 +1062,12 @@ Requirements:
4a2fec
                          help='fields to display (regex)',
4a2fec
                          )
4a2fec
     optparser.add_option('-p', '--pid',
4a2fec
-                        action='store',
4a2fec
-                        default=0,
4a2fec
-                        type=int,
4a2fec
-                        dest='pid',
4a2fec
-                        help='restrict statistics to pid',
4a2fec
-                        )
4a2fec
+                         action='store',
4a2fec
+                         default=0,
4a2fec
+                         type='int',
4a2fec
+                         dest='pid',
4a2fec
+                         help='restrict statistics to pid',
4a2fec
+                         )
4a2fec
     (options, _) = optparser.parse_args(sys.argv)
4a2fec
     return options
4a2fec
 
4a2fec
@@ -1099,8 +1097,8 @@ def check_access(options):
4a2fec
                          "Also ensure, that the kvm modules are loaded.\n")
4a2fec
         sys.exit(1)
4a2fec
 
4a2fec
-    if not os.path.exists(PATH_DEBUGFS_TRACING) and (options.tracepoints
4a2fec
-                                                     or not options.debugfs):
4a2fec
+    if not os.path.exists(PATH_DEBUGFS_TRACING) and (options.tracepoints or
4a2fec
+                                                     not options.debugfs):
4a2fec
         sys.stderr.write("Please enable CONFIG_TRACING in your kernel "
4a2fec
                          "when using the option -t (default).\n"
4a2fec
                          "If it is enabled, make {0} readable by the "
4a2fec
@@ -1111,7 +1109,7 @@ def check_access(options):
4a2fec
 
4a2fec
         sys.stderr.write("Falling back to debugfs statistics!\n")
4a2fec
         options.debugfs = True
4a2fec
-        sleep(5)
4a2fec
+        time.sleep(5)
4a2fec
 
4a2fec
     return options
4a2fec
 
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec