From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yosuke Iwamatsu Subject: [PATCH] XM/XenAPI: Add CDROM Support to XM on Xen API Date: Mon, 12 May 2008 19:21:54 +0900 Message-ID: <48281A42.6020203@ab.jp.nec.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090706090606020405090102" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------090706090606020405090102 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Currently all the VBD devices are recognized as hard disks when creating domains by xm command through xen api. Attached patch correctly sets vbd_type param to 'CD' if the device is supposed to be seen as a cdrom from the guest. Regards, ----------------------- Yosuke Iwamatsu NEC Corporation --------------090706090606020405090102 Content-Type: all/allfiles; name="cdrom_xm_xenapi.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cdrom_xm_xenapi.patch" XM/XenAPI: Add cdrom support when creating domains by xm through Xen API. Signed-off-by: Yosuke Iwamatsu diff -r 810d8c3ac992 tools/python/xen/xm/xenapi_create.py --- a/tools/python/xen/xm/xenapi_create.py Thu May 08 16:58:33 2008 +0100 +++ b/tools/python/xen/xm/xenapi_create.py Mon May 12 16:59:16 2008 +0900 @@ -31,6 +31,7 @@ import sys import sys import os import traceback +import re def log(_, msg): #print "> " + msg @@ -707,9 +708,11 @@ class sxp2xml: = get_child_by_name(vbd_sxp, "mode") != "w" \ and "RO" or "RW" vbd.attributes["device"] \ - = get_child_by_name(vbd_sxp, "dev") + = re.sub(":cdrom$", "", get_child_by_name(vbd_sxp, "dev")) vbd.attributes["bootable"] = "1" - vbd.attributes["type"] = "disk" + vbd.attributes["type"] \ + = re.search(":cdrom$", get_child_by_name(vbd_sxp, "dev")) \ + and "CD" or "disk" vbd.attributes["qos_algorithm_type"] = "" return vbd --------------090706090606020405090102 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------090706090606020405090102--