[sos-devel] [PATCH V2] plugin/ipmitool : Add usb interface if available instead of using default interface

Mukesh Ojha mukesh02 at linux.vnet.ibm.com
Thu Dec 1 17:32:00 UTC 2016


SOSREPORT generally uses the default interface (/dev/ipmi0) while
executing ipmitool command, which is quite slow as compare to
usb interface.

This usb interface uses the virtual device exposed from BMC like 
in OpenPower system AMI exposes virtual USB interface. IPMITOOL
command with usb interface sends the data to the kernel drivers
which inturn sends it to the BMC. 

This patch enables ipmitool command to use usb interface if available.

With this patch:
================
root at ubuntu1604:/home/mukesh/sos# ./sosreport --config sos.conf -o ipmitool
sosreport (version 3.2)

This command will collect system configuration and diagnostic
information from this Ubuntu system. An archive containing the collected
information will be generated in /tmp/sos.TF8N8E.

For more information on Ubuntu visit:

  http://www.ubuntu.com/

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.

Press ENTER to continue, or CTRL-C to quit.

Please enter your first initial and last name [ubuntu1604]: 
Please enter the case id that you are generating this report for []: 

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Running 1/1: ipmitool...        

Creating compressed archive...

Your sosreport has been generated and saved in:
  /tmp/sosreport-ubuntu1604-20161130110402.tar.xz

The checksum is: adfdbc8475874d7ad1077a3d2eda151b

Please send this file to your support representative.

root at ubuntu1604:/home/mukesh/sos# tar -xvf /tmp/sosreport-ubuntu1604-20161130110402.tar.xz
sosreport-ubuntu1604-20161130110402/
sosreport-ubuntu1604-20161130110402/version.txt
sosreport-ubuntu1604-20161130110402/sos_reports/
sosreport-ubuntu1604-20161130110402/sos_reports/sos.txt
sosreport-ubuntu1604-20161130110402/sos_reports/sos.html
sosreport-ubuntu1604-20161130110402/sos_commands/
sosreport-ubuntu1604-20161130110402/sos_commands/ipmitool/
sosreport-ubuntu1604-20161130110402/sos_commands/ipmitool/ipmitool_-I_usb_sel_list
sosreport-ubuntu1604-20161130110402/sos_commands/ipmitool/ipmitool_-I_usb_sdr_info
sosreport-ubuntu1604-20161130110402/sos_commands/ipmitool/ipmitool_-I_usb_chassis_status
sosreport-ubuntu1604-20161130110402/sos_commands/ipmitool/ipmitool_-I_usb_fru_print
sosreport-ubuntu1604-20161130110402/sos_commands/ipmitool/ipmitool_-I_usb_sensor_list
sosreport-ubuntu1604-20161130110402/sos_commands/ipmitool/ipmitool_-I_usb_sel_info
sosreport-ubuntu1604-20161130110402/sos_commands/ipmitool/ipmitool_-I_usb_mc_info
sosreport-ubuntu1604-20161130110402/sos_logs/
sosreport-ubuntu1604-20161130110402/sos_logs/ui.log
sosreport-ubuntu1604-20161130110402/sos_logs/sos.log

Signed-off-by: Mukesh Ojha <mukesh02 at linux.vnet.ibm.com>
---
Changes in V2:
  - Used existing wrapper instead of subprocess.
  - Removed camelCase for identifier.

 sos/plugins/ipmitool.py | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/sos/plugins/ipmitool.py b/sos/plugins/ipmitool.py
index 6c9c531..381273f 100644
--- a/sos/plugins/ipmitool.py
+++ b/sos/plugins/ipmitool.py
@@ -13,6 +13,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+import subprocess
 from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
 
 
@@ -26,14 +27,22 @@ class IpmiTool(Plugin, RedHatPlugin, DebianPlugin):
     packages = ('ipmitool',)
 
     def setup(self):
+        result = self.get_command_output("ipmitool -I usb mc info")
+        have_usbintf = result['status']
+
+        if not have_usbintf:
+            cmd = "ipmitool -I usb"
+        else:
+            cmd = "ipmitool"
+
         self.add_cmd_output([
-            "ipmitool sel info",
-            "ipmitool sel list",
-            "ipmitool sensor list",
-            "ipmitool chassis status",
-            "ipmitool fru print",
-            "ipmitool mc info",
-            "ipmitool sdr info"
+            "%s sel info" % cmd,
+            "%s sel list" % cmd,
+            "%s sensor list" % cmd,
+            "%s chassis status" % cmd,
+            "%s fru print" % cmd,
+            "%s mc info" % cmd,
+            "%s sdr info" % cmd
         ])
 
 # vim: set et ts=4 sw=4 :
-- 
2.7.4




More information about the sos-devel mailing list