aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/examples/xmexample.vmx5
-rw-r--r--tools/python/xen/xend/image.py24
-rw-r--r--tools/python/xen/xm/create.py27
3 files changed, 25 insertions, 31 deletions
diff --git a/tools/examples/xmexample.vmx b/tools/examples/xmexample.vmx
index ac14459225..1c85a02d4c 100644
--- a/tools/examples/xmexample.vmx
+++ b/tools/examples/xmexample.vmx
@@ -46,6 +46,7 @@ nics=0
# and MODE is r for read-only, w for read-write.
#disk = [ 'phy:hda1,hda1,r' ]
+disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]
#----------------------------------------------------------------------------
# Set the kernel command line for the new domain.
@@ -96,10 +97,6 @@ memmap = '/usr/lib/xen/boot/mem-map.sxp'
#-----------------------------------------------------------------------------
# Disk image for
-hda='/var/images/min-el3-i386.img'
-#hdb=
-#hdc=
-#hdd=
#cdrom=
#-----------------------------------------------------------------------------
diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py
index aed0f95435..8c8f2027b4 100644
--- a/tools/python/xen/xend/image.py
+++ b/tools/python/xen/xend/image.py
@@ -265,7 +265,7 @@ class VmxImageHandler(ImageHandler):
# Return a list of cmd line args to the device models based on the
# xm config file
def parseDeviceModelArgs(self):
- dmargs = [ 'hda', 'hdb', 'hdc', 'hdd', 'cdrom', 'boot', 'fda', 'fdb',
+ dmargs = [ 'cdrom', 'boot', 'fda', 'fdb',
'localtime', 'serial', 'macaddr', 'stdvga', 'isa' ]
ret = []
for a in dmargs:
@@ -276,17 +276,31 @@ class VmxImageHandler(ImageHandler):
# Handle booleans gracefully
if a in ['localtime', 'std-vga', 'isa']:
- v = int(v)
+ if v != None: v = int(v)
log.debug("args: %s, val: %s" % (a,v))
if v:
ret.append("-%s" % a)
ret.append("%s" % v)
+ # Handle hd img related options
+ device = sxp.child(self.vm.config, 'device')
+ vbdinfo = sxp.child(device, 'vbd')
+ if not vbdinfo:
+ raise VmError("vmx: missing vbd configuration")
+ uname = sxp.child_value(vbdinfo, 'uname')
+ vbddev = sxp.child_value(vbdinfo, 'dev')
+ (vbdtype, vbdparam) = string.split(uname, ':', 1)
+ vbddev_list = ['hda', 'hdb', 'hdc', 'hdd']
+ if vbdtype != 'file' or vbddev not in vbddev_list:
+ raise VmError("vmx: for qemu vbd type=file&dev=hda~hdd")
+ ret.append("-%s" % vbddev)
+ ret.append("%s" % vbdparam)
+
# Handle graphics library related options
- vnc = int(sxp.child_value(self.vm.config, 'vnc'))
- sdl = int(sxp.child_value(self.vm.config, 'sdl'))
- nographic = int(sxp.child_value(self.vm.config, 'nographic'))
+ vnc = sxp.child_value(self.vm.config, 'vnc')
+ sdl = sxp.child_value(self.vm.config, 'sdl')
+ nographic = sxp.child_value(self.vm.config, 'nographic')
if nographic:
ret.append('-nographic')
return ret
diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py
index 7af150f790..2b86d03676 100644
--- a/tools/python/xen/xm/create.py
+++ b/tools/python/xen/xm/create.py
@@ -254,22 +254,6 @@ gopts.var('device_model', val='FILE',
fn=set_value, default='',
use="Path to device model program.")
-gopts.var('hda', val='FILE',
- fn=set_value, default='',
- use="Path to hda")
-
-gopts.var('hdb', val='FILE',
- fn=set_value, default='',
- use="Path to hdb")
-
-gopts.var('hdc', val='FILE',
- fn=set_value, default='',
- use="Path to hdc")
-
-gopts.var('hdd', val='FILE',
- fn=set_value, default='',
- use="Path to hdd")
-
gopts.var('fda', val='FILE',
fn=set_value, default='',
use="Path to fda")
@@ -442,11 +426,12 @@ def configure_vfr(opts, config, vals):
def configure_vmx(opts, config_devs, vals):
"""Create the config for VMX devices.
"""
- args = [ 'memmap', 'device_model', 'hda', 'hdb', 'hdc', 'hdd', 'cdrom',
+ args = [ 'memmap', 'device_model', 'cdrom',
'boot', 'fda', 'fdb', 'localtime', 'serial', 'macaddr', 'stdvga',
- 'isa', 'nographic', 'vnc', 'sdl', 'display']
+ 'isa', 'nographic', 'vnc', 'sdl', 'display']
for a in args:
- config_devs.append([a, vals.__dict__[a]])
+ if (vals.__dict__[a]):
+ config_devs.append([a, vals.__dict__[a]])
def run_bootloader(opts, config, vals):
if not os.access(vals.bootloader, os.X_OK):
@@ -604,7 +589,7 @@ def preprocess_vnc(opts, vals):
"""If vnc was specified, spawn a vncviewer in listen mode
and pass its address to the domain on the kernel command line.
"""
- if not vals.vnc: return
+ if not vals.vnc or vals.dryrun: return
vnc_display = choose_vnc_display()
if not vnc_display:
opts.warn("No free vnc display")
@@ -678,8 +663,6 @@ def main(argv):
config = opts.vals.config
else:
opts.load_defconfig()
- if opts.vals.dryrun:
- opts.vals.vnc = 0
preprocess(opts, opts.vals)
if not opts.getopt('name') and opts.getopt('defconfig'):
opts.setopt('name', os.path.basename(opts.getopt('defconfig')))