[Pacemaker] [PATCH cts] add a wrapper function for "Pat:They_Stopped"

Angus Salkeld asalkeld at redhat.com
Mon Feb 15 22:58:42 UTC 2010


Hi

I am using CTS for testing corosync (no pacemaker) and need this
as corosync doesn't know about hostnames only ip addresses.

So in my Corosync class I can do the following:

    def getPatTheyStopped (self, other, node):
        node_ip = socket.gethostbyname (node)
        return self["Pat:They_stopped"] %(other, node_ip)


Regards
-Angus Salkeld


diff -Nur Pacemaker-1-0-3043c9539eca/cts/CTS.py Pacemaker-1-0-1ddefe5f1353/cts/CTS.py
--- Pacemaker-1-0-3043c9539eca/cts/CTS.py	2010-02-16 07:12:09.000000000 +1100
+++ Pacemaker-1-0-1ddefe5f1353/cts/CTS.py	2010-02-15 20:16:27.289151904 +1100
@@ -404,6 +404,9 @@
         self.ShouldBeStatus={}
         self.ns = NodeStatus(self.Env)
 
+    def getPatTheyStopped(self, other, node):
+        return self.CM["Pat:They_stopped"] %(other, node)
+
     def errorstoignore(self):
         '''Return list of errors which are 'normal' and should be ignored'''
         return []
diff -Nur Pacemaker-1-0-3043c9539eca/cts/CTStests.py Pacemaker-1-0-1ddefe5f1353/cts/CTStests.py
--- Pacemaker-1-0-3043c9539eca/cts/CTStests.py	2010-02-16 07:12:09.000000000 +1100
+++ Pacemaker-1-0-1ddefe5f1353/cts/CTStests.py	2010-02-16 09:43:06.728844951 +1100
@@ -490,7 +490,7 @@
         # NOTE: This wont work if we have multiple partitions
         for other in self.CM.Env["nodes"]:
             if self.CM.ShouldBeStatus[other] == "up" and other != node:
-                patterns.append(self.CM["Pat:They_stopped"] %(other, node))
+                patterns.append(self.CM.getPatTheyStopped(other, node))
                 #self.debug("Checking %s will notice %s left"%(other, node))
                 
         watch = CTS.LogWatcher(
@@ -1398,7 +1398,7 @@
             # Make sure the node goes down and then comes back up if it should reboot...
             for other in self.CM.Env["nodes"]:
                 if other != node:
-                    self.patterns.append(self.CM["Pat:They_stopped"] %(other, node))
+                    self.patterns.append(self.CM.getPatTheyStopped(other, node))
             self.patterns.append(self.CM["Pat:Slave_started"] % node)
             self.patterns.append(self.CM["Pat:Local_started"] % node)
 
@@ -2019,7 +2019,7 @@
             else:
                 for stopping in stopset:
                     if self.CM.ShouldBeStatus[stopping] == "up":
-                        watchpats.append(self.CM["Pat:They_stopped"] % (node, stopping))
+                        watchpats.append(self.CM.getPatTheyStopped(node, stopping))
                 
         if len(watchpats) == 0:
             return self.skipped()

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cts-they-stopped.patch
Type: text/x-patch
Size: 2230 bytes
Desc: not available
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20100216/24e9fc60/attachment-0001.bin>


More information about the Pacemaker mailing list