[lxc-devel] [PATCH] add lxc.network.script(.pre|.post|) configuration hooks

Stefan Tomanek stefan.tomanek at wertarbyte.de
Fri Oct 8 15:06:09 UTC 2010


Dies schrieb Daniel Lezcano (daniel.lezcano at free.fr):

> Are we sure, we want to add these hooks (pre and post) ? I am not 
> against adding them, but IMO it is more sane to add them if needed 
> rather than adding something which may not be used.

Well, until now, there was not a single hook, although I desperately
needed one. And there are probably people out there who might use
these hooks and are not able to add them for themselves.

> Wouldn't preferable to have these two hooks:
> 
>      lxc.network.script.up
>      lxc.network.script.down
> 
> (script parameter will need 'name', 'conf section' 'up' | 'down' ...

I still advise to split the hooks into generic ones and those specific
to the network type. The parameters passed to a script configuring a veth
device will be completely different than those passed to a macvlan device;
generic commands can then be placed in a different script, while special
commands can be handled in specific scripts.

I'd at least propose to use two hooks for setting up the interface, on being called
in instanciate_* (.up?), passing the arguments suitable to that network type, as well as
one generic (.post-up?)

> If there is a need for a pre or post hook, we can easily add later:

Sure, _we_ probably can, but not the person who might need the patch. There are quite
many sysadmins who are masters at shell scripting, but are unable to add such a hook
to a C codebase. Not being able to extend the system in an easy fashion would be a huge
show stopper for them, just as the lack of scripting was to me.

> > +			return -1;
> > +		} else {
> > +			return 1; /* all is well */
> >    
> 
> The convention is '0' means 'no error', why do you return 1 here ?

Oh, I probably got the exit codes mixed up, I'll fix it...
-- 
- Wertarbyte EDV-Dienstleistungen -
  Stefan Tomanek
  WWW:     http://wertarbyte.de/
  E-Mail:  kontakt at wertarbyte.de




More information about the lxc-devel mailing list