OpenVZ Forum


Home » General » Support » *SOLVED* Network script like vps.mount
Re: Network script like vps.mount [message #9762 is a reply to message #9758] Sat, 20 January 2007 02:14 Go to previous messageGo to previous message
larsks is currently offline  larsks
Messages: 3
Registered: January 2007
Junior Member
Vasily,

There's no documentation in vznetcfg itself, there's no man page, and it's not mentioned anywhere else in the documentation distributed with the vzctl package. So, for posterity:

vznetcfg (probably /usr/sbin/vznetcfg) is run by vzctl just after it creates the veth interfaces specified in your configuration. You can find the call in src/lib/veth.c in the vzctl distribution in the veth_ctl() function.

The script is called like this:

vznetcfg init veth <veth_device>


E.g.,

vznetcfg init veth veth101.0


The environment variable VEID contains the current VEID. Unlike other scripts, VE_CONFFILE is not available so you'll have to calculate it yourself if you need it. Vasily et al: wouldn't it be simpler to set up the environment in the run_script() function so that it's the same for all scripts?

The script is called once for each veth interface defined in your configuration file.

If you set EXTERNAL_SCRIPT in /etc/vz/vznet.conf, vznetcfg will call this script with whatever arguments were originally passed to vznetcfg.

The script is only called during startup -- if you need to do something special to unconfigure the interfaces you're on your own.

I'm using the following EXTERNAL_SCRIPT (the BRIDGE variable is set in the VE configuration file. I should probably make this settable per-interface, rather than per-VE):

#!/bin/sh

. /etc/vz/conf/${VEID}.conf

case $1 in
 (init) shift
  case $1 in
   (veth) shift
    dev=$1 
    if [ -n "$BRIDGE" ]; then
     echo "+ Adding $dev to bridge $BRIDGE."
     brctl addif $BRIDGE $1
    fi
    ;;
  esac
  ;;
esac

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Trouble starting/accessing Gentoo VPS
Next Topic: TCP stack virtualization
Goto Forum:
  


Current Time: Tue Aug 05 02:39:11 GMT 2025

Total time taken to generate the page: 2.29553 seconds