On Wed, Jan 12, 2011 at 1:47 PM, Apollon Oikonomopoulos <[email protected]> wrote: > In order to retain backwards compatibility, we ship the shell script > previously > generated by _WriteNetScript as a stand-alone script under PKGLIBDIR. The > script will be used for KVM instance network configuration in the absence of a > user-provided _KVM_NETWORK_SCRIPT. >
Should the code for overriding this script (the one that calls _KVM_NETWORK_SCRIPT) be in ganeti or in this script? > Signed-off-by: Apollon Oikonomopoulos <[email protected]> > --- > Makefile.am | 1 + > lib/constants.py | 1 + > tools/kvm-ifup | 45 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 47 insertions(+), 0 deletions(-) > create mode 100644 tools/kvm-ifup > > diff --git a/Makefile.am b/Makefile.am > index 458545f..8fc5db0 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -363,6 +363,7 @@ pkglib_python_scripts = \ > pkglib_SCRIPTS = \ > daemons/daemon-util \ > daemons/ensure-dirs \ > + tools/kvm-ifup \ > $(pkglib_python_scripts) > > EXTRA_DIST = \ > diff --git a/lib/constants.py b/lib/constants.py > index 16fb71d..b876876 100644 > --- a/lib/constants.py > +++ b/lib/constants.py > @@ -139,6 +139,7 @@ RAPI_USERS_FILE = DATA_DIR + "/rapi/users" > QUEUE_DIR = DATA_DIR + "/queue" > DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util" > SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh" > +KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup" > ETC_HOSTS = "/etc/hosts" > DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR > ENABLE_FILE_STORAGE = _autoconf.ENABLE_FILE_STORAGE > diff --git a/tools/kvm-ifup b/tools/kvm-ifup > new file mode 100644 > index 0000000..e600d6d > --- /dev/null > +++ b/tools/kvm-ifup > @@ -0,0 +1,45 @@ > +#!/bin/sh > + > +# Copyright (C) 2011 Google Inc. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 2 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, but > +# WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +# General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > +# 02110-1301, USA. > + > +ifconfig $INTERFACE 0.0.0.0 up > + should we use ip link set $INTERFACE up, nowadays? > +if [ "$NIC_MODE" == "bridged" ]; then > + # Connect the interface to the bridge > + brctl addif $BRIDGE $INTERFACE > +else > + # Route traffic targeted at the IP to the interface > + if [ -n "$LINK" ]; then > + while ip rule del dev $INTERFACE; do :; done > + ip rule add dev $INTERFACE table $LINK > + ip route replace $IP table $LINK proto static dev $INTERFACE > + > + else > + ip route replace $IP proto static dev $INTERFACE > + fi > + > + if [ -d "/proc/sys/net/ipv4/conf/$INTERFACE" ]; then > + echo 1 > /proc/sys/net/ipv4/conf/$INTERFACE/proxy_arp > + echo 1 > /proc/sys/net/ipv4/conf/$INTERFACE/forwarding > + fi > + > + if [ -d "/proc/sys/net/ipv6/conf/$INTERFACE" ]; then > + echo 1 > /proc/sys/net/ipv6/conf/$INTERFACE/proxy_ndp > + echo 1 > /proc/sys/net/ipv6/conf/$INTERFACE/forwarding > + fi > +fi Thanks, Guido
