From 6fe4ebf3efb5c1f6a93c05e8e9bedf6a2040af27 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Tue, 17 Jun 2014 19:35:33 +0100
Subject: [PATCH 09/17] [ctdb] Add plugin for Samba clustered databases

Backport of 253f7ae.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
 sos/plugins/ctdb.py | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 sos/plugins/ctdb.py

diff --git a/sos/plugins/ctdb.py b/sos/plugins/ctdb.py
new file mode 100644
index 0000000..02e6ac2
--- /dev/null
+++ b/sos/plugins/ctdb.py
@@ -0,0 +1,40 @@
+## Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves <bmr@redhat.com>
+### 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.
+
+import sos.plugintools
+
+class Ctdb(sos.plugintools.Pluginbase):
+    """Samba CTDB related information
+    """
+    packages = ('ctdb',)
+
+    def setup(self):
+        self.addCopySpec("/etc/sysconfig/ctdb")
+        self.addCopySpec("/etc/ctdb/public_addresses")
+        self.addCopySpec("/etc/ctdb/static-routes")
+        self.addCopySpec("/etc/ctdb/multipathd")
+        self.addCopySpec("/var/log/log.ctdb")
+
+        self.collectExtOutput("ctdb ip")
+        self.collectExtOutput("ctdb ping")
+        self.collectExtOutput("ctdb status")
+        self.collectExtOutput("ctdb ifaces")
+        self.collectExtOutput("ctdb listnodes")
+        self.collectExtOutput("ctdb listvars")
+        self.collectExtOutput("ctdb statistics")
+        self.collectExtOutput("ctdb getdbmap")
+
+
+# vim: et ts=4 sw=4
-- 
1.9.3

From 062582768bd4cb809423a749d4473cbcf82ee32d Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Tue, 17 Jun 2014 19:41:00 +0100
Subject: [PATCH 10/17] [ctdb] fix typo in ctdb class definition

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
 sos/plugins/ctdb.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sos/plugins/ctdb.py b/sos/plugins/ctdb.py
index 02e6ac2..82e7179 100644
--- a/sos/plugins/ctdb.py
+++ b/sos/plugins/ctdb.py
@@ -15,7 +15,7 @@
 
 import sos.plugintools
 
-class Ctdb(sos.plugintools.Pluginbase):
+class Ctdb(sos.plugintools.PluginBase):
     """Samba CTDB related information
     """
     packages = ('ctdb',)
-- 
1.9.3

From 3c6f1b36b1fb821cd365920ef086012e4f83f673 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Tue, 17 Jun 2014 19:44:09 +0100
Subject: [PATCH 11/17] [ctdb] use lowercase plugin class name

sos-2.2 does not allow capitalised plugin class names:

sosreport (version 2.2)

plugin ctdb.py does not install, skipping
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 23, in <module>
    sosreport(sys.argv[1:])
  File "/usr/lib/python2.6/site-packages/sos/sosreport.py", line 453, in sosreport
    pluginClass = importPlugin("sos.plugins." + plugbase, plugbase)
AttributeError: 'module' object has no attribute 'ctdb'

> /usr/lib/python2.6/site-packages/sos/helpers.py(39)importPlugin()
-> return getattr(plugin, name)
(Pdb)

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
 sos/plugins/ctdb.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sos/plugins/ctdb.py b/sos/plugins/ctdb.py
index 82e7179..c43c2f4 100644
--- a/sos/plugins/ctdb.py
+++ b/sos/plugins/ctdb.py
@@ -15,7 +15,7 @@
 
 import sos.plugintools
 
-class Ctdb(sos.plugintools.PluginBase):
+class ctdb(sos.plugintools.PluginBase):
     """Samba CTDB related information
     """
     packages = ('ctdb',)
-- 
1.9.3

