[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Merged.
# HG changeset patch # User emellor@xxxxxxxxxxxxxxxxxxxxxx # Node ID ef2fff896422a3133d0abb18cce3923eebb1c321 # Parent d01b3b50ea64100a631a4509444c3e0775392080 # Parent 7f2ccea5a4ec96af72e83c13ee25845e5d2cbb61 Merged. diff -r d01b3b50ea64 -r ef2fff896422 docs/src/user.tex --- a/docs/src/user.tex Tue Dec 13 10:57:04 2005 +++ b/docs/src/user.tex Tue Dec 13 10:57:18 2005 @@ -1087,16 +1087,17 @@ \item[vcpus] The number of virtual CPUs. \item[console] Port to export the domain console on (default 9600 + domain ID). -\item[nics] Number of virtual network interfaces. -\item[vif] List of MAC addresses (random addresses are assigned if not - given) and bridges to use for the domain's network interfaces, e.g.\ +\item[vif] Network interface configuration. This may simply contain +an empty string for each desired interface, or may override various +settings, e.g.\ \begin{verbatim} vif = [ 'mac=00:16:3E:00:00:11, bridge=xen-br0', 'bridge=xen-br1' ] \end{verbatim} to assign a MAC address and bridge to the first interface and assign a different bridge to the second interface, leaving \xend\ to choose - the MAC address. + the MAC address. The settings that may be overridden in this way are + type, mac, bridge, ip, script, backend, and vifname. \item[disk] List of block devices to export to the domain e.g. \verb_disk = [ 'phy:hda1,sda1,r' ]_ exports physical device \path{/dev/hda1} to the domain as diff -r d01b3b50ea64 -r ef2fff896422 linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 Tue Dec 13 10:57:04 2005 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 Tue Dec 13 10:57:18 2005 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.12.6-xen -# Mon Nov 28 11:04:51 2005 +# Mon Dec 12 10:42:00 2005 # CONFIG_XEN=y CONFIG_ARCH_XEN=y @@ -417,7 +417,7 @@ # CONFIG_BLK_DEV_UB is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=8192 +CONFIG_BLK_DEV_RAM_SIZE=16384 CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="" CONFIG_LBD=y @@ -2726,8 +2726,6 @@ CONFIG_PROC_KCORE=y CONFIG_SYSFS=y # CONFIG_DEVFS_FS is not set -# CONFIG_DEVFS_MOUNT is not set -# CONFIG_DEVFS_DEBUG is not set CONFIG_DEVPTS_FS_XATTR=y CONFIG_DEVPTS_FS_SECURITY=y CONFIG_TMPFS=y diff -r d01b3b50ea64 -r ef2fff896422 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Tue Dec 13 10:57:04 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Tue Dec 13 10:57:18 2005 @@ -540,8 +540,8 @@ * tailroom then round down to SKB_DATA_ALIGN boundary. */ skb = alloc_xen_skb( - (PAGE_SIZE - 16 - sizeof(struct skb_shared_info)) & - (-SKB_DATA_ALIGN(1))); + ((PAGE_SIZE - sizeof(struct skb_shared_info)) & + (-SKB_DATA_ALIGN(1))) - 16); if (skb == NULL) break; __skb_queue_tail(&np->rx_batch, skb); diff -r d01b3b50ea64 -r ef2fff896422 tools/examples/vif-common.sh --- a/tools/examples/vif-common.sh Tue Dec 13 10:57:04 2005 +++ b/tools/examples/vif-common.sh Tue Dec 13 10:57:18 2005 @@ -62,7 +62,8 @@ local c="-D" fi - iptables "$c" FORWARD -m physdev --physdev-in "$vif" "$@" -j ACCEPT || + iptables "$c" FORWARD -m physdev --physdev-in "$vif" "$@" -j ACCEPT \ + 2>/dev/null || [ "$c" == "-D" ] || log err \ "iptables $c FORWARD -m physdev --physdev-in $vif $@ -j ACCEPT failed. diff -r d01b3b50ea64 -r ef2fff896422 tools/examples/vif-nat --- a/tools/examples/vif-nat Tue Dec 13 10:57:04 2005 +++ b/tools/examples/vif-nat Tue Dec 13 10:57:18 2005 @@ -42,8 +42,8 @@ fi -domid=$(echo "$XENBUS_PATH" | sed -n 's#.*/\([0-9]*\)/[0-9]*$#\1#p') -vifid=$(echo "$XENBUS_PATH" | sed -n 's#.*/[0-9]*/\([0-9]*\)$#\1#p') +domid=$(xenstore_read "$XENBUS_PATH/frontend-id") +vifid=$(xenstore_read "$XENBUS_PATH/handle") vifid=$(( $vifid + 1 )) diff -r d01b3b50ea64 -r ef2fff896422 tools/examples/xend-config.sxp --- a/tools/examples/xend-config.sxp Tue Dec 13 10:57:04 2005 +++ b/tools/examples/xend-config.sxp Tue Dec 13 10:57:18 2005 @@ -40,7 +40,20 @@ # xend-relocation-server is set. # Meaning and default as for xend-address above. #(xend-relocation-address '') -(xend-relocation-address localhost) + +# The hosts allowed to talk to the relocation port. If this is empty (the +# default), then all connections are allowed (assuming that the connection +# arrives on a port and interface on which we are listening; see +# xend-relocation-port and xend-relocation-address above). Otherwise, this +# should be a space-separated sequence of regular expressions. Any host with +# a fully-qualified domain name or an IP address that matches one of these +# regular expressions will be accepted. +# +# For example: +# (xend-relocation-hosts-allow '^localhost$ ^.*\.example\.org$') +# +#(xend-relocation-hosts-allow '') +(xend-relocation-hosts-allow '^localhost$') # The limit (in kilobytes) on the size of the console buffer #(console-limit 1024) diff -r d01b3b50ea64 -r ef2fff896422 tools/examples/xmexample.nbd --- a/tools/examples/xmexample.nbd Tue Dec 13 10:57:04 2005 +++ b/tools/examples/xmexample.nbd Tue Dec 13 10:57:18 2005 @@ -12,9 +12,7 @@ ramdisk = "/boot/initrd-2.6.13-15b-xen" memory = 128 name = "nbd4" -nics=1 -# Please change MAC -vif = [ 'mac=aa:cc:10:10:00:a0, bridge=xenbr0' ] +vif = [ '' ] # Please change PORT disk = [ 'nbd:134.100.233.115 20004,hda1,w' ] dhcp = "dhcp" diff -r d01b3b50ea64 -r ef2fff896422 tools/examples/xmexample.vmx --- a/tools/examples/xmexample.vmx Tue Dec 13 10:57:04 2005 +++ b/tools/examples/xmexample.vmx Tue Dec 13 10:57:18 2005 @@ -37,9 +37,7 @@ # Optionally define mac and/or bridge for the network interfaces. # Random MACs are assigned if not given. -# nics default is 1 -#vif = [ 'type=ioemu, mac=aa:00:00:00:00:11, bridge=xenbr0' ] -nics=1 +#vif = [ 'type=ioemu, mac=00:16:3e:00:00:11, bridge=xenbr0' ] # type=ioemu specify the NIC is an ioemu device not netfront vif = [ 'type=ioemu, bridge=xenbr0' ] # for multiple NICs in device model, 3 in this example diff -r d01b3b50ea64 -r ef2fff896422 tools/examples/xmexample.vti --- a/tools/examples/xmexample.vti Tue Dec 13 10:57:04 2005 +++ b/tools/examples/xmexample.vti Tue Dec 13 10:57:18 2005 @@ -28,12 +28,9 @@ #cpus = "0" # all vcpus run on CPU0 #cpus = "0-3,5,^1" # run on cpus 0,2,3,5 -# Disable vif for now -nics=0 - # Optionally define mac and/or bridge for the network interfaces. # Random MACs are assigned if not given. -#vif = [ 'mac=aa:00:00:00:00:11, bridge=xen-br0' ] +#vif = [ 'mac=00:16:3e:00:00:11, bridge=xen-br0' ] #---------------------------------------------------------------------------- # Define the disk devices you want the domain to have access to, and diff -r d01b3b50ea64 -r ef2fff896422 tools/examples/xmexample1 --- a/tools/examples/xmexample1 Tue Dec 13 10:57:04 2005 +++ b/tools/examples/xmexample1 Tue Dec 13 10:57:18 2005 @@ -33,12 +33,20 @@ #---------------------------------------------------------------------------- # Define network interfaces. -# Number of network interfaces. Default is 1. -#nics=1 +# By default, no network interfaces are configured. You may have one created +# with sensible defaults using an empty vif clause: +# +# vif = [ '' ] +# +# or optionally override backend, bridge, ip, mac, script, type, or vifname: +# +# vif = [ 'mac=00:16:3e:00:00:11, bridge=xenbr0' ] +# +# or more than one interface may be configured: +# +# vif = [ '', 'bridge=xenbr1' ] -# Optionally define mac and/or bridge for the network interfaces. -# Random MACs are assigned if not given. -#vif = [ 'mac=aa:00:00:00:00:11, bridge=xenbr0' ] +vif = [ '' ] #---------------------------------------------------------------------------- # Define the disk devices you want the domain to have access to, and diff -r d01b3b50ea64 -r ef2fff896422 tools/examples/xmexample2 --- a/tools/examples/xmexample2 Tue Dec 13 10:57:04 2005 +++ b/tools/examples/xmexample2 Tue Dec 13 10:57:18 2005 @@ -64,12 +64,20 @@ #---------------------------------------------------------------------------- # Define network interfaces. -# Number of network interfaces. Default is 1. -#nics=1 +# By default, no network interfaces are configured. You may have one created +# with sensible defaults using an empty vif clause: +# +# vif = [ '' ] +# +# or optionally override backend, bridge, ip, mac, script, type, or vifname: +# +# vif = [ 'mac=00:16:3e:00:00:11, bridge=xenbr0' ] +# +# or more than one interface may be configured: +# +# vif = [ '', 'bridge=xenbr1' ] -# Optionally define mac and/or bridge for the network interfaces. -# Random MACs are assigned if not given. -#vif = [ 'mac=aa:00:00:00:00:11, bridge=xenbr0' ] +vif = [ '' ] #---------------------------------------------------------------------------- # Define the disk devices you want the domain to have access to, and diff -r d01b3b50ea64 -r ef2fff896422 tools/examples/xmexample3 --- a/tools/examples/xmexample3 Tue Dec 13 10:57:04 2005 +++ b/tools/examples/xmexample3 Tue Dec 13 10:57:18 2005 @@ -59,9 +59,6 @@ #---------------------------------------------------------------------------- # Define network interfaces. - -# Number of network interfaces. Default is 1. -#nics=1 # Optionally define mac and/or bridge for the network interfaces. # Random MACs are assigned if not given. diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/web/connection.py --- a/tools/python/xen/web/connection.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/web/connection.py Tue Dec 13 10:57:18 2005 @@ -19,7 +19,6 @@ import sys import threading -import select import socket import fcntl @@ -31,21 +30,17 @@ """ BUFFER_SIZE = 1024 +BACKLOG = 5 class SocketServerConnection: """An accepted connection to a server. """ - def __init__(self, sock, protocol, addr, server): + def __init__(self, sock, protocol_class): self.sock = sock - self.protocol = protocol - self.addr = addr - self.server = server + self.protocol = protocol_class() self.protocol.setTransport(self) - - - def run(self): threading.Thread(target=self.main).start() @@ -68,6 +63,10 @@ pass + def close(self): + self.sock.close() + + def write(self, data): self.sock.send(data) @@ -77,52 +76,38 @@ Accepts connections and runs a thread for each one. """ - def __init__(self, protocol_class, backlog=None): - if backlog is None: - backlog = 5 + def __init__(self, protocol_class, hosts_allow = ''): self.protocol_class = protocol_class - self.sock = None - self.backlog = backlog - self.thread = None + self.sock = self.createSocket() + threading.Thread(target=self.main).start() + + + def close(self): + try: + self.sock.close() + except: + pass def createSocket(self): raise NotImplementedError() - def setCloExec(self): - fcntl.fcntl(self.sock.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC) - - def acceptConnection(self, sock, protocol, addr): - return SocketServerConnection(sock, protocol, addr, self) - - - def listen(self): - if self.sock or self.thread: - raise IOError("already listening") - self.sock = self.createSocket() - self.sock.listen(self.backlog) - self.run() - - - def run(self): - self.thread = threading.Thread(target=self.main) - self.thread.start() + raise NotImplementedError() def main(self): try: + fcntl.fcntl(self.sock.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC) + self.sock.listen(BACKLOG) + while True: try: (sock, addr) = self.sock.accept() - self.acceptConnection(sock, self.protocol_class(), - addr).run() + self.acceptConnection(sock, addr) except socket.error, ex: if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): break finally: - try: - self.sock.close() - except: - pass + self.close() diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/web/tcp.py --- a/tools/python/xen/web/tcp.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/web/tcp.py Tue Dec 13 10:57:18 2005 @@ -17,20 +17,25 @@ #============================================================================ +import errno +import re import socket import time -import errno -from connection import * +import connection + +from xen.xend.XendLogging import log -class TCPListener(SocketListener): +class TCPListener(connection.SocketListener): - def __init__(self, port, protocol, backlog=None, interface=''): - SocketListener.__init__(self, protocol, backlog=backlog) + def __init__(self, protocol_class, port, interface, hosts_allow): self.port = port self.interface = interface - + self.hosts_allow = hosts_allow + connection.SocketListener.__init__(self, protocol_class) + + def createSocket(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) @@ -49,11 +54,23 @@ else: raise - def acceptConnection(self, sock, protocol, addr): - return SocketServerConnection(sock, protocol, addr, self) + def acceptConnection(self, sock, addrport): + addr = addrport[0] + if self.hosts_allow is None: + connection.SocketServerConnection(sock, self.protocol_class) + else: + fqdn = socket.getfqdn(addr) + for h in self.hosts_allow: + if h.match(fqdn) or h.match(addr): + log.debug("Match %s %s", fqdn, h.pattern) + connection.SocketServerConnection(sock, + self.protocol_class) + return -def listenTCP(port, protocol, interface='', backlog=None): - l = TCPListener(port, protocol, interface=interface, backlog=backlog) - l.listen() - l.setCloExec() + try: + log.warn("Rejected connection from %s:%d (%s) for port %d.", + addr, addrport[1], fqdn, self.port) + sock.close() + except: + pass diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/web/unix.py --- a/tools/python/xen/web/unix.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/web/unix.py Tue Dec 13 10:57:18 2005 @@ -21,15 +21,15 @@ import os import os.path -from connection import * +import connection -class UnixListener(SocketListener): +class UnixListener(connection.SocketListener): + def __init__(self, path, protocol_class): + self.path = path + connection.SocketListener.__init__(self, protocol_class) - def __init__(self, path, protocol, backlog=None): - SocketListener.__init__(self, protocol, backlog=backlog) - self.path = path - + def createSocket(self): pathdir = os.path.dirname(self.path) if not os.path.exists(pathdir): @@ -45,9 +45,6 @@ sock.bind(self.path) return sock - def acceptConnection(self, sock, protocol, addr): - return SocketServerConnection(sock, protocol, self.path, self) - -def listenUNIX(path, protocol, backlog=None): - UnixListener(path, protocol, backlog=backlog).listen() + def acceptConnection(self, sock, _): + connection.SocketServerConnection(sock, self.protocol_class) diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/xend/XendRoot.py --- a/tools/python/xen/xend/XendRoot.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/xend/XendRoot.py Tue Dec 13 10:57:18 2005 @@ -74,6 +74,8 @@ """Default port xend serves relocation at. """ xend_relocation_port_default = '8002' + + xend_relocation_hosts_allow_default = '' """Default for the flag indicating whether xend should run a unix-domain server.""" xend_unix_server_default = 'yes' @@ -194,6 +196,10 @@ """ return self.get_config_int('xend-relocation-port', self.xend_relocation_port_default) + def get_xend_relocation_hosts_allow(self): + return self.get_config_value("xend-relocation-hosts-allow", + self.xend_relocation_hosts_allow_default) + def get_xend_address(self): """Get the address xend listens at for its HTTP port. This defaults to the empty string which allows all hosts to connect. diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/xend/server/SrvDaemon.py --- a/tools/python/xen/xend/server/SrvDaemon.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/xend/server/SrvDaemon.py Tue Dec 13 10:57:18 2005 @@ -16,10 +16,10 @@ import xen.lowlevel.xc -from xen.xend.server import SrvServer from xen.xend.XendLogging import log import relocate +import SrvServer from params import * @@ -167,8 +167,9 @@ while True: pid = self.fork_pid() if pid: - os.close(w) - w = False + if w is not None: + os.close(w) + w = None (_, status) = os.waitpid(pid, 0) diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/xend/server/SrvServer.py --- a/tools/python/xen/xend/server/SrvServer.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/xend/server/SrvServer.py Tue Dec 13 10:57:18 2005 @@ -40,6 +40,7 @@ # todo Support command-line args. import fcntl +import time from threading import Thread from xen.web.httpserver import HttpServer, UnixHttpServer @@ -48,7 +49,6 @@ from xen.xend import Vifctl from xen.xend.XendLogging import log from xen.web.SrvDir import SrvDir -import time from SrvRoot import SrvRoot diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/xend/server/relocate.py --- a/tools/python/xen/xend/server/relocate.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/xend/server/relocate.py Tue Dec 13 10:57:18 2005 @@ -16,6 +16,7 @@ # Copyright (C) 2005 XenSource Ltd #============================================================================ +import re import sys import StringIO @@ -116,8 +117,16 @@ xroot = XendRoot.instance() if xroot.get_xend_unix_server(): path = '/var/lib/xend/relocation-socket' - unix.listenUNIX(path, RelocationProtocol) + unix.UnixListener(path, RelocationProtocol) if xroot.get_xend_relocation_server(): port = xroot.get_xend_relocation_port() interface = xroot.get_xend_relocation_address() - tcp.listenTCP(port, RelocationProtocol, interface=interface) + + hosts_allow = xroot.get_xend_relocation_hosts_allow() + if hosts_allow == '': + hosts_allow = None + else: + hosts_allow = map(re.compile, hosts_allow.split(" ")) + + tcp.TCPListener(RelocationProtocol, port, interface = interface, + hosts_allow = hosts_allow) diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/xend/sxp.py --- a/tools/python/xen/xend/sxp.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/xend/sxp.py Tue Dec 13 10:57:18 2005 @@ -696,13 +696,16 @@ io.close() return val -def from_string(str): +def from_string(s): """Create an sxpr by parsing a string. - str string + s string returns sxpr """ - io = StringIO(str) + if s == '': + return [] + + io = StringIO(s) vals = parse(io) if vals is []: return None @@ -710,13 +713,13 @@ return vals[0] -def all_from_string(str): +def all_from_string(s): """Create an sxpr list by parsing a string. - str string + s string returns sxpr list """ - io = StringIO(str) + io = StringIO(s) vals = parse(io) return vals diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/xm/create.py Tue Dec 13 10:57:18 2005 @@ -253,17 +253,12 @@ use="""Add a physical USB port to a domain, as specified by the path to that port. This option may be repeated to add more than one port.""") -gopts.var('ipaddr', val="IPADDR", - fn=append_value, default=[], - use="Add an IP address to the domain.") - -gopts.var('vif', val="type=TYPE,mac=MAC,be_mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM,vifname=NAME", +gopts.var('vif', val="type=TYPE,mac=MAC,bridge=BRIDGE,ip=IPADDR,script=SCRIPT,backend=DOM,vifname=NAME", fn=append_value, default=[], use="""Add a network interface with the given MAC address and bridge. The vif is configured by calling the given configuration script. If type is not specified, default is netfront not ioemu device. If mac is not specified a random MAC address is used. - The MAC address of the backend interface can be selected with be_mac. If not specified then the network backend chooses it's own MAC address. If bridge is not specified the first bridge found is used. If script is not specified the default script is used. @@ -284,8 +279,10 @@ given domain.""") gopts.var('nics', val="NUM", - fn=set_int, default=1, - use="""Set the number of network interfaces. + fn=set_int, default=-1, + use="""DEPRECATED. Use empty vif entries instead. + + Set the number of network interfaces. Use the vif option to define interface parameters, otherwise defaults are used. Specifying vifs will increase the number of interfaces as needed.""") @@ -487,58 +484,38 @@ config_vtpm.append(['backend', backend]) config_devs.append(['device', config_vtpm]) + def configure_vifs(config_devs, vals): """Create the config for virtual network interfaces. """ + vifs = vals.vif - vifs_n = max(vals.nics, len(vifs)) - - for idx in range(0, vifs_n): - if idx < len(vifs): - d = vifs[idx] - mac = d.get('mac') - be_mac = d.get('be_mac') - bridge = d.get('bridge') - script = d.get('script') - backend = d.get('backend') - ip = d.get('ip') - vifname = d.get('vifname') - type = d.get('type') - else: - mac = None - be_mac = None - bridge = None - script = None - backend = None - ip = None - vifname = None - type = None + vifs_n = len(vifs) + + if hasattr(vals, 'nics'): + if vals.nics > 0: + warn("The nics option is deprecated. Please use an empty vif " + "entry instead:\n\n vif = [ '' ]\n") + for _ in range(vifs_n, vals.nics): + vifs.append('') + vifs_n = len(vifs) + elif vals.nics == 0: + warn("The nics option is deprecated. Please remove it.") + + for c in vifs: + d = comma_sep_kv_to_dict(c) config_vif = ['vif'] - if mac: - config_vif.append(['mac', mac]) - if vifname: - config_vif.append(['vifname', vifname]) - if be_mac: - config_vif.append(['be_mac', be_mac]) - if bridge: - config_vif.append(['bridge', bridge]) - if script: - config_vif.append(['script', script]) - if backend: - config_vif.append(['backend', backend]) - if ip: - config_vif.append(['ip', ip]) - if type: - config_vif.append(['type', type]) + + def f(k): + if k not in ['backend', 'bridge', 'ip', 'mac', 'script', 'type', + 'vifname']: + err('Invalid vif option: ' + k) + + config_vif.append([k, d[k]]) + + map(f, d.keys()) config_devs.append(['device', config_vif]) -def configure_vfr(config, vals): - if not vals.ipaddr: return - config_vfr = ['vfr'] - idx = 0 # No way of saying which IP is for which vif? - for ip in vals.ipaddr: - config_vfr.append(['vif', ['id', idx], ['ip', ip]]) - config.append(config_vfr) def configure_vmx(config_image, vals): """Create the config for VMX devices. @@ -648,22 +625,6 @@ ioports.append(hexd) vals.ioports = ioports -def preprocess_vifs(vals): - if not vals.vif: return - vifs = [] - for vif in vals.vif: - d = {} - a = vif.split(',') - for b in a: - (k, v) = b.strip().split('=', 1) - k = k.strip() - v = v.strip() - if k not in ['type', 'mac', 'be_mac', 'bridge', 'script', 'backend', 'ip', 'vifname']: - err('Invalid vif specifier: ' + vif) - d[k] = v - vifs.append(d) - vals.vif = vifs - def preprocess_vtpm(vals): if not vals.vtpm: return vtpms = [] @@ -765,12 +726,30 @@ preprocess_disk(vals) preprocess_pci(vals) preprocess_ioports(vals) - preprocess_vifs(vals) preprocess_ip(vals) preprocess_nfs(vals) preprocess_vnc(vals) preprocess_vtpm(vals) - + + +def comma_sep_kv_to_dict(c): + """Convert comma-separated, equals-separated key-value pairs into a + dictionary. + """ + d = {} + c = c.strip() + if len(c) > 0: + a = c.split(',') + for b in a: + if b.find('=') == -1: + err("%s should be a pair, separated by an equals sign." % b) + (k, v) = b.split('=', 1) + k = k.strip() + v = v.strip() + d[k] = v + return d + + def make_domain(opts, config): """Create, build and start a domain. diff -r d01b3b50ea64 -r ef2fff896422 tools/python/xen/xm/tests/test_create.py --- a/tools/python/xen/xm/tests/test_create.py Tue Dec 13 10:57:04 2005 +++ b/tools/python/xen/xm/tests/test_create.py Tue Dec 13 10:57:18 2005 @@ -36,7 +36,7 @@ (fd, fname) = tempfile.mkstemp() os.close(fd) self.t('-f %s kernel=/mykernel display=fakedisplay ' - 'macaddr=ab:cd:ef:ed nics=0' % fname, + 'macaddr=ab:cd:ef:ed' % fname, { 'name' : os.path.basename(fname), 'xm_file' : fname, 'defconfig' : fname, @@ -50,6 +50,7 @@ 'interface' : 'eth0', 'path' : '.:/etc/xen', 'builder' : 'linux', + 'nics' : -1, }) @@ -62,7 +63,6 @@ memory = 768 name = "dom1" vcpus = 4 -nics = 1 disk = ['phy:/dev/virt-blkdev-backend/dom1,sda1,w', 'phy:/dev/virt-blkdev-backend/usr,sda2,r'] root = "/dev/sda1 ro" @@ -79,7 +79,7 @@ 'memory' : 768, 'name' : 'dom1', 'vcpus' : 4, - 'nics' : 1, + 'nics' : -1, 'root' : '/dev/sda1 ro', 'extra' : ' profile=1 GATEWAY=10.0.1.254 NETMASK=255.255.0.0 IPADDR=10.0.134.1 HOSTNAME=dom1', 'on_poweroff' : 'destroy', @@ -118,7 +118,7 @@ finally: os.close(fd) - self.t('-f %s display=fakedisplay macaddr=ab:cd:ef:ed nics=0' % + self.t('-f %s display=fakedisplay macaddr=ab:cd:ef:ed' % fname, { 'name' : 'testname', 'xm_file' : fname, @@ -137,6 +137,7 @@ 'interface' : 'eth0', 'path' : '.:/etc/xen', 'builder' : 'linux', + 'nics' : -1, }) diff -r d01b3b50ea64 -r ef2fff896422 tools/xm-test/lib/XmTestLib/XenDomain.py --- a/tools/xm-test/lib/XmTestLib/XenDomain.py Tue Dec 13 10:57:04 2005 +++ b/tools/xm-test/lib/XmTestLib/XenDomain.py Tue Dec 13 10:57:18 2005 @@ -203,7 +203,6 @@ # Defaults self.defaults = {"memory" : 64, "vcpus" : 1, - "nics" : 0, "kernel" : "/usr/lib/xen/boot/vmxloader", "builder" : "\'vmx\'", "name" : name or self.getUniqueName() @@ -264,7 +263,6 @@ # Defaults self.defaults = {"memory" : 64, "vcpus" : 1, - "nics" : 0, "kernel" : getDefaultKernel(), "root" : "/dev/ram0", "name" : name or self.getUniqueName(), diff -r d01b3b50ea64 -r ef2fff896422 tools/xm-test/tests/create/13_create_multinic_pos.py --- a/tools/xm-test/tests/create/13_create_multinic_pos.py Tue Dec 13 10:57:04 2005 +++ b/tools/xm-test/tests/create/13_create_multinic_pos.py Tue Dec 13 10:57:18 2005 @@ -6,7 +6,8 @@ from XmTestLib import * for i in range(0,10): - domain = XmTestDomain(extraOpts={"nics":"%i" % i}) + domain = XmTestDomain() + domain.configSetVar('vif', str(['' for _ in range(0, i)])) try: domain.start() diff -r d01b3b50ea64 -r ef2fff896422 tools/xm-test/tests/network/02_network_local_ping_pos.py --- a/tools/xm-test/tests/network/02_network_local_ping_pos.py Tue Dec 13 10:57:04 2005 +++ b/tools/xm-test/tests/network/02_network_local_ping_pos.py Tue Dec 13 10:57:18 2005 @@ -28,7 +28,7 @@ mask = Net.mask("dom1", "eth0") # Fire up a guest domain w/1 nic -domain = XmTestDomain(extraOpts={ 'nics' : 1 }) +domain = XmTestDomain() try: domain.configSetVar('vif', " [ 'ip=" + ip + "' ]") domain.start() diff -r d01b3b50ea64 -r ef2fff896422 tools/xm-test/tests/network/05_network_dom0_ping_pos.py --- a/tools/xm-test/tests/network/05_network_dom0_ping_pos.py Tue Dec 13 10:57:04 2005 +++ b/tools/xm-test/tests/network/05_network_dom0_ping_pos.py Tue Dec 13 10:57:18 2005 @@ -31,7 +31,7 @@ FAIL(str(e)) # Fire up a guest domain w/1 nic -domain = XmTestDomain(extraOpts={ 'nics' : 1 }) +domain = XmTestDomain() try: domain.configSetVar('vif', " [ 'ip=" + ip + "' ]") domain.start() diff -r d01b3b50ea64 -r ef2fff896422 tools/xm-test/tests/network/11_network_domU_ping_pos.py --- a/tools/xm-test/tests/network/11_network_domU_ping_pos.py Tue Dec 13 10:57:04 2005 +++ b/tools/xm-test/tests/network/11_network_domU_ping_pos.py Tue Dec 13 10:57:18 2005 @@ -21,7 +21,7 @@ def netDomain(ip): - dom = XmTestDomain(extraOpts={ 'nics' : 1 }) + dom = XmTestDomain() try: dom.configSetVar('vif', " [ 'ip=" + ip + "' ]") dom.start() diff -r d01b3b50ea64 -r ef2fff896422 tools/xm-test/tests/restore/04_restore_withdevices_pos.py --- a/tools/xm-test/tests/restore/04_restore_withdevices_pos.py Tue Dec 13 10:57:04 2005 +++ b/tools/xm-test/tests/restore/04_restore_withdevices_pos.py Tue Dec 13 10:57:18 2005 @@ -7,7 +7,9 @@ import re -domain = XmTestDomain(extraOpts={"nics":2}) +domain = XmTestDomain() + +domain.configSetVar('vif', "[ '', '' ]") domain.configAddDisk("phy:/dev/ram0", "hda1", "w") domain.configAddDisk("phy:/dev/ram1", "hdb2", "w") _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |