ia64/xen-unstable

changeset 7521:25639d30d5d5

Moved SuSE-specific getcfg call into a preiftransfer call. The semantics of
this aren't beautiful, but this gets the distro-specific code out of the body
of the network-bridge script and into a common place, while still preserving
the existing code behaviour.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Tue Oct 25 11:22:47 2005 +0100 (2005-10-25)
parents 52f17d78dcd5
children f2ad4e0a7259
files tools/examples/network-bridge tools/examples/xen-network-common.sh
line diff
     1.1 --- a/tools/examples/network-bridge	Mon Oct 24 18:24:07 2005 +0100
     1.2 +++ b/tools/examples/network-bridge	Tue Oct 25 11:22:47 2005 +0100
     1.3 @@ -208,7 +208,7 @@ op_start () {
     1.4  
     1.5      if ip link show ${vdev} 2>/dev/null >/dev/null; then
     1.6  	mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'`
     1.7 -	eval `/sbin/getcfg -d /etc/sysconfig/network/ -f ifcfg- -- ${netdev}`
     1.8 +	preiftransfer ${netdev}
     1.9  	transfer_addrs ${netdev} ${vdev}
    1.10  	if ! ifdown ${netdev}; then
    1.11  	    # if ifup didn't work, see if we have an ip= on cmd line
    1.12 @@ -231,7 +231,7 @@ op_start () {
    1.13  	ip link set ${bridge} up
    1.14  	ip link set ${vif0} up
    1.15  	ip link set ${pdev} up 
    1.16 -	if ! ifup ${HWD_CONFIG_0} ${netdev} ; then
    1.17 +	if ! ifup ${netdev} ; then
    1.18  	    if [ ${kip} ] ; then
    1.19  		# use the addresses we grocked from /proc/cmdline
    1.20  		if [ -z "${kmask}" ]; then 
     2.1 --- a/tools/examples/xen-network-common.sh	Mon Oct 24 18:24:07 2005 +0100
     2.2 +++ b/tools/examples/xen-network-common.sh	Tue Oct 25 11:22:47 2005 +0100
     2.3 @@ -16,11 +16,40 @@
     2.4  #
     2.5  
     2.6  
     2.7 -# Gentoo doesn't have ifup/ifdown: define appropriate alternatives
     2.8 -if ! which ifup >&/dev/null
     2.9 +# On SuSE it is necessary to run a command before transfering addresses and
    2.10 +# routes from the physical interface to the virtual.  This command creates a
    2.11 +# variable $HWD_CONFIG_0 that specifies the appropriate configuration for
    2.12 +# ifup.
    2.13 +
    2.14 +# Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives.
    2.15 +
    2.16 +# Other platforms just use ifup / ifdown directly.
    2.17 +
    2.18 +##
    2.19 +# preiftransfer
    2.20 +#
    2.21 +# @param $1 The current name for the physical device, which is also the name
    2.22 +#           that the virtual device will take once the physical device has
    2.23 +#           been renamed.
    2.24 +
    2.25 +if [ -e /etc/SuSE-release ]
    2.26 +then
    2.27 +  preiftransfer()
    2.28 +  {
    2.29 +    eval `/sbin/getcfg -d /etc/sysconfig/network/ -f ifcfg- -- $1`
    2.30 +  }
    2.31 +  ifup()
    2.32 +  {
    2.33 +    /sbin/ifup ${HWD_CONFIG_0} $1
    2.34 +  }
    2.35 +elif ! which ifup >&/dev/null
    2.36  then
    2.37    if [ -e /etc/conf.d/net ]
    2.38    then
    2.39 +    preiftransfer()
    2.40 +    {
    2.41 +      true
    2.42 +    }
    2.43      ifup()
    2.44      {
    2.45        /etc/init.d/net.$1 start
    2.46 @@ -34,4 +63,9 @@ then
    2.47        "You don't have ifup and don't seem to be running Gentoo either!"
    2.48      exit 1
    2.49    fi
    2.50 +else
    2.51 +  preiftransfer()
    2.52 +  {
    2.53 +    true
    2.54 +  }
    2.55  fi