[sos-devel] [PATCH v2] sosreport: Capture IBM Power RAID storage adapter configuration information

Aruna Balakrishnaiah aruna at linux.vnet.ibm.com
Fri Sep 19 05:53:25 UTC 2014


Capture information which helps in better understanding of
IBM Power RAID storage adapter configuration. Since iprconfig
is specific to power adding the relevant commands in powerpc plugin.

Signed-off-by: Aruna Balakrishnaiah <aruna at linux.vnet.ibm.com>
---
Since lsscsi lists all types of enclosures and we are interested just in
IBM Power RAID enclosures have relyed on iprconfig results. /sys or /proc
does not give enough information to determine if its a RAID enclosure or not.

Changes from v1:
	Move this to a separate plugin
        Use call_ext_prog
        Use iprconfig results to parse

 sos/plugins/powerpc_iprconfig.py |  116 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 sos/plugins/powerpc_iprconfig.py

diff --git a/sos/plugins/powerpc_iprconfig.py b/sos/plugins/powerpc_iprconfig.py
new file mode 100644
index 0000000..7d64bc5
--- /dev/null
+++ b/sos/plugins/powerpc_iprconfig.py
@@ -0,0 +1,116 @@
+# 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
+
+import os
+import re
+from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
+
+class iprconfig(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
+    """IBM Power RAID storage adapter configuration information
+    """
+
+    plugin_name = 'powerpc_iprconfig'
+
+    def check_enabled(self):
+        return (self.policy().get_arch() == "ppc64")
+
+    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.add_cmd_outputs([
+                "iprconfig -c show-config",
+                "iprconfig -c show-alt-config",
+                "iprconfig -c show-arrays",
+                "iprconfig -c show-jbod-disks",
+                "iprconfig -c show-ioas",
+            ])
+
+            iprconfig_result = self.call_ext_prog("iprconfig -c show-ioas")
+            if not (iprconfig_result['status'] == 0):
+                 return
+
+            iprconfig_output = iprconfig_result['output']
+            devices = []
+            if iprconfig_output:
+                for line in iprconfig_output.splitlines():
+                     temp = line.split(' ')
+                     p = re.compile('sg')
+                     # temp[0] holds the device name
+                     if p.search(temp[0]):
+                         devices.append(temp[0])
+
+            for device in devices:
+                self.add_cmd_output("iprconfig -c show-details %s" % (device,))
+
+            # Look for IBM Power RAID enclosures (iprconfig lists them)
+            ipr_result = self.call_ext_prog("iprconfig -c show-config")
+            if not (ipr_result['status'] == 0):
+                   return
+
+# iprconfig -c show-config
+# Name   PCI/SCSI Location         Description               Status
+# ------ ------------------------- ------------------------- -----------------
+#        0005:60:00.0/0:            PCI-E SAS RAID Adapter    Operational
+# sda    0005:60:00.0/0:0:0:0       Physical Disk             Active
+# sdb    0005:60:00.0/0:1:0:0       Physical Disk             Active
+# sdc    0005:60:00.0/0:2:0:0       Physical Disk             Active
+# sdd    0005:60:00.0/0:3:0:0       Physical Disk             Active
+# sde    0005:60:00.0/0:4:0:0       Physical Disk             Active
+# sdf    0005:60:00.0/0:5:0:0       Physical Disk             Active
+#        0005:60:00.0/0:8:0:0       Enclosure                 Active
+#        0005:60:00.0/0:8:1:0       Enclosure                 Active
+
+            ipr_output = ipr_result['output']
+            if ipr_output:
+               for line in ipr_output.splitlines():
+                  if "Enclosure" in line:
+                     temp = re.split('\s+', line)
+                     # temp[1] holds the PCI/SCSI location
+                     pci, scsi = temp[1].split('/')
+                     altconfig_result = self.call_ext_prog("iprconfig -c "
+                                                           "show-alt-config")
+                     if not (altconfig_result['status'] == 0):
+                         return
+
+# iprconfig -c show-alt-config
+# Name   Resource Path/Address      Vendor   Product ID       Status
+# ------ -------------------------- -------- ---------------- -----------------
+# sg9    0:                         IBM      57C7001SISIOA    Operational
+# sg0    0:0:0:0                    IBM      MBF2300RC        Active
+# sg1    0:1:0:0                    IBM      MBF2300RC        Active
+# sg2    0:2:0:0                    IBM      HUC106030CSS600  Active
+# sg3    0:3:0:0                    IBM      HUC106030CSS600  Active
+# sg4    0:4:0:0                    IBM      HUC106030CSS600  Active
+# sg5    0:5:0:0                    IBM      HUC106030CSS600  Active
+# sg7    0:8:0:0                    IBM      VSBPD6E4A  3GSAS Active
+# sg8    0:8:1:0                    IBM      VSBPD6E4B  3GSAS Active
+
+                     altconfig_output = altconfig_result['output']
+                     if altconfig_output:
+                        for line in altconfig_output.splitlines():
+                            if scsi in line:
+                               temp = line.split(' ')
+                               # temp[0] holds device name
+                               self.add_cmd_output("iprconfig -c "
+                                             "query-ses-mode %s" % (temp[0],))




More information about the sos-devel mailing list