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

Andrew Beekhof andrew at beekhof.net
Mon Feb 15 18:06:28 EST 2010


On Mon, Feb 15, 2010 at 11:58 PM, Angus Salkeld <asalkeld at redhat.com> wrote:
> 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)

I suspect you'll probably want this elsewhere too... perhaps we want
something more like:

patterns.append(self.CM["Pat:They_stopped"] %(other,
self.CM.key_for_node(node)))

where self.CM.key_for_node() does whatever mapping is needed.

>
>
> 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()
>
>
> _______________________________________________
> Pacemaker mailing list
> Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
>




More information about the Pacemaker mailing list