ia64/xen-unstable

changeset 6201:75367adf6055

Distinguish ioemu handled devices and para virtualized devices

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author adsharma@los-vmm.sc.intel.com
date Mon Aug 15 12:50:32 2005 -0800 (2005-08-15)
parents a56b490fa41d
children b310a1b71b54
files tools/examples/xmexample.vmx tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py tools/python/xen/xend/server/blkif.py
line diff
     1.1 --- a/tools/examples/xmexample.vmx	Mon Aug 15 12:50:25 2005 -0800
     1.2 +++ b/tools/examples/xmexample.vmx	Mon Aug 15 12:50:32 2005 -0800
     1.3 @@ -34,7 +34,7 @@ name = "ExampleVMXDomain"
     1.4  # and MODE is r for read-only, w for read-write.
     1.5  
     1.6  #disk = [ 'phy:hda1,hda1,r' ]
     1.7 -disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]
     1.8 +disk = [ 'file:/var/images/min-el3-i386.img,ioemu:hda,w' ]
     1.9  
    1.10  #----------------------------------------------------------------------------
    1.11  # Set according to whether you want the domain restarted when it exits.
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Aug 15 12:50:25 2005 -0800
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Aug 15 12:50:32 2005 -0800
     2.3 @@ -743,8 +743,7 @@ class XendDomainInfo:
     2.4              for ctrl in self.getDeviceControllers():
     2.5                  ctrl.initController(reboot=True)
     2.6          else:
     2.7 -	    if self.image.ostype != 'vmx':
     2.8 -                self.create_configured_devices()
     2.9 +            self.create_configured_devices()
    2.10          if not self.device_model_pid:
    2.11              self.device_model_pid = self.image.createDeviceModel()
    2.12  
    2.13 @@ -916,8 +915,7 @@ class XendDomainInfo:
    2.14          """
    2.15          self.configure_fields()
    2.16          self.create_devices()
    2.17 -	if self.image.ostype != 'vmx':
    2.18 -            self.create_blkif()
    2.19 +        self.create_blkif()
    2.20  
    2.21      def create_blkif(self):
    2.22          """Create the block device interface (blkif) for the vm.
     3.1 --- a/tools/python/xen/xend/image.py	Mon Aug 15 12:50:25 2005 -0800
     3.2 +++ b/tools/python/xen/xend/image.py	Mon Aug 15 12:50:32 2005 -0800
     3.3 @@ -16,6 +16,7 @@
     3.4  #============================================================================
     3.5  
     3.6  import os, string
     3.7 +import re
     3.8  
     3.9  import xen.lowlevel.xc; xc = xen.lowlevel.xc.new()
    3.10  from xen.xend import sxp
    3.11 @@ -329,8 +330,15 @@ class VmxImageHandler(ImageHandler):
    3.12              if name == 'vbd':
    3.13                 vbdinfo = sxp.child(device, 'vbd')
    3.14                 uname = sxp.child_value(vbdinfo, 'uname')
    3.15 -               vbddev = sxp.child_value(vbdinfo, 'dev')
    3.16 +               typedev = sxp.child_value(vbdinfo, 'dev')
    3.17                 (vbdtype, vbdparam) = string.split(uname, ':', 1)
    3.18 +               if re.match('^ioemu:', typedev):
    3.19 +                  (emtype, vbddev) = string.split(typedev, ':', 1)
    3.20 +               else:
    3.21 +                  emtype = 'vbd'
    3.22 +                  vbddev = typedev
    3.23 +               if emtype != 'ioemu':
    3.24 +                  continue;
    3.25                 vbddev_list = ['hda', 'hdb', 'hdc', 'hdd']
    3.26                 if vbddev not in vbddev_list:
    3.27                    raise VmError("vmx: for qemu vbd type=file&dev=hda~hdd")
     4.1 --- a/tools/python/xen/xend/server/blkif.py	Mon Aug 15 12:50:25 2005 -0800
     4.2 +++ b/tools/python/xen/xend/server/blkif.py	Mon Aug 15 12:50:32 2005 -0800
     4.3 @@ -18,6 +18,7 @@
     4.4  """Support for virtual block devices.
     4.5  """
     4.6  import string
     4.7 +import re
     4.8  
     4.9  from xen.util import blkif
    4.10  from xen.xend.XendError import XendError, VmError
    4.11 @@ -199,6 +200,7 @@ class BlkDev(Dev):
    4.12          self.vdev = None
    4.13          self.mode = None
    4.14          self.type = None
    4.15 +        self.emtype = None
    4.16          self.params = None
    4.17          self.node = None
    4.18          self.device = None
    4.19 @@ -237,7 +239,12 @@ class BlkDev(Dev):
    4.20          # Split into type and type-specific params (which are passed to the
    4.21          # type-specific control script).
    4.22          (self.type, self.params) = string.split(self.uname, ':', 1)
    4.23 -        self.dev = sxp.child_value(config, 'dev')
    4.24 +        typedev = sxp.child_value(config, 'dev')
    4.25 +        if re.match( '^ioemu:', typedev):
    4.26 +            (self.emtype, self.dev) = string.split(typedev, ':', 1)
    4.27 +        else:
    4.28 +            self.emtype = 'vbd'
    4.29 +            self.dev = typedev
    4.30          if not self.dev:
    4.31              raise VmError('vbd: Missing dev')
    4.32          self.mode = sxp.child_value(config, 'mode', 'r')
    4.33 @@ -258,6 +265,8 @@ class BlkDev(Dev):
    4.34          if recreate:
    4.35              pass
    4.36          else:
    4.37 +            if self.emtype == 'ioemu':
    4.38 +                return
    4.39              node = Blkctl.block('bind', self.type, self.params)
    4.40              self.setNode(node)
    4.41              self.attachBackend()