ia64/xen-unstable

changeset 17641:9da75b150015

XM/XenAPI: Add cdrom support when creating domains by xm through Xen API.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 13 09:48:55 2008 +0100 (2008-05-13)
parents 900228550847
children 22f589f09da5
files tools/python/xen/xm/xenapi_create.py
line diff
     1.1 --- a/tools/python/xen/xm/xenapi_create.py	Tue May 13 09:48:40 2008 +0100
     1.2 +++ b/tools/python/xen/xm/xenapi_create.py	Tue May 13 09:48:55 2008 +0100
     1.3 @@ -31,6 +31,7 @@ import xen.util.xsm.xsm as security
     1.4  import sys
     1.5  import os
     1.6  import traceback
     1.7 +import re
     1.8  
     1.9  def log(_, msg):
    1.10      #print "> " + msg
    1.11 @@ -707,9 +708,11 @@ class sxp2xml:
    1.12              = get_child_by_name(vbd_sxp, "mode") != "w" \
    1.13                and "RO" or "RW"
    1.14          vbd.attributes["device"] \
    1.15 -            = get_child_by_name(vbd_sxp, "dev")
    1.16 +            = re.sub(":cdrom$", "", get_child_by_name(vbd_sxp, "dev"))
    1.17          vbd.attributes["bootable"] = "1"
    1.18 -        vbd.attributes["type"] = "disk"
    1.19 +        vbd.attributes["type"] \
    1.20 +            = re.search(":cdrom$", get_child_by_name(vbd_sxp, "dev")) \
    1.21 +              and "CD" or "disk"
    1.22          vbd.attributes["qos_algorithm_type"] = ""
    1.23  
    1.24          return vbd