Re: AW: AW: [Users] Multiple bridge support

2008-07-10 Thread Kir Kolyshkin
I don't quite get it. Is it supposed to be a replacement for vznetaddbr, 
an addition to it, or is it orthogonal to it? Who and when calls vznetaddbr?


Dietmar Maurer wrote:

Hi Kir,

  
Von: Kir Kolyshkin [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 03. Juli 2008 13:35

An: users@openvz.org; Dietmar Maurer
Betreff: Re: AW: [Users] Multiple bridge support

How do you invoke it? Using EXTERNAL_SCRIPT?

Would be good to have a patch adding (conditional?) 
invocation of vznetaddbr to vznetcfg.



One idea was to add a new global option in vz.conf:

DEF_BRIDGE=

If set, we automatically setup the bridge (we need to pass an additional
parameter to vznetcfg, but i guess thats no problem at all). That also
avoid a hardcoded default bridge name (vmbr0).

Here is the totally untested code. If you like the idea I will test it
;-)

---
#!/bin/sh
CONFIGFILE='@PKGCONFDIR@/vz.conf'

[ -f $CONFIGFILE ] . $CONFIGFILE

VZNETCFG='@PKGCONFDIR@/vznet.conf'

[ -f $VZNETCFG ]  . $VZNETCFG

usage()
{
echo 2 vznetcfg init veth dev [bridge]
}

init_veth()
{
local dev=$1
local bridge=$2

if [ -n $DEV_BRIDGE ]; then
if [ ! -n $bridge ]; then
bridge=$DEV_BRIDGE
fi
echo Adding interface $dev to bridge $bridge on CT0 for
CT$VEID
/sbin/ifconfig $dev 0
echo 1  /proc/sys/net/ipv4/conf/$dev/proxy_arp
echo 1  /proc/sys/net/ipv4/conf/$dev/forwarding
/usr/sbin/brctl addif $bridge $dev
else
ip link set $dev up
fi
}

# Call the external script if defined
if [ -n $EXTERNAL_SCRIPT -a -x $EXTERNAL_SCRIPT ]; then
export VEID
exec $EXTERNAL_SCRIPT $@
fi

if test $# -le 2; then
usage
exit 0
fi

CMD=$1
case $CMD$2 in
initveth)
if test $# -le 3; then
usage
exit 1
fi

init_veth $3 $4
;;
*)
echo invalid action
exit 1
;;
esac
exit 0


  


___
Users mailing list
Users@openvz.org
https://openvz.org/mailman/listinfo/users


AW: AW: AW: [Users] Multiple bridge support

2008-07-10 Thread Dietmar Maurer
 I don't quite get it. Is it supposed to be a replacement for 
 vznetaddbr, an addition to it, or is it orthogonal to it? Who 
 and when calls vznetaddbr?

It merges vznetaddbr into vznetcfg, making
vznetaddbr obsolete.

- Dietmar


___
Users mailing list
Users@openvz.org
https://openvz.org/mailman/listinfo/users


AW: AW: [Users] Multiple bridge support

2008-07-06 Thread Dietmar Maurer
 It would be just great if you can provide a patch to vzctl 
 man page describing the new parameter, and the according wiki 
 modifications/additions.

Here is the patch for the man page.

I am not sure how to edit the wiki. Howto indicate
that the feature is only available in newest version
from git. Can I use 'version  3.0.22' ?

- Dietmar


vzctl.8.diff
Description: vzctl.8.diff
___
Users mailing list
Users@openvz.org
https://openvz.org/mailman/listinfo/users


AW: AW: [Users] Multiple bridge support

2008-07-03 Thread Dietmar Maurer
Hi Kir,

 Von: Kir Kolyshkin [mailto:[EMAIL PROTECTED] 
 Gesendet: Donnerstag, 03. Juli 2008 13:35
 An: users@openvz.org; Dietmar Maurer
 Betreff: Re: AW: [Users] Multiple bridge support
 
 How do you invoke it? Using EXTERNAL_SCRIPT?
 
 Would be good to have a patch adding (conditional?) 
 invocation of vznetaddbr to vznetcfg.

One idea was to add a new global option in vz.conf:

DEF_BRIDGE=

If set, we automatically setup the bridge (we need to pass an additional
parameter to vznetcfg, but i guess thats no problem at all). That also
avoid a hardcoded default bridge name (vmbr0).

Here is the totally untested code. If you like the idea I will test it
;-)

---
#!/bin/sh
CONFIGFILE='@PKGCONFDIR@/vz.conf'

[ -f $CONFIGFILE ] . $CONFIGFILE

VZNETCFG='@PKGCONFDIR@/vznet.conf'

[ -f $VZNETCFG ]  . $VZNETCFG

usage()
{
echo 2 vznetcfg init veth dev [bridge]
}

init_veth()
{
local dev=$1
local bridge=$2

if [ -n $DEV_BRIDGE ]; then
if [ ! -n $bridge ]; then
bridge=$DEV_BRIDGE
fi
echo Adding interface $dev to bridge $bridge on CT0 for
CT$VEID
/sbin/ifconfig $dev 0
echo 1  /proc/sys/net/ipv4/conf/$dev/proxy_arp
echo 1  /proc/sys/net/ipv4/conf/$dev/forwarding
/usr/sbin/brctl addif $bridge $dev
else
ip link set $dev up
fi
}

# Call the external script if defined
if [ -n $EXTERNAL_SCRIPT -a -x $EXTERNAL_SCRIPT ]; then
export VEID
exec $EXTERNAL_SCRIPT $@
fi

if test $# -le 2; then
usage
exit 0
fi

CMD=$1
case $CMD$2 in
initveth)
if test $# -le 3; then
usage
exit 1
fi

init_veth $3 $4
;;
*)
echo invalid action
exit 1
;;
esac
exit 0


___
Users mailing list
Users@openvz.org
https://openvz.org/mailman/listinfo/users