direct-io.hg

changeset 6486:6a87d79f9ee0

Fix config file parsing for VMX domains.

If we define "vif" in the config file, image.py will raise error "vmx:
missing vbd configuration". The reason is "vif" is dealt with as a "vbd"
device.

This patch fixes this issue by dealing with "vbd" and "vif " separately,
removing "macaddr" arg and parsing mac address from "vif" instead.

Also, the vbd doesn't have to be a file anymore, but can be a physical
disk partition.

Signed-off-by: Yunfeng Zhao <yunfeng.zhao@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author adsharma@los-vmm.sc.intel.com
date Tue Aug 09 11:06:44 2005 -0800 (2005-08-09)
parents 38c7c25b3cb9
children d481d2776e89
files tools/examples/xmexample.vmx tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/examples/xmexample.vmx	Tue Aug 09 13:53:15 2005 +0000
     1.2 +++ b/tools/examples/xmexample.vmx	Tue Aug 09 11:06:44 2005 -0800
     1.3 @@ -132,8 +132,3 @@ vnc=1
     1.4  #-----------------------------------------------------------------------------
     1.5  #    start in full screen
     1.6  #full-screen=1   
     1.7 -
     1.8 -#-----------------------------------------------------------------------------
     1.9 -#   set the mac address of the first interface
    1.10 -#macaddr=  
    1.11 -
     2.1 --- a/tools/python/xen/xend/image.py	Tue Aug 09 13:53:15 2005 +0000
     2.2 +++ b/tools/python/xen/xend/image.py	Tue Aug 09 11:06:44 2005 -0800
     2.3 @@ -295,7 +295,7 @@ class VmxImageHandler(ImageHandler):
     2.4      # xm config file
     2.5      def parseDeviceModelArgs(self):
     2.6  	dmargs = [ 'cdrom', 'boot', 'fda', 'fdb',
     2.7 -                   'localtime', 'serial', 'macaddr', 'stdvga', 'isa' ] 
     2.8 +                   'localtime', 'serial', 'stdvga', 'isa' ] 
     2.9  	ret = []
    2.10  	for a in dmargs:
    2.11         	    v = sxp.child_value(self.vm.config, a)
    2.12 @@ -312,20 +312,25 @@ class VmxImageHandler(ImageHandler):
    2.13  		ret.append("-%s" % a)
    2.14  		ret.append("%s" % v)
    2.15  
    2.16 -        # Handle hd img related options
    2.17 +        # Handle disk/network related options
    2.18          devices = sxp.children(self.vm.config, 'device')
    2.19          for device in devices:
    2.20 -            vbdinfo = sxp.child(device, 'vbd')
    2.21 -            if not vbdinfo:
    2.22 -                raise VmError("vmx: missing vbd configuration")
    2.23 -            uname = sxp.child_value(vbdinfo, 'uname')
    2.24 -            vbddev = sxp.child_value(vbdinfo, 'dev')
    2.25 -            (vbdtype, vbdparam) = string.split(uname, ':', 1)
    2.26 -            vbddev_list = ['hda', 'hdb', 'hdc', 'hdd']
    2.27 -            if vbdtype != 'file' or vbddev not in vbddev_list:
    2.28 -                raise VmError("vmx: for qemu vbd type=file&dev=hda~hdd")
    2.29 -            ret.append("-%s" % vbddev)
    2.30 -            ret.append("%s" % vbdparam)
    2.31 +            name = sxp.name(sxp.child0(device))
    2.32 +            if name == 'vbd':
    2.33 +               vbdinfo = sxp.child(device, 'vbd')
    2.34 +               uname = sxp.child_value(vbdinfo, 'uname')
    2.35 +               vbddev = sxp.child_value(vbdinfo, 'dev')
    2.36 +               (vbdtype, vbdparam) = string.split(uname, ':', 1)
    2.37 +               vbddev_list = ['hda', 'hdb', 'hdc', 'hdd']
    2.38 +               if vbddev not in vbddev_list:
    2.39 +                  raise VmError("vmx: for qemu vbd type=file&dev=hda~hdd")
    2.40 +               ret.append("-%s" % vbddev)
    2.41 +               ret.append("%s" % vbdparam)
    2.42 +            if name == 'vif':
    2.43 +               vifinfo = sxp.child(device, 'vif')
    2.44 +               mac = sxp.child_value(vifinfo, 'mac')
    2.45 +               ret.append("-macaddr")
    2.46 +               ret.append("%s" % mac)
    2.47  
    2.48  	# Handle graphics library related options
    2.49  	vnc = sxp.child_value(self.vm.config, 'vnc')