[Pacemaker] [PATCH cts] add a wrapper function for "Pat:They_Stopped"
Andrew Beekhof
andrew at beekhof.net
Tue Feb 16 15:27:48 EST 2010
Applied!
http://hg.clusterlabs.org/pacemaker/devel/rev/5e20c1b2585f
Btw. if you do hg export, you'll also get credit for the patch in the history :)
On Tue, Feb 16, 2010 at 12:34 AM, Angus Salkeld <asalkeld at redhat.com> wrote:
> On Tue, 2010-02-16 at 00:06 +0100, Andrew Beekhof wrote:
>> 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.
>
> Good idea. Here is a better patch.
>
> -Angus
>
> 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-16 10:13:18.338818764 +1100
> @@ -404,6 +404,9 @@
> self.ShouldBeStatus={}
> self.ns = NodeStatus(self.Env)
>
> + def key_for_node(self, node):
> + return 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 10:27:54.343789269 +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["Pat:They_stopped"] %(other, self.CM.key_for_node(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["Pat:They_stopped"] %(other, self.CM.key_for_node(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["Pat:They_stopped"] % (node, self.CM.key_for_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