Re: [lxc-devel] [PATCH] add lxc.network.script(.pre|.post|) configuration hooks
Stefan Tomanek wrote: Dies schrieb Michael Tokarev (m...@tls.msk.ru): [] 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. I know, but there might be a point in executing a point script before network configuration in general. I cannot thin of an example right now, but Debian has the same distinction for its network configuration. It occured to me too that you may be following debian network/interfaces. But this is something else: in the pre-up in debian you may want to load a NIC driver module for example, so that the interface actually appears and when it goes to the initialisation stage when ifup runs tools like ifconfig to configure the IP addresses, the interface is already here. In lxc, the whole 'pre-up' stage is always done by lxc tools (instantiating veth/macvlan/etc device), so there's just no pre-up stage at all. 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. It is during due to the fact that it is network type specific and gets called inside the instanciate_* (veth in this case) function. That is the only part where the host-facing interface name is known, so calling a general hook afterwards is of no use. Ok, I'll re-read the patch again... somehow I understand it completely differently... /mjt -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] add lxc.network.script(.pre|.post|) configuration hooks
Dies schrieb Michael Tokarev (m...@tls.msk.ru): I know, but there might be a point in executing a point script before network configuration in general. I cannot thin of an example right now, but Debian has the same distinction for its network configuration. It occured to me too that you may be following debian network/interfaces. But this is something else: in the pre-up in debian you may want to load a NIC driver module for example, so that the interface actually appears and when it goes to the initialisation stage when ifup runs tools like ifconfig to configure the IP addresses, the interface is already here. In lxc, the whole 'pre-up' stage is always done by lxc tools (instantiating veth/macvlan/etc device), so there's just no pre-up stage at all. pre-up is used for other purposes as well, I've written quit some extensions to Debian's ifupdown. WIFI-configuration takes place at that time. Your point assumes that the work done by LXC covers all cases of use; however, this is probably not the case - actually, the lack of decent veth configurability is my intention for this patch. Having an extra hook available, even if not used, will make it easier for admins to adapt their setup to their needs - and not having to re-learn C programming like I did in the last few days :-) -- - Wertarbyte EDV-Dienstleistungen - Stefan Tomanek WWW: http://wertarbyte.de/ E-Mail: kont...@wertarbyte.de -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] add lxc.network.script(.pre|.post|) configuration hooks
Dies schrieb Daniel Lezcano (daniel.lezc...@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: kont...@wertarbyte.de -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] add lxc.network.script(.pre|.post|) configuration hooks
Stefan Tomanek wrote: Dies schrieb Daniel Lezcano (daniel.lezc...@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. Note that the script may receive other parameters, depending on the type of the network device, just the first 3 are fixed. THere's also $ENVIRONMENT $VARIABLES for us. 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's a need, the specific script may call some common code/script by its own, or the reverse. There's no need to do that in lxc. Of if we do, how about adding a _set_ of scripts for each stage ? :) 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. There IS a trivial way to extend system already (when just ONE hook is implemented) - chain your scripts. There's no need to re-implement shell in lxc. /mjt -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] add lxc.network.script(.pre|.post|) configuration hooks
On 10/08/2010 05:13 PM, Michael Tokarev wrote: Stefan Tomanek wrote: Dies schrieb Daniel Lezcano (daniel.lezc...@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. Note that the script may receive other parameters, depending on the type of the network device, just the first 3 are fixed. THere's also $ENVIRONMENT $VARIABLES for us. 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's a need, the specific script may call some common code/script by its own, or the reverse. There's no need to do that in lxc. Of if we do, how about adding a _set_ of scripts for each stage ? :) 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. I am not a sysadmin, may be you are right, having the hooks available is good, but I am still not convinced they are needed. I am heavily using kvm, and with the two scripts qemu-ifup and qemu-ifdown I am quite happy :) Anything to be done before or after falls in /etc/network/interfaces. There IS a trivial way to extend system already (when just ONE hook is implemented) - chain your scripts. There's no need to re-implement shell in lxc. Michael, I am not sure I get the idea. Can you elaborate a bit ? In our case, we need the veth name which is available in instanciate_veth, no ? -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] add lxc.network.script(.pre|.post|) configuration hooks
08.10.2010 19:45, Daniel Lezcano wrote: [] There IS a trivial way to extend system already (when just ONE hook is implemented) - chain your scripts. There's no need to re-implement shell in lxc. Michael, I am not sure I get the idea. Can you elaborate a bit ? In our case, we need the veth name which is available in instanciate_veth, no ? I'm trying to say that one script is enough, that's basically it ;) Before (that makes no sense), During and After - just use one During, with all the proper names and other parameters. That calls a script, and that script is free to call other scripts at will. /mjt -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel