|
|
629484 |
From 186b3317b1e8562bbbd7dddd191b8ab73d664d5c Mon Sep 17 00:00:00 2001
|
|
|
629484 |
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
|
629484 |
Date: Fri, 31 Jan 2014 15:08:28 +0000
|
|
|
629484 |
Subject: [PATCH] Fix cluster module crm_report support
|
|
|
629484 |
|
|
|
629484 |
The cluster plugin used an obsolete sos-2.2 method to determine
|
|
|
629484 |
the command output directory. This causes an excaption at runtime
|
|
|
629484 |
since the referenced properties no longer exist.
|
|
|
629484 |
|
|
|
629484 |
The crm_report script also expects a --from date and will not
|
|
|
629484 |
collect data unless this is passed. Default to passing a value 72
|
|
|
629484 |
hours before the current time and add a 'crm_from' option to the
|
|
|
629484 |
cluster module to allow the user to override this.
|
|
|
629484 |
|
|
|
629484 |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
629484 |
---
|
|
|
629484 |
sos/plugins/cluster.py | 27 +++++++++++++++++++--------
|
|
|
629484 |
1 file changed, 19 insertions(+), 8 deletions(-)
|
|
|
629484 |
|
|
|
629484 |
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py
|
|
|
629484 |
index 50e0e0b..c2ce42b 100644
|
|
|
629484 |
--- a/sos/plugins/cluster.py
|
|
|
629484 |
+++ b/sos/plugins/cluster.py
|
|
|
629484 |
@@ -13,16 +13,17 @@
|
|
|
629484 |
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
629484 |
|
|
|
629484 |
from sos.plugins import Plugin, RedHatPlugin
|
|
|
629484 |
-import re
|
|
|
629484 |
+import re, os
|
|
|
629484 |
from glob import glob
|
|
|
629484 |
+from datetime import datetime, timedelta
|
|
|
629484 |
|
|
|
629484 |
class Cluster(Plugin, RedHatPlugin):
|
|
|
629484 |
"""cluster suite and GFS related information
|
|
|
629484 |
"""
|
|
|
629484 |
|
|
|
629484 |
plugin_name = 'cluster'
|
|
|
629484 |
- option_list = [("gfslockdump",
|
|
|
629484 |
- 'gather output of gfs lockdumps', 'slow', False),
|
|
|
629484 |
+ option_list = [("gfslockdump", 'gather output of gfs lockdumps', 'slow', False),
|
|
|
629484 |
+ ("crm_from", 'specify the --from parameter passed to crm_report', 'fast', False),
|
|
|
629484 |
('lockdump', 'gather dlm lockdumps', 'slow', False)]
|
|
|
629484 |
|
|
|
629484 |
packages = [
|
|
|
629484 |
@@ -83,9 +84,21 @@ class Cluster(Plugin, RedHatPlugin):
|
|
|
629484 |
self.add_cmd_output("dlm_tool dump")
|
|
|
629484 |
self.add_cmd_output("dlm_tool ls -n")
|
|
|
629484 |
self.add_cmd_output("mkqdisk -L")
|
|
|
629484 |
- crm_dest = os.path.join(self.cInfo['cmddir'],
|
|
|
629484 |
- self.name(), 'crm_report')
|
|
|
629484 |
- self.collectExtOutput("crm_report -S --dest %s" % crm_dest)
|
|
|
629484 |
+ # crm_report needs to be given a --from "YYYY-MM-DD HH:MM:SS" start
|
|
|
629484 |
+ # time in order to collect data.
|
|
|
629484 |
+ crm_from = (datetime.today()
|
|
|
629484 |
+ - timedelta(hours=72)).strftime("%Y-%m-%d %H:%m:%S")
|
|
|
629484 |
+ if self.get_option('crm_from') != False:
|
|
|
629484 |
+ if re.match(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}',
|
|
|
629484 |
+ str(self.getOption('crm_from'))):
|
|
|
629484 |
+ crm_from = self.getOption('crm_from')
|
|
|
629484 |
+ else:
|
|
|
629484 |
+ self.soslog.error("crm_from parameter '%s' is not a valid date"
|
|
|
629484 |
+ % self.getOption('crm_from'))
|
|
|
629484 |
+
|
|
|
629484 |
+ crm_dest = os.path.join(self.get_cmd_dir(), 'crm_report')
|
|
|
629484 |
+ self.add_cmd_output('crm_report -S -d --dest %s --from "%s"'
|
|
|
629484 |
+ % (crm_dest, crm_from))
|
|
|
629484 |
|
|
|
629484 |
def do_lockdump(self):
|
|
|
629484 |
status, output, time = self.call_ext_prog("dlm_tool ls")
|
|
|
629484 |
--
|
|
|
629484 |
1.7.11.7
|
|
|
629484 |
|