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

Michael Tokarev mjt at tls.msk.ru
Fri Oct 8 12:08:59 UTC 2010


Stefan Tomanek wrote:
> This commit adds an configuration option to specify a script to be
> executed before, during and after creating or configuring the pair of
> veth devices.[...]

Why so many hooks?  Curious...

There's apparently no reason to run a script "before"
creating a netdev (pair).  Note that we don't even
know which names will be used for the netdevs, at
least in general case.

The "during" version makes no sense at all, in my
opinion anyway, because we're syncronous, and there's
no way to run something "during" the veth creation.
So it actually becomes either "before" or "after"
anyway.

What makes sense -- again, in my opinion - is just
one script that gets run after netdev creation and
initialisation (when all the configured IP addresses
were assigned and the like).

Other than that, the patch look sane.  Except of a
few changes at the end:

[]
> --- a/src/lxc/conf.h
> +++ b/src/lxc/conf.h
> @@ -221,8 +229,5 @@ extern void lxc_delete_tty(struct lxc_tty_info *tty_info);
>   * Configure the container from inside
>   */
>  
> -struct lxc_handler;
> -
>  extern int lxc_setup(const char *name, struct lxc_conf *lxc_conf);
> -
>  #endif
> --- a/src/lxc/start.c
> +++ b/src/lxc/start.c
> @@ -487,7 +487,7 @@ int lxc_spawn(struct lxc_handler *handler)
>  		/* that should be done before the clone because we will
>  		 * fill the netdev index and use them in the child
>  		 */
> -		if (lxc_create_network(&handler->conf->network)) {
> +		if (lxc_create_network(handler)) {
>  			ERROR("failed to create the network");
>  			lxc_sync_fini(handler);
>  			return -1;

The two changes appears to be unrelated to the script
hook config, and makes somewhat non-obvious changes...

The two should not be part of this patch.  In my
opinion anyway ;)

Thanks!

/mjt




More information about the lxc-devel mailing list