[Linux-cluster] rg_test for testing other resource agent functions?

Lon Hohberger lhh at redhat.com
Mon Mar 7 21:49:19 UTC 2011

On Fri, Mar 04, 2011 at 02:49:23PM -0500, Ofer Inbar wrote:
> For example, I want to add a "verify" procedure to my resource agent,
> that I'd like to kick off from a monitoring script on my own schedule,
> but I want to make sure that it is run in the same context as the
> resource agent's status check is normally run.  I could write some
> separate cluster.conf parser that simulates what I think rgmanager
> would do, but I might get it wrong.  Or rgmanager might change in a
> future version and I wouldn't track the change.

rg_test exposes the operations rgmanager performs.

rgmanager doesn't actually call 'validate-all' - it expects RAs to do
this, or at least report when parameters are invalid if
start/status/stop operations are called.

> Is there anything like rg_test that might let me do this, or has
> anyone patched rg_test to allow it?  Something as simple as:
>   sudo rg_test test /etc/cluster/cluster.conf [foo] service [servicename]

rgmanager does implicit start/status/stop ordering based on service tree
structures, which is why those are the only operations that are
currently done.

> .. where it would simply call the resource agent the same way as it
> does for status/start/stop, but substitute whatever command line
> argument I give it.

You could just do:

  OCF_RESKEY_x=y OCF_RESKEY_a=b /path/to/agent.sh <operation>

> Or do I have to reverse-engineer my own cluster.conf parsing to set up
> the environment and run the script(s) myself (duplicating what rg_test
> already does for status/start/stop) ?

Pacemaker has ocf-tester as well; maybe that would be useful?

I have a tool that will flatten a cluster.conf for you, resolving
rgmanager's entire resource tree structure and flattening the result.

Lon Hohberger - Red Hat, Inc.

More information about the Linux-cluster mailing list