From: Arun Sharma <arun.sharma@intel.com>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>,
Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com
Subject: [PATCH] Device model SXP cleanup
Date: Mon, 11 Jul 2005 12:48:00 -0700 [thread overview]
Message-ID: <20050711194800.GA24500@intel.com> (raw)
Device model SXP cleanup
- don't pollute the sxp with unused options
- use the same syntax as paravirtualized domains for disks
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
--- a/tools/examples/xmexample.vmx Mon Jul 11 14:48:47 2005
+++ b/tools/examples/xmexample.vmx Mon Jul 11 12:45:20 2005
@@ -46,6 +46,7 @@
# 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 @@
#-----------------------------------------------------------------------------
# Disk image for
-hda='/var/images/min-el3-i386.img'
-#hdb=
-#hdc=
-#hdd=
#cdrom=
#-----------------------------------------------------------------------------
diff -r b3cfebba3b30 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py Mon Jul 11 14:48:47 2005
+++ b/tools/python/xen/xend/image.py Mon Jul 11 12:45:20 2005
@@ -265,7 +265,7 @@
# 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 @@
# 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 -r b3cfebba3b30 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py Mon Jul 11 14:48:47 2005
+++ b/tools/python/xen/xm/create.py Mon Jul 11 12:45:20 2005
@@ -253,22 +253,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='',
@@ -442,11 +426,12 @@
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 @@
"""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 @@
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')))
reply other threads:[~2005-07-11 19:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050711194800.GA24500@intel.com \
--to=arun.sharma@intel.com \
--cc=Ian.Pratt@cl.cam.ac.uk \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.