[ClusterLabs] [rgmanager] generic 'initscript' resource agent that passes arguments?

Jan Pokorný jpokorny at redhat.com
Tue Sep 6 18:36:53 UTC 2016


On 29/08/16 13:41 -0400, bergman at merctech.com wrote:
> I've got a number of scripts that are based on LSB compliant scripts,
> but which also accept arguments & values. For example, a script to manage
> multiple virtual machines has a command-line in the form:
> 
> 	vbox_init --vmname $VMNAME [-d|--debug] [start|stop|status|restart]
> 
> I'd like to manage these services as cluster resources, ideally without
> modifying the existing (tested, functioning) init scripts.
> 
> For example, I do not want to create individual vbox_init script with
> hard-coded values for the virtual machine name (and I'd strongly prefer
> not to do a hack using $0 to lookup the vm name, as in calling the scripts
> "vbox_init.$NAME1" and "vbox_init.$NAME2", etc).
> 
> Similarly, I don't want to create individual resource agents with
> hard-coded values.
> 
> Is there an existing varient on the /usr/share/cluster/script.sh resource
> that enables passing arbitrary argument+value pairs and flags to the
> actual init script? Continuing the above example, the new resource
> ("scriptArgs") would appear in cluster.conf something like:
> 
>                 <resources>
>                         <scriptArgs file="/usr/local/etc/init.d/vbox_init" name="vbox_init"/>
>                 </resources>
> 
>                 <service max_restarts="2" name="fooBarVM" recovery="restart" restart_expire_time="180">
>                         <ip ref="192.168.1.123"/>
>                         <scriptArgs ref="vbox_init" args="--vmname fooBarVM">
>                 </service>
> 
>                 <service max_restarts="2" name="snafuVM" recovery="restart" restart_expire_time="180">
>                         <ip ref="192.168.1.222"/>
>                         <scriptArgs ref="vbox_init" args="--vmname snafuVM --debug">
>                 </service>

None that I know of.

Adapting script.sh to scriptArgs.sh working as desired should not
be a hard task, though.  Once you add such custom RA to the system
(i.e., across all nodes), supposing you have adapted produced
meta-data respectively, you should remember to run "ccs_update_schema"
so that any subsequent start of the cluster stack on the node or
modification via ccs utility will not fail due to unrecognized RA
if present in the to-apply configuration.

Note that the new agent will not get reflected in luci web UI
automatically, you would have to add a support on your own.

> I'm using CentOS6 and:
> 	cman-3.0.12.1-78.el6.x86_64
> 	luci-0.26.0-78.el6.centos.x86_64
> 	rgmanager-3.0.12.1-26.el6_8.3.x86_64
> 	ricci-0.16.2-86.el6.x86_64

-- 
Jan (Poki)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.clusterlabs.org/pipermail/users/attachments/20160906/18a037b6/attachment-0003.sig>


More information about the Users mailing list