Commit 26916aad authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Guido Trotter

Ship default kvm-ifup script

In order to retain backwards compatibility, we ship the shell script previously
generated by _WriteNetScript as a stand-alone script under PKGLIBDIR.
Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 199b2053
......@@ -74,6 +74,9 @@
/man/*.in
/man/footer.man
# tools
/tools/kvm-ifup
# scripts
/scripts/gnt-backup
/scripts/gnt-cluster
......
......@@ -103,6 +103,7 @@ CLEANFILES = \
doc/examples/hooks/ipsec \
$(man_MANS) \
$(manhtml) \
tools/kvm-ifup \
stamp-srclinks \
$(nodist_pkgpython_PYTHON)
......@@ -364,6 +365,7 @@ pkglib_python_scripts = \
pkglib_SCRIPTS = \
daemons/daemon-util \
daemons/ensure-dirs \
tools/kvm-ifup \
$(pkglib_python_scripts)
EXTRA_DIST = \
......@@ -383,6 +385,7 @@ EXTRA_DIST = \
daemons/ganeti-cleaner.in \
$(pkglib_python_scripts) \
devel/upload.in \
tools/kvm-ifup.in \
$(docdot) \
$(docpng) \
$(docrst) \
......@@ -571,6 +574,10 @@ test/daemon-util_unittest.bash: daemons/daemon-util
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
sed -f $(REPLACE_VARS_SED) < $< > $@
chmod +x $@
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
sed -f $(REPLACE_VARS_SED) < $< > $@
chmod u+x $@
......
......@@ -141,6 +141,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
......
#!/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.
if [ -z "$INTERFACE" ]; then
echo "No network interface specified"
exit 1
fi
if [ -z "$MODE" ]; then
echo "MODE not specified"
exit 1
fi
# Execute the user-supplied network script, if applicable
if [ -x "@SYSCONFDIR@/ganeti/kvm-vif-bridge" ]; then
exec @SYSCONFDIR@/ganeti/kvm-vif-bridge
fi
ip link set $INTERFACE up
if [ "$MODE" == "bridged" ]; then
# Connect the interface to the bridge
brctl addif $BRIDGE $INTERFACE
else
if [ -z "$IP" ]; then
echo "Routed NIC but no IP address specified"
exit 1
fi
# 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment