ia64/xen-unstable

annotate tools/hotplug/Linux/vif-route @ 19818:415505139333

Get rid of hardcoded pathes for stubdom and hotplug scripts

- Have the buid system generate a file which exports the install paths
for the hotplug scripts and stubdom / stubdom-dm
- Move file generation code from tools/python/Makefile into a gmake
macro
in Config.mk to avoid maintenance of three duplicates each with its
own
tweaks and bugs
- Export gmake variables into ioemu as shell variables
for upcoming ioemu patches
- Do above as a gmake macro to avoid maintenance of several duplicates
- Adjust hotplug scripts to find the right xen binaries from the
install directory
- Adjust stubdom-dm to use the install directories

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 23 17:25:51 2009 +0100 (2009-06-23)
parents 4bfc67b09e9c
children
rev   line source
keir@18770 1 #!/bin/bash
keir@18770 2 #============================================================================
keir@19818 3 # ${XEN_SCRIPT_DIR}/vif-route
keir@18770 4 #
keir@18770 5 # Script for configuring a vif in routed mode.
keir@18770 6 # The hotplugging system will call this script if it is specified either in
keir@18770 7 # the device configuration given to Xend, or the default Xend configuration
keir@19818 8 # in ${XEN_CONFIG_DIR}/xend-config.sxp. If the script is specified in
keir@19818 9 # neither of those places, then vif-bridge is the default.
keir@18770 10 #
keir@18770 11 # Usage:
keir@18770 12 # vif-route (add|remove|online|offline)
keir@18770 13 #
keir@18770 14 # Environment vars:
keir@18770 15 # vif vif interface name (required).
keir@18770 16 # XENBUS_PATH path to this device's details in the XenStore (required).
keir@18770 17 #
keir@18770 18 # Read from the store:
keir@18770 19 # ip list of IP networks for the vif, space-separated (default given in
keir@18770 20 # this script).
keir@18770 21 #============================================================================
keir@18770 22
keir@18770 23 dir=$(dirname "$0")
keir@18770 24 . "$dir/vif-common.sh"
keir@18770 25
keir@18770 26 main_ip=$(dom0_ip)
keir@18770 27
keir@18770 28 case "$command" in
keir@18770 29 online)
keir@18770 30 ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up
keir@18770 31 echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
keir@18770 32 ipcmd='add'
keir@18770 33 cmdprefix=''
keir@18770 34 ;;
keir@18770 35 offline)
keir@18770 36 do_without_error ifdown ${vif}
keir@18770 37 ipcmd='del'
keir@18770 38 cmdprefix='do_without_error'
keir@18770 39 ;;
keir@18770 40 esac
keir@18770 41
keir@18770 42 if [ "${ip}" ] ; then
keir@18770 43 # If we've been given a list of IP addresses, then add routes from dom0 to
keir@18770 44 # the guest using those addresses.
keir@18770 45 for addr in ${ip} ; do
keir@18770 46 ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
keir@18770 47 done
keir@18770 48 fi
keir@18770 49
keir@18770 50 handle_iptable
keir@18770 51
keir@18770 52 log debug "Successful vif-route $command for $vif."
keir@18770 53 if [ "$command" = "online" ]
keir@18770 54 then
keir@18770 55 success
keir@18770 56 fi