[lxc-devel] RfC: Script hooks

Andrian Nord nightnord at gmail.com
Sat Jan 9 13:00:41 UTC 2010


On Sat, Jan 09, 2010 at 09:20:59AM +0100, Michael Holzt wrote:
> I believe it would be nice it it was able to hook scripts in the process
> of container starting and stopping at some points, e.g. before starting
> or after pivot_root but before giving over to the container etc.
> 
> Why? For example i would like to run a script which setups ebtables rules
> restricting the network access of the container. I think there are other
> uses for such hooks as well.
> 
> Comments?
> 
> 
> Regards,
> Michael

One man, it was Mihail Tokarev, if I correctly remembered his name,
already stated, that whole config system could be replaced or
concatenated with shell-scripts-callbacks. Probably 'hooks' would be
great for many uses, but this require some kind of less or more unique
engine for handling hooks, which could be later inserted in any
position. But it may decreese perfomance dramatically.

I suggest config syntax like

lxc.hook.<hook_name> = <executable>

executable would be called with argument list specified by calling
function. There should be ability to use more than one executable per hook,
obviously.

Probably best way of calling hooks whould be using array indicies mapped
with macroses for readability. This will allow to minimize perfomance,
but will restrict usage of hooks engine only into lxc itself - it would
be impossible for upper packages (those, which are using liblxc) to
specify their own hooks. Still, usage of already defined hooks whould be
possible.




More information about the lxc-devel mailing list