Blame SOURCES/sos-bz1025236-add-powerpc-plugin.patch

6b17e9
commit dac86b921fafecc81fbd492af177d9260cddfe20
6b17e9
Author: Bryn M. Reeves <bmr@redhat.com>
6b17e9
Date:   Wed Oct 30 13:57:22 2013 +0000
6b17e9
6b17e9
    This patch defines a new PowerPC Plugin to collect generic Power logs.
6b17e9
    Based on further platform checks,IBM Power System specific logs and
6b17e9
    commands will be collected. This would help IBM Power system users to
6b17e9
    collect system data in one shot by running sosreport.
6b17e9
    
6b17e9
    Signed-off-by: Bharani C.V. <bharanve@linux.vnet.ibm.com>
6b17e9
    Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
6b17e9
    Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
6b17e9
    
6b17e9
    ---
6b17e9
     sos/plugins/powerpc.py |   73 ++++++++++++++++++++++++++++++++++++++++++++++++
6b17e9
     1 file changed, 73 insertions(+)
6b17e9
     create mode 100644 sos/plugins/powerpc.py
6b17e9
6b17e9
diff --git a/sos/plugins/powerpc.py b/sos/plugins/powerpc.py
6b17e9
new file mode 100644
6b17e9
index 0000000..974baa1
6b17e9
--- /dev/null
6b17e9
+++ b/sos/plugins/powerpc.py
6b17e9
@@ -0,0 +1,73 @@
6b17e9
+### This program is free software; you can redistribute it and/or modify
6b17e9
+## it under the terms of the GNU General Public License as published by
6b17e9
+## the Free Software Foundation; either version 2 of the License, or
6b17e9
+## (at your option) any later version.
6b17e9
+
6b17e9
+## This program is distributed in the hope that it will be useful,
6b17e9
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
6b17e9
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6b17e9
+## GNU General Public License for more details.
6b17e9
+
6b17e9
+## You should have received a copy of the GNU General Public License
6b17e9
+## along with this program; if not, write to the Free Software
6b17e9
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6b17e9
+
6b17e9
+## This plugin enables collection of logs for Power systems and more
6b17e9
+## specific logs for Pseries, PowerNV platforms.
6b17e9
+
6b17e9
+import os
6b17e9
+from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
6b17e9
+
6b17e9
+class PowerPC(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
6b17e9
+    """IBM Power System related information
6b17e9
+    """
6b17e9
+
6b17e9
+    plugin_name = 'powerpc'
6b17e9
+
6b17e9
+    def check_enabled(self):
6b17e9
+	return (self.policy().get_arch() == "ppc64")
6b17e9
+
6b17e9
+    def setup(self):
6b17e9
+	try:
6b17e9
+		with open('/proc/cpuinfo', 'r') as fp:
6b17e9
+			contents = fp.read()
6b17e9
+			ispSeries = "pSeries" in contents
6b17e9
+			isPowerNV = "PowerNV" in contents
6b17e9
+	except:
6b17e9
+		ispSeries = False
6b17e9
+		isPowerNV = False
6b17e9
+
6b17e9
+	if ispSeries or isPowerNV:
6b17e9
+		self.add_copy_spec("/proc/device-tree/")
6b17e9
+		self.add_copy_spec("/proc/loadavg")
6b17e9
+		self.add_copy_spec("/proc/locks")
6b17e9
+		self.add_copy_spec("/proc/misc")
6b17e9
+		self.add_copy_spec("/proc/swaps")
6b17e9
+		self.add_copy_spec("/proc/version")
6b17e9
+		self.add_copy_spec("/dev/nvram")
6b17e9
+		self.add_copy_spec("/var/log/platform")
6b17e9
+		self.add_cmd_output("ppc64_cpu --smt")
6b17e9
+		self.add_cmd_output("ppc64_cpu --cores-present")
6b17e9
+		self.add_cmd_output("ppc64_cpu --cores-on")
6b17e9
+		self.add_cmd_output("ppc64_cpu --run-mode")
6b17e9
+		self.add_cmd_output("ppc64_cpu --frequency")
6b17e9
+		self.add_cmd_output("ppc64_cpu --dscr")
6b17e9
+
6b17e9
+	if ispSeries:
6b17e9
+		self.add_copy_spec("/proc/ppc64/lparcfg")
6b17e9
+		self.add_copy_spec("/proc/ppc64/eeh")
6b17e9
+		self.add_copy_spec("/proc/ppc64/systemcfg")
6b17e9
+		self.add_cmd_output("lscfg -vp")
6b17e9
+		self.add_cmd_output("lsmcode -A")
6b17e9
+		self.add_cmd_output("lsvpd --debug")
6b17e9
+		self.add_cmd_output("lsvio -des")
6b17e9
+		self.add_cmd_output("servicelog --dump")
6b17e9
+		self.add_cmd_output("servicelog_notify --list")
6b17e9
+		self.add_cmd_output("usysattn")
6b17e9
+		self.add_cmd_output("usysident")
6b17e9
+		self.add_cmd_output("serv_config -l")
6b17e9
+		self.add_cmd_output("bootlist -m both -r")
6b17e9
+		self.add_cmd_output("lparstat -i")
6b17e9
+
6b17e9
+	if isPowerNV:
6b17e9
+		self.add_copy_spec("/proc/ppc64/")