debuggers.hg

diff tools/python/xen/xm/create.py @ 3639:ef59b38283a5

bitkeeper revision 1.1159.212.64 (42000361XrdUoEK_vD6RMga2eLmwZg)

Allow specification of backend vif MAC addresses. If a backend
MAC is not provided, generate one as before

Signed-off-by: Jody Belka <knew-xen@pimb.org>
Signed-off-by: ian.pratt@cl.cam.ac.uk
author iap10@labyrinth.cl.cam.ac.uk
date Tue Feb 01 22:32:01 2005 +0000 (2005-02-01)
parents 3ced9b0f4dab
children bbe8541361dd
line diff
     1.1 --- a/tools/python/xen/xm/create.py	Tue Feb 01 22:05:38 2005 +0000
     1.2 +++ b/tools/python/xen/xm/create.py	Tue Feb 01 22:32:01 2005 +0000
     1.3 @@ -160,11 +160,13 @@ gopts.var('ipaddr', val="IPADDR",
     1.4            fn=append_value, default=[],
     1.5            use="Add an IP address to the domain.")
     1.6  
     1.7 -gopts.var('vif', val="mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM",
     1.8 +gopts.var('vif', val="mac=MAC,be_mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM",
     1.9            fn=append_value, default=[],
    1.10            use="""Add a network interface with the given MAC address and bridge.
    1.11            The vif is configured by calling the given configuration script.
    1.12            If mac is not specified a random MAC address is used.
    1.13 +          The MAC address of the backend interface can be selected with be_mac.
    1.14 +          If not specified then the network backend chooses it's own MAC address.
    1.15            If bridge is not specified the default bridge is used.
    1.16            If script is not specified the default script is used.
    1.17            If backend is not specified the default backend driver domain is used.
    1.18 @@ -314,18 +316,22 @@ def configure_vifs(config_devs, vals):
    1.19              mac = d.get('mac')
    1.20              if not mac:
    1.21                  mac = randomMAC()
    1.22 +            be_mac = d.get('be_mac')
    1.23              bridge = d.get('bridge')
    1.24              script = d.get('script')
    1.25              backend = d.get('backend')
    1.26              ip = d.get('ip')
    1.27          else:
    1.28              mac = randomMAC()
    1.29 +            be_mac = None
    1.30              bridge = None
    1.31              script = None
    1.32              backend = None
    1.33              ip = None
    1.34          config_vif = ['vif']
    1.35          config_vif.append(['mac', mac])
    1.36 +        if be_mac:
    1.37 +            config_vif.append(['be_mac', be_mac])
    1.38          if bridge:
    1.39              config_vif.append(['bridge', bridge])
    1.40          if script:
    1.41 @@ -423,7 +429,7 @@ def preprocess_vifs(opts, vals):
    1.42              (k, v) = b.strip().split('=', 1)
    1.43              k = k.strip()
    1.44              v = v.strip()
    1.45 -            if k not in ['mac', 'bridge', 'script', 'backend', 'ip']:
    1.46 +            if k not in ['mac', 'be_mac', 'bridge', 'script', 'backend', 'ip']:
    1.47                  opts.err('Invalid vif specifier: ' + vif)
    1.48              d[k] = v
    1.49          vifs.append(d)