From 0a1d0f551dbf9fe7180757714ec7fd7a492c6af1 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Tue, 8 Jul 2014 22:31:14 +0100 Subject: [cluster] list and function style fixes Signed-off-by: Bryn M. Reeves --- sos/plugins/cluster.py | 56 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py index 6a2354f0..c8240c3e 100644 --- a/sos/plugins/cluster.py +++ b/sos/plugins/cluster.py @@ -22,9 +22,11 @@ class Cluster(Plugin, RedHatPlugin): """ plugin_name = 'cluster' - option_list = [("gfslockdump", 'gather output of gfs lockdumps', 'slow', False), - ("crm_from", 'specify the --from parameter passed to crm_report', 'fast', False), - ('lockdump', 'gather dlm lockdumps', 'slow', False)] + option_list = [ + ("gfslockdump", 'gather output of gfs lockdumps', 'slow', False), + ("crm_from", 'specify the start time for crm_report', 'fast', False), + ('lockdump', 'gather dlm lockdumps', 'slow', False) + ] packages = [ "ricci", @@ -108,28 +110,42 @@ class Cluster(Plugin, RedHatPlugin): result = self.call_ext_prog(dlm_tool) if result['status'] != 0: return - for lockspace in re.compile(r'^name\s+([^\s]+)$', - re.MULTILINE).findall(result['output']): - self.add_cmd_output("dlm_tool lockdebug -svw '%s'" % lockspace, - suggest_filename = "dlm_locks_%s" % lockspace) + + lock_exp = r'^name\s+([^\s]+)$' + lock_re = re.compile(lock_exp, re.MULTILINE) + for lockspace in lock_re.findall(result['output']): + self.add_cmd_output( + "dlm_tool lockdebug -svw '%s'" % lockspace, + suggest_filename="dlm_locks_%s" % lockspace + ) def do_gfslockdump(self): - for mntpoint in self.do_regex_find_all(r'^\S+\s+([^\s]+)\s+gfs\s+.*$', - "/proc/mounts"): - self.add_cmd_output("gfs_tool lockdump %s" % mntpoint, - suggest_filename = "gfs_lockdump_" - + self.mangle_command(mntpoint)) + mnt_exp = r'^\S+\s+([^\s]+)\s+gfs\s+.*$' + for mnt in self.do_regex_find_all(mnt_exp, "/proc/mounts"): + self.add_cmd_output( + "gfs_tool lockdump %s" % mnt, + suggest_filename="gfs_lockdump_" + self.mangle_command(mnt) + ) def postproc(self): for cluster_conf in glob("/etc/cluster/cluster.conf*"): - self.do_file_sub(cluster_conf, - r"(\s*\