howto auto add VE veth to a HN bridge upon VE startup?[Solved] [message #16419] |
Wed, 05 September 2007 19:13 ![Go to next message Go to next message](/theme/ovz3/images/down.png) |
piavlo
Messages: 159 Registered: January 2007
|
Senior Member |
|
|
I have one specific VE with veth device, i want
that during this VE startup ,after the veth device is created,
on VE0 (i.e. HN) this veth will be added as bridge interface.
This should happen before the internal VE network ralter init.d scripts are started.
All I've found is POST_CREATE parameter which points
/etc/vz/dists/scripts/postcreate.sh which is run in VE0,
but is' unclear to me what runs first the postcreate.sh in VE0
or the specific VE init.d scripts?
Also on gentoo wiki i found a similar way to auto mount/umount
partitions then VE starts up with /etc/vz/conf/vps.mount and
/etc/vz/conf/vps.umount or <VPS-ID>.mount and <VPS-ID>.umount
scripts (did not find a detailed info on how this works)
Maybe there is a similar way to auto add veth VE device to VE0 bridge?
Thanks
Alex
[Updated on: Mon, 17 September 2007 11:29] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: howto auto add VE veth to a HN bridge upon VE startup? [message #20225 is a reply to message #20062] |
Thu, 13 September 2007 13:30 ![Go to previous message Go to previous message](/theme/ovz3/images/up.png) ![Go to next message Go to next message](/theme/ovz3/images/down.png) |
khorenko
Messages: 533 Registered: January 2006 Location: Moscow, Russia
|
Senior Member |
|
|
ok, i have good news for you.
When you add a veth device to the bridge manually it (veth101.0 interface) is already in the UP state.
At the same time when the script /etc/vz/veth.bridge.addif runs veth101.0 is still down cause avahi-daemon hasn't brought it UP yet. Thus brctl adds downed interface into the bridge and that's why veth doesn't work.
To correct this it's enough to add a line to the /etc/vz/veth.bridge.addif:
if [ ! -n "$VZHOSTIF" ]; then
echo "According to $CONFIGFILE VE$VEID has no veth interface configured."
exit 1
fi
+ ifconfig veth${VEID}.0 0
brctl addif dmzbr0 veth${VEID}.0
exit $?
If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
|
|
|
|
|
Re: howto auto add VE veth to a HN bridge upon VE startup? [message #20358 is a reply to message #20319] |
Mon, 17 September 2007 09:29 ![Go to previous message Go to previous message](/theme/ovz3/images/up.png) ![Go to next message Go to next message](/theme/ovz3/images/down.png) |
khorenko
Messages: 533 Registered: January 2006 Location: Moscow, Russia
|
Senior Member |
|
|
piavlo wrote on Sun, 16 September 2007 16:07 | OK just found out the vznetcfg script which sources the vznet.conf file, and runs EXTERNAL_SCRIPT prior to bringing the veth device up.
|
Alex, you are right that vznetcfg brings up the veth device in case of EXTERNAL_SCRIPT variable is empty. But it doesn't run EXTERNAL_SCRIPT _prior_ to bringing the veth device up, if EXTERNAL_SCRIPT is filled it (EXTERNAL_SCRIPT) is executed instead of vznetcfg normal configuration. It was by design - in theory the administrator can write down his own network start up script and it should not depend on what vznetcfg does (cause it can and i suppose it will change its behaviour).
Konstantin.
If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
|
|
|
Re: howto auto add VE veth to a HN bridge upon VE startup? [message #20359 is a reply to message #20358] |
Mon, 17 September 2007 09:39 ![Go to previous message Go to previous message](/theme/ovz3/images/up.png) |
piavlo
Messages: 159 Registered: January 2007
|
Senior Member |
|
|
finist wrote on Mon, 17 September 2007 11:29 |
piavlo wrote on Sun, 16 September 2007 16:07 | OK just found out the vznetcfg script which sources the vznet.conf file, and runs EXTERNAL_SCRIPT prior to bringing the veth device up.
|
Alex, you are right that vznetcfg brings up the veth device in case of EXTERNAL_SCRIPT variable is empty. But it doesn't run EXTERNAL_SCRIPT _prior_ to bringing the veth device up, if EXTERNAL_SCRIPT is filled it (EXTERNAL_SCRIPT) is executed instead of vznetcfg normal configuration. It was by design - in theory the administrator can write down his own network start up script and it should not depend on what vznetcfg does (cause it can and i suppose it will change its behaviour).
Konstantin.
|
Yes of course you are right , in a rush i did not notice the exec in exec ${EXTERNAL_SCRIPT} $@
Thanks
|
|
|