[Pacemaker] How to stop a resource?

Tim Ward Tim.Ward at ipaccess.com
Thu Mar 15 09:47:06 EDT 2012


> From: Andreas Kurz [mailto:andreas at hastexo.com] 
> >>
> >> Maybe totally in the wrong direction for what you want but...
> >> Put commands in a script and add a until loop with a pgrep 
> test and 
> >> sleep 1 till the specific resource is stopped then continue?
> > 
> > Yes, probably is in the wrong direction. I'm driving this 
> from Java and have written an interface to the "crm" command, 
> which is how I was advised to get at Pacemaker from Java when 
> I enquired on this list.
> 
> I think your problem is, that a "crm resource stop" is 
> asynchronous ...
> it exits immediately, not waiting for the resource to stop eventually.

Is that what's happening? It's not what I expected from the documentation I was able to find.

> How about looping on "crm resource status _resource_" before deleting?

Clearly this is possible, but I'd have a few issues to sort out

- I'd have to write some code to parse the output of the status command, and hope that the syntax of this output doesn't change in future versions - or are there defined return strings or codes that I can guarantee to be able to rely on?

- I hate polling - it's just burning CPU cycles to no useful purpose, and whenever I see either polling or a "sleep" I suspect the design[#]

- this won't work for a resource killing itself, as it won't get a chance to do the delete as it won't still be there, whereas it *is* possible for a resource to kill itself it it throws everything at the crm command in one go

[#] Yes yes, I know I can write an SNMP trap receiver and avoid the polling that way. It's fairly low down my list of options though.

Tim Ward
Brett Ward Limited - www.brettward.co.uk  





This message contains confidential information and may be privileged. If you are not the intended recipient, please notify the sender and delete the message immediately.

ip.access Ltd, registration number 3400157, Building 2020, 
Cambourne Business Park, Cambourne, Cambridge CB23 6DW, United Kingdom




More information about the Pacemaker mailing list