[lxc-devel] [PATCH] add lxc.network.veth.script configuration hook

Daniel Lezcano daniel.lezcano at free.fr
Thu Oct 7 12:55:05 UTC 2010


On 10/07/2010 01:19 PM, Stefan Tomanek wrote:
>> I suggest you add a lxc.network.script section where it will be
>> called from each instanciate_*
>>      
> I thought about that, but I think that name is to generic - it might be
> useful to provide several different locations to call a script. In my case,
> the obvious location is the instanciation function, where the name of the
> host-facing veth device is available; for other purposes, the script should
> be called after the network configuration has been completed.
>
> So I'd propose to introduce a few new variables, e.g.
>
> lxc.network.script.pre          # called before network setup
> lxc.network.script.create       # called during instanciate_*
> lxc.network.script.post         # called after network setup
>    

  * lxc.network.script.pre:

IMO,  it does not make sense because that means it is the host itself 
which should be modified, so that fall under the host network 
configuration umbrella => administrator job :P

  * lxc.network.script.create

Ok

  * lxc.network.script.post

Do you have an example of use case. Does it hurt if we 'merge' the 
'post' and 'create' hooks and put the 'create' right after the virtual 
devices are created ? If it is done before, will fall in the same 'pre' 
hook case, no ?


As we have the create, we need the delete :)

  * lxc.network.script.delete


We have to pay attention to the configuration which allows to specify 
several networks.

eg.
lxc.network.type=veth
lxc.network.flags=up
lxc.network.script.create = myscript.sh
lxc.network.script.delete = myscript.sh

lxc.network.type.veth
lxc.network.flags=up
lxc.network.script.create = myscript.sh
lxc.network.script.delete = myscript.sh

The scripts should apply to the configuration 'br0' and br1, so it will 
called twice.
I think we should let the user to have a single script, instead of 
several small scripts (which is also possible) and we have to provide 
enough parameters to the script to let it know if it is 'create' or 
'delete' and 'br0' or 'br1'. That will be similar than the qemu-ifup, 
qemu-ifdown.











More information about the lxc-devel mailing list