aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python/xen/xm/create.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/python/xen/xm/create.py')
-rw-r--r--tools/python/xen/xm/create.py50
1 files changed, 48 insertions, 2 deletions
diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py
index 03f815eddb..e79e02383c 100644
--- a/tools/python/xen/xm/create.py
+++ b/tools/python/xen/xm/create.py
@@ -109,6 +109,10 @@ gopts.var('cpu', val='CPU',
fn=set_int, default=None,
use="CPU to run the domain on.")
+gopts.var('vcpus', val='VCPUS',
+ fn=set_int, default=1,
+ use="# of Virtual CPUS in domain.")
+
gopts.var('cpu_weight', val='WEIGHT',
fn=set_float, default=None,
use="""Set the new domain's cpu weight.
@@ -147,15 +151,22 @@ gopts.var('pci', val='BUS,DEV,FUNC',
For example '-pci c0,02,1a'.
The option may be repeated to add more than one pci device.""")
+gopts.var('usb', val='PATH',
+ fn=append_value, default=[],
+ 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="mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM",
+gopts.var('vif', val="mac=MAC,be_mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM",
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 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 default bridge is used.
If script is not specified the default script is used.
If backend is not specified the default backend driver domain is used.
@@ -210,6 +221,18 @@ gopts.var('nfs_root', val="PATH",
fn=set_value, default=None,
use="Set the path of the root NFS directory.")
+gopts.var('memmap', val='FILE',
+ fn=set_value, default='',
+ use="Path to memap SXP file.")
+
+gopts.var('device_model', val='FILE',
+ fn=set_value, default='',
+ use="Path to device model program.")
+
+gopts.var('device_config', val='FILE',
+ fn=set_value, default='',
+ use="Path to device model configuration.")
+
def strip(pre, s):
"""Strip prefix 'pre' if present.
"""
@@ -233,7 +256,10 @@ def configure_image(config, vals):
config_image.append(['root', cmdline_root])
if vals.extra:
config_image.append(['args', vals.extra])
+ if vals.vcpus:
+ config_image.append(['vcpus', vals.vcpus])
config.append(['image', config_image ])
+
def configure_disks(config_devs, vals):
"""Create the config for disks (virtual block devices).
@@ -254,6 +280,11 @@ def configure_pci(config_devs, vals):
config_pci = ['pci', ['bus', bus], ['dev', dev], ['func', func]]
config_devs.append(['device', config_pci])
+def configure_usb(config_devs, vals):
+ for path in vals.usb:
+ config_usb = ['usb', ['path', path]]
+ config_devs.append(['device', config_usb])
+
def randomMAC():
"""Generate a random MAC address.
@@ -285,18 +316,22 @@ def configure_vifs(config_devs, vals):
mac = d.get('mac')
if not mac:
mac = randomMAC()
+ be_mac = d.get('be_mac')
bridge = d.get('bridge')
script = d.get('script')
backend = d.get('backend')
ip = d.get('ip')
else:
mac = randomMAC()
+ be_mac = None
bridge = None
script = None
backend = None
ip = None
config_vif = ['vif']
config_vif.append(['mac', mac])
+ if be_mac:
+ config_vif.append(['be_mac', be_mac])
if bridge:
config_vif.append(['bridge', bridge])
if script:
@@ -315,6 +350,15 @@ def configure_vfr(config, vals):
config_vfr.append(['vif', ['id', idx], ['ip', ip]])
config.append(config_vfr)
+def configure_vmx(config_devs, vals):
+ """Create the config for VMX devices.
+ """
+ memmap = vals.memmap
+ device_model = vals.device_model
+ device_config = vals.device_config
+ config_devs.append(['memmap', memmap])
+ config_devs.append(['device_model', device_model])
+ config_devs.append(['device_config', device_config])
def make_config(vals):
"""Create the domain configuration.
@@ -343,6 +387,8 @@ def make_config(vals):
configure_disks(config_devs, vals)
configure_pci(config_devs, vals)
configure_vifs(config_devs, vals)
+ configure_usb(config_devs, vals)
+ configure_vmx(config_devs, vals)
config += config_devs
return config
@@ -383,7 +429,7 @@ def preprocess_vifs(opts, vals):
(k, v) = b.strip().split('=', 1)
k = k.strip()
v = v.strip()
- if k not in ['mac', 'bridge', 'script', 'backend', 'ip']:
+ if k not in ['mac', 'be_mac', 'bridge', 'script', 'backend', 'ip']:
opts.err('Invalid vif specifier: ' + vif)
d[k] = v
vifs.append(d)