[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Moved SuSE-specific getcfg call into a preiftransfer call. The semantics of



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 25639d30d5d5018758ad8e13004e084ea8c75016
# Parent  52f17d78dcd50fb4f7b8596f291dcd2e075ccacb
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@xxxxxxxxxxxxx>

diff -r 52f17d78dcd5 -r 25639d30d5d5 tools/examples/network-bridge
--- a/tools/examples/network-bridge     Mon Oct 24 17:24:07 2005
+++ b/tools/examples/network-bridge     Tue Oct 25 10:22:47 2005
@@ -208,7 +208,7 @@
 
     if ip link show ${vdev} 2>/dev/null >/dev/null; then
        mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether 
\(..:..:..:..:..:..\).*/\1/'`
-       eval `/sbin/getcfg -d /etc/sysconfig/network/ -f ifcfg- -- ${netdev}`
+       preiftransfer ${netdev}
        transfer_addrs ${netdev} ${vdev}
        if ! ifdown ${netdev}; then
            # if ifup didn't work, see if we have an ip= on cmd line
@@ -231,7 +231,7 @@
        ip link set ${bridge} up
        ip link set ${vif0} up
        ip link set ${pdev} up 
-       if ! ifup ${HWD_CONFIG_0} ${netdev} ; then
+       if ! ifup ${netdev} ; then
            if [ ${kip} ] ; then
                # use the addresses we grocked from /proc/cmdline
                if [ -z "${kmask}" ]; then 
diff -r 52f17d78dcd5 -r 25639d30d5d5 tools/examples/xen-network-common.sh
--- a/tools/examples/xen-network-common.sh      Mon Oct 24 17:24:07 2005
+++ b/tools/examples/xen-network-common.sh      Tue Oct 25 10:22:47 2005
@@ -16,11 +16,40 @@
 #
 
 
-# Gentoo doesn't have ifup/ifdown: define appropriate alternatives
-if ! which ifup >&/dev/null
+# On SuSE it is necessary to run a command before transfering addresses and
+# routes from the physical interface to the virtual.  This command creates a
+# variable $HWD_CONFIG_0 that specifies the appropriate configuration for
+# ifup.
+
+# Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives.
+
+# Other platforms just use ifup / ifdown directly.
+
+##
+# preiftransfer
+#
+# @param $1 The current name for the physical device, which is also the name
+#           that the virtual device will take once the physical device has
+#           been renamed.
+
+if [ -e /etc/SuSE-release ]
+then
+  preiftransfer()
+  {
+    eval `/sbin/getcfg -d /etc/sysconfig/network/ -f ifcfg- -- $1`
+  }
+  ifup()
+  {
+    /sbin/ifup ${HWD_CONFIG_0} $1
+  }
+elif ! which ifup >&/dev/null
 then
   if [ -e /etc/conf.d/net ]
   then
+    preiftransfer()
+    {
+      true
+    }
     ifup()
     {
       /etc/init.d/net.$1 start
@@ -34,4 +63,9 @@
       "You don't have ifup and don't seem to be running Gentoo either!"
     exit 1
   fi
+else
+  preiftransfer()
+  {
+    true
+  }
 fi

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.