ia64/xen-unstable

changeset 3432:c5f713b422d1

bitkeeper revision 1.1159.217.14 (41e6620e1bqDGxYXJ_4L3rtRz9G5sQ)

Merge scramble.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
into scramble.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk
author kaf24@scramble.cl.cam.ac.uk
date Thu Jan 13 11:57:02 2005 +0000 (2005-01-13)
parents cd78cc21face cd93e93dd285
children 6096356005ba
files .rootkeys tools/examples/Makefile tools/examples/network-route tools/examples/vif-route tools/examples/xend-config.sxp tools/python/xen/xm/create.py
line diff
     1.1 --- a/.rootkeys	Thu Jan 13 10:02:05 2005 +0000
     1.2 +++ b/.rootkeys	Thu Jan 13 11:57:02 2005 +0000
     1.3 @@ -325,7 +325,9 @@ 405ff55dawQyCHFEnJ067ChPRoXBBA tools/exa
     1.4  40278d94cIUWl2eRgnwZtr4hTyWT1Q tools/examples/init.d/xendomains
     1.5  41dde8afTUuvdtFUlOx0ZRusKxyd8w tools/examples/mem-map.sxp
     1.6  40ee75a9xFz6S05sDKu-JCLqyVTkDA tools/examples/network
     1.7 +41e661e1giIEKbJ25qfiP-ke8u8hFA tools/examples/network-route
     1.8  40ee75a967sxgcRY4Q7zXoVUaJ4flA tools/examples/vif-bridge
     1.9 +41e661e1ooiRKlOfwumG6wwzc0PdhQ tools/examples/vif-route
    1.10  40ee75a93cqxHp6MiYXxxwR5j2_8QQ tools/examples/xend-config.sxp
    1.11  41dde8af6M2Pm1Rrv_f5jEFC_BIOIA tools/examples/xmexample.vmx
    1.12  41090ec8Pj_bkgCBpg2W7WfmNkumEA tools/examples/xmexample1
     2.1 --- a/tools/examples/Makefile	Thu Jan 13 10:02:05 2005 +0000
     2.2 +++ b/tools/examples/Makefile	Thu Jan 13 11:57:02 2005 +0000
     2.3 @@ -14,8 +14,8 @@ XEN_CONFIGS += bochsrc
     2.4  
     2.5  # Xen script dir and scripts to go there.
     2.6  XEN_SCRIPT_DIR = /etc/xen/scripts
     2.7 -XEN_SCRIPTS = network
     2.8 -XEN_SCRIPTS += vif-bridge
     2.9 +XEN_SCRIPTS = network vif-bridge
    2.10 +XEN_SCRIPTS += network-route vif-route
    2.11  XEN_SCRIPTS += block-file
    2.12  XEN_SCRIPTS += block-enbd
    2.13  
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/examples/network-route	Thu Jan 13 11:57:02 2005 +0000
     3.3 @@ -0,0 +1,19 @@
     3.4 +#!/bin/sh
     3.5 +#============================================================================
     3.6 +# Default Xen network start/stop script.
     3.7 +# Xend calls a network script when it starts.
     3.8 +# The script name to use is defined in /etc/xen/xend-config.sxp
     3.9 +# in the network-script field.
    3.10 +#
    3.11 +# Usage:
    3.12 +#
    3.13 +# network-route (start|stop|status) {VAR=VAL}*
    3.14 +#
    3.15 +# Vars:
    3.16 +#
    3.17 +# netdev     The gateway interface (default eth0).
    3.18 +# antispoof  Whether to use iptables to prevent spoofing (default yes).
    3.19 +#
    3.20 +#============================================================================
    3.21 +
    3.22 +echo 1 >/proc/sys/net/ipv4/ip_forward
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/examples/vif-route	Thu Jan 13 11:57:02 2005 +0000
     4.3 @@ -0,0 +1,76 @@
     4.4 +#!/bin/sh
     4.5 +#============================================================================
     4.6 +# /etc/xen/vif-route
     4.7 +#
     4.8 +# Script for configuring a vif in routed mode.
     4.9 +# Xend calls a vif script when bringing a vif up or down.
    4.10 +# This script is the default - but it can be configured for each vif.
    4.11 +#
    4.12 +# Example invocation:
    4.13 +#
    4.14 +# vif-route up domain=VM1 vif=vif1.0 ip="128.232.38.45/28 10.10.10.55/24"
    4.15 +#
    4.16 +# Usage:
    4.17 +# vif-route (up|down) {VAR=VAL}*
    4.18 +#
    4.19 +# Vars:
    4.20 +#
    4.21 +# domain  name of the domain the interface is on (required).
    4.22 +# vif     vif interface name (required).
    4.23 +# mac     vif MAC address (required).
    4.24 +# ip      list of IP networks for the vif, space-separated (optional).
    4.25 +#============================================================================
    4.26 +
    4.27 +# Exit if anything goes wrong
    4.28 +set -e 
    4.29 +
    4.30 +echo "vif-route $*"
    4.31 +
    4.32 +# Operation name.
    4.33 +OP=$1
    4.34 +shift
    4.35 +
    4.36 +# Pull variables in args into environment
    4.37 +for arg ; do export "${arg}" ; done
    4.38 +
    4.39 +# Required parameters. Fail if not set.
    4.40 +domain=${domain:?}
    4.41 +vif=${vif:?}
    4.42 +mac=${mac:?}
    4.43 +
    4.44 +# Optional parameters. Set defaults.
    4.45 +ip=${ip:-''}   # default to null (do nothing)
    4.46 +
    4.47 +main_ip=`ifconfig eth0 | grep "inet addr:" | sed -e 's/.*inet addr:\(\w\w*\.\w\w*\.\w\w*\.\w\w*\).*/\1/'`
    4.48 +
    4.49 +# Are we going up or down?
    4.50 +case $OP in
    4.51 +    up)
    4.52 +        ifconfig ${vif} 169.254.1.0 netmask 255.255.255.255 up
    4.53 +        echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
    4.54 +        iptcmd='-A'
    4.55 +        ipcmd='a'
    4.56 +        ;;
    4.57 +    down)
    4.58 +        ifconfig ${vif} down
    4.59 +        iptcmd='-D'
    4.60 +        ipcmd='d'
    4.61 +        ;;
    4.62 +    *)
    4.63 +        echo 'Invalid command: ' $OP
    4.64 +        echo 'Valid commands are: up, down'
    4.65 +        exit 1
    4.66 +        ;;
    4.67 +esac
    4.68 +
    4.69 +if [ ${ip} ] ; then
    4.70 +
    4.71 +    # If we've been given a list of IP networks, allow pkts with these src addrs.
    4.72 +    for addr in ${ip} ; do
    4.73 +      ip r ${ipcmd} ${addr} dev ${vif} src ${main_ip}
    4.74 +#      iptables ${iptcmd} FORWARD -m physdev --physdev-in ${vif} -s ${addr} -j ACCEPT
    4.75 +    done 
    4.76 +
    4.77 +    # Always allow us to talk to a DHCP server anyhow.
    4.78 +#    iptables ${iptcmd} FORWARD -m physdev --physdev-in ${vif} -p udp --sport 68 --dport 67 -j ACCEPT
    4.79 +fi
     5.1 --- a/tools/examples/xend-config.sxp	Thu Jan 13 10:02:05 2005 +0000
     5.2 +++ b/tools/examples/xend-config.sxp	Thu Jan 13 11:57:02 2005 +0000
     5.3 @@ -8,12 +8,17 @@
     5.4  # Specifying the empty string '' allows all connections.
     5.5  (xend-address      '')
     5.6  
     5.7 +## Use the following if VIF traffic is routed.
     5.8 +# The script used to start/stop networking for xend.
     5.9 +#(network-script     network-route)
    5.10 +# The default script used to control virtual interfaces.
    5.11 +#(vif-script         vif-route)
    5.12 +
    5.13 +## Use the following if VIF traffic is bridged.
    5.14  # The script used to start/stop networking for xend.
    5.15  (network-script    network)
    5.16 -
    5.17  # The default bridge that virtual interfaces should be connected to.
    5.18  (vif-bridge        xen-br0)
    5.19 -
    5.20  # The default script used to control virtual interfaces.
    5.21  (vif-script        vif-bridge)
    5.22  
     6.1 --- a/tools/python/xen/xm/create.py	Thu Jan 13 10:02:05 2005 +0000
     6.2 +++ b/tools/python/xen/xm/create.py	Thu Jan 13 11:57:02 2005 +0000
     6.3 @@ -295,14 +295,18 @@ def configure_vifs(config_devs, vals):
     6.4          if idx < len(vifs):
     6.5              d = vifs[idx]
     6.6              mac = d.get('mac')
     6.7 +            if not mac:
     6.8 +                mac = randomMAC()
     6.9              bridge = d.get('bridge')
    6.10              script = d.get('script')
    6.11              backend = d.get('backend')
    6.12 +            ip = d.get('ip')
    6.13          else:
    6.14              mac = randomMAC()
    6.15              bridge = None
    6.16              script = None
    6.17              backend = None
    6.18 +            ip = None
    6.19          config_vif = ['vif']
    6.20          config_vif.append(['mac', mac])
    6.21          if bridge:
    6.22 @@ -311,6 +315,8 @@ def configure_vifs(config_devs, vals):
    6.23              config_vif.append(['script', script])
    6.24          if backend:
    6.25              config_vif.append(['backend', backend])
    6.26 +        if ip:
    6.27 +            config_vif.append(['ip', ip])
    6.28          config_devs.append(['device', config_vif])
    6.29  
    6.30  def configure_vfr(config, vals):
    6.31 @@ -399,7 +405,7 @@ def preprocess_vifs(opts, vals):
    6.32              (k, v) = b.strip().split('=', 1)
    6.33              k = k.strip()
    6.34              v = v.strip()
    6.35 -            if k not in ['mac', 'bridge', 'script', 'backend']:
    6.36 +            if k not in ['mac', 'bridge', 'script', 'backend', 'ip']:
    6.37                  opts.err('Invalid vif specifier: ' + vif)
    6.38              d[k] = v
    6.39          vifs.append(d)