Skip to contentSkip to conversation

XM/XenAPI: Add CDROM Support to XM on Xen API

PATCH New Yosuke Iwamatsu 1 participant 1 message May 12, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 XM/XenAPI: Add CDROM Support to XM on Xen API

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

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

tools/python/xen/xm/xenapi_create.py +5 -2
diff -r 810d8c3ac992 tools/python/xen/xm/xenapi_create.py
@@ -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

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel