From 3dfa7ee77b49cb9bce9e153754f5d31506917548 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Thu, 10 Jul 2014 20:00:17 +0100
Subject: [PATCH] [powerpc] backport plugin from upstream

---
 sos/plugins/powerpc.py | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)
 create mode 100644 sos/plugins/powerpc.py

diff --git a/sos/plugins/powerpc.py b/sos/plugins/powerpc.py
new file mode 100644
index 0000000..5d20976
--- /dev/null
+++ b/sos/plugins/powerpc.py
@@ -0,0 +1,90 @@
+### This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+## This plugin enables collection of logs for Power systems and more
+## specific logs for Pseries, PowerNV platforms.
+
+import os
+import sos.plugintools
+
+class powerpc(sos.plugintools.PluginBase):
+    """IBM Power System related information
+    """
+
+    files = ('/proc/device-tree',)
+
+    def setup(self):
+        try:
+            with open('/proc/cpuinfo', 'r') as fp:
+                contents = fp.read()
+                ispSeries = "pSeries" in contents
+                isPowerNV = "PowerNV" in contents
+        except:
+            ispSeries = False
+            isPowerNV = False
+
+        if ispSeries or isPowerNV:
+            self.addCopySpecs([
+                "/proc/device-tree/",
+                "/proc/loadavg",
+                "/proc/locks",
+                "/proc/misc",
+                "/proc/swaps",
+                "/proc/version",
+                "/dev/nvram",
+                "/var/lib/lsvpd/"
+            ])
+            self.collectExtOutputs([
+                "ppc64_cpu --smt",
+                "ppc64_cpu --cores-present",
+                "ppc64_cpu --cores-on",
+                "ppc64_cpu --run-mode",
+                "ppc64_cpu --frequency",
+                "ppc64_cpu --dscr",
+                "lscfg -vp",
+                "lsmcode -A",
+                "lsvpd --debug"
+            ])
+
+        if ispSeries:
+            self.addCopySpecs([
+                "/proc/ppc64/lparcfg",
+                "/proc/ppc64/eeh",
+                "/proc/ppc64/systemcfg",
+                "/var/log/platform"
+            ])
+            self.collectExtOutputs([
+                "lsvio -des",
+                "servicelog --dump",
+                "servicelog_notify --list",
+                "usysattn",
+                "usysident",
+                "serv_config -l",
+                "bootlist -m both -r",
+                "lparstat -i"
+            ])
+
+        if isPowerNV:
+            self.addCopySpecs([
+                "/proc/ppc64/eeh",
+                "/proc/ppc64/systemcfg"
+                "/proc/ppc64/topology_updates"
+                "/sys/firmware/opal/msglog",
+                "/var/log/opal-elog/"
+            ])
+            if os.path.isdir("/var/log/dump"):
+                self.collectExtOutput("ls -l /var/log/dump")
+
+
+# vim: et ts=4 sw=4
-- 
1.9.3

