[Openais] lcr take 6 - going in soon - last chance for comments :)

Steven Dake scd at broked.org
Thu Jan 26 21:42:37 PST 2006


Patrick,

I have had a deeper look at this patch and still intend to apply it.  I
have thought over the past few weeks how to enable pluggable
configuration systems.  This post are my ramblings on that subject :)

One possible problem I have with the patch is that I intend to totally
remove "struct openais_config" from the handlers.h file (in fact, make
openais_config static and private to main.c).  I want totally dynamic
service handlers, without handlers having to know anything about
specific configuration file formats or the like.

I was considering two changes after this patch is merged.

First, we would make an interface for the configuration system that
would allow it to be dynamically loaded.  Then either openais's default
config system could be loaded, or if a better configuration parser were
available, like RedHat's configuration system, it could be loaded.

The question, then, is what does the interface that we create look
like?  At a minimum, there should be a way to obtain a key/value pair
from the configuration for a section.  That "configuration reader"
interface would be passed to the exec_init_fn so it could obtain
key/value pairs for its particular service from the configuration
reader.

For the existing openais service handlers (except for amf), we need
something basic like
"readkey (char *section, char *key, void *context, int (*parser)(void
*context))"
or:
readkey ("totem", "bindnet", &this_ip, totem_ip_parser); where
totem_ip_parser is a c function for parsing an ip (or there could be
string_parse, or hex_parse, or int_parse, or whatever) and this_ip is
the target of the data to be read with the readkey function.

This doesn't work for nested data, however.  For that we probably need
something more complicated with iterators and the like.

What do you need for cman or other service handlers for the openais
core?  Your help in defining an interface would be appreciated.. :)

Could you support an lcrso interface like this for the redhat
configuration system?

Regards
-steve

On Wed, 2006-01-25 at 09:04, Patrick Caulfield wrote:
> Steven Dake wrote:
> > 
> > Yes I want to do this - just have not got there yet.  What I had
> > intended is for "uic" to send a message to "uis" to load a service
> > handler.  uis on startup creates a thread to listen to socket I/Os from
> > uic.  Then code in the UIS handler would dynamically load the service
> > handler.
> > 
> > So the command would look something like
> > "passthrough load service "servicename" and then the interface loader
> > would try to load the service and instantiate it.
> > 
> > This should work for already running aisexecs.
> > 
> > I don't really want to have to change the lcr code much to achieve these
> > results so scanning all lcrsos for their interface names doesn't work.
> > I want to "dynamicize" all of the code, not just the service handlers.
> > And The intent is that others could use the lcrsos in their own program
> > designs.  The purpose of the lcr then is to live-replace, not dynamic
> > loading (we just get that for free:)
> > 
> > Another option you mention which I like is to extract the "dynamic
> > services" data structure into a configuration file which lists all of
> > the services and their version numbers that should be loaded at startup.
> > This would then populate the dynamic services data structure.
> > 
> > If you want to make a patch for that I'd like it :)
> 
> Attached.
> 
> I've also added a config_init_fn to allow components to affect the
> configuration of the daemon. Only CMAN currently uses this but it paves the
> way for other plugin configurators. The normal config file will be used if no
> interfaces have been set by the components.
> 
> Of course there's a chicken-and-egg situation here in that you need to add
> configurators via the config file so you still need a config file! but there
> are still things read from openais.conf that precede all module loading anyway!
> 
> components can be added to the /etc/ais/openais.conf like this:
> 
> components {
>         openais_evs:0
>         openais_clm:0
>         openais_amf:0
>         openais_ckpt:0
>         openais_evt:0
>         openais_lck:0
>         openais_msg:0
>         openais_cfg:0
> }
> 
> where 0 is the version. If none are specified then the defaults (above) are
> used, otherwise the config file should specify all components to be used




More information about the Openais mailing list