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

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