Blame SOURCES/sos-bz997094-Added-XFS-plugin.patch

6b17e9
commit dc11544c78dda4625cb6d985f6e1d76036ba6faf
6b17e9
Author: Pierguido Lambri <plambri@redhat.com>
6b17e9
Date:   Sat Jul 6 21:21:42 2013 +0100
6b17e9
6b17e9
    Added XFS plugin
6b17e9
    
6b17e9
    Signed-off-by: Pierguido Lambri <plambri@redhat.com>
6b17e9
6b17e9
diff --git a/sos/plugins/xfs.py b/sos/plugins/xfs.py
6b17e9
new file mode 100644
6b17e9
index 0000000..fe84b03
6b17e9
--- /dev/null
6b17e9
+++ b/sos/plugins/xfs.py
6b17e9
@@ -0,0 +1,40 @@
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
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
6b17e9
+import os
6b17e9
+import re
6b17e9
+from itertools import *
6b17e9
+
6b17e9
+class Xfs(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
6b17e9
+    """information on the XFS filesystem
6b17e9
+    """
6b17e9
+
6b17e9
+    plugin_name = 'xfs'
6b17e9
+
6b17e9
+    option_list = [("logprint", 'gathers the log information', 'slow', False)]
6b17e9
+
6b17e9
+    def setup(self):
6b17e9
+        mounts = '/proc/mounts'
6b17e9
+        ext_fs_regex = r"^(/dev/.+).+xfs\s+"
6b17e9
+        for dev in izip(self.do_regex_find_all(ext_fs_regex, mounts)):
6b17e9
+            for e in dev:
6b17e9
+                parts = e.split(' ')
6b17e9
+                self.add_cmd_output("xfs_info %s" % (parts[1]))
6b17e9
+
6b17e9
+        if self.get_option('logprint'):
6b17e9
+            for dev in izip(self.do_regex_find_all(ext_fs_regex, mounts)):
6b17e9
+                for e in dev:
6b17e9
+                    parts = e.split(' ')
6b17e9
+                    self.add_cmd_output("xfs_logprint -c %s" % (parts[0]))