WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Device model SXP cleanup

To: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Device model SXP cleanup
From: Arun Sharma <arun.sharma@xxxxxxxxx>
Date: Mon, 11 Jul 2005 12:48:00 -0700
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 11 Jul 2005 19:42:10 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
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@xxxxxxxxx>
Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>

--- 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')))

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Device model SXP cleanup, Arun Sharma <=