Blame SOURCES/tuna-cpuview.py-Omit-offline-cpus-in-socket_ids-list.patch

65d6ac
From 6e19631d5e5e27b28e02d0a3f612b95c56e9ba4c Mon Sep 17 00:00:00 2001
65d6ac
From: John Kacur <jkacur@redhat.com>
65d6ac
Date: Mon, 30 May 2016 12:57:44 +0200
65d6ac
Subject: [PATCH] tuna: cpuview.py: Omit offline cpus in socket_ids list
65d6ac
65d6ac
sysfy.py inserts None for offline cpus in class cpus, method reload, via
65d6ac
class cpu method reload.
65d6ac
65d6ac
This is potentially useful, so we don't want to change these classes.
65d6ac
However in cpuview.py - class cpuview, we don't want to display these
65d6ac
offline cpus, so we only need to recognize that the type None can be
65d6ac
returned and then skip over it.
65d6ac
65d6ac
This fixes Bugzilla 1036156
65d6ac
First detected on some ppc
65d6ac
65d6ac
./tuna-cmd.py
65d6ac
Traceback (most recent call last):
65d6ac
  File "./tuna-cmd.py", line 656, in <module>
65d6ac
    main()
65d6ac
  File "./tuna-cmd.py", line 650, in main
65d6ac
    app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered)
65d6ac
  File "/home/jkacur/tuna/tuna/tuna_gui.py", line 49, in __init__
65d6ac
    self.procview, self.irqview, cpus_filtered)
65d6ac
  File "/home/jkacur/tuna/tuna/gui/cpuview.py", line 253, in __init__
65d6ac
    socket_ids = [ int(id) for id in self.cpus.sockets.keys() ]
65d6ac
65d6ac
Signed-off-by: John Kacur <jkacur@redhat.com>
65d6ac
---
65d6ac
 tuna/gui/cpuview.py | 7 ++++++-
65d6ac
 1 file changed, 6 insertions(+), 1 deletion(-)
65d6ac
65d6ac
diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
65d6ac
index 41a3d9bbbfc3..c84ecd739c70 100755
65d6ac
--- a/tuna/gui/cpuview.py
65d6ac
+++ b/tuna/gui/cpuview.py
65d6ac
@@ -250,7 +250,12 @@ class cpuview:
65d6ac
 		self.irqview = irqview
65d6ac
 
65d6ac
 		vbox = window.get_child().get_child()
65d6ac
-		socket_ids = [ int(id) for id in self.cpus.sockets.keys() ]
65d6ac
+                socket_ids = []
65d6ac
+                for id in self.cpus.sockets.keys():
65d6ac
+                    try:
65d6ac
+                        socket_ids.append(int(id))
65d6ac
+                    except TypeError: # Skip over offline cpus - type None
65d6ac
+                        continue
65d6ac
 		socket_ids.sort()
65d6ac
 
65d6ac
 		self.nr_sockets = len(socket_ids)
65d6ac
-- 
65d6ac
2.4.11
65d6ac