# HG changeset patch # User Alastair Tse # Date 1169640474 0 # Node ID 4f5772324e679e9794ccd72848023c081d7300da # Parent 8331aca2f29ca29704f4bafabe0e542f312d6950 [XEND] Strip suffix from device name and add support for 'VBD.type' Signed-off-by: Alastair Tse Index: xen-3.0.4-testing/tools/python/xen/xend/XendAPI.py =================================================================== --- xen-3.0.4-testing.orig/tools/python/xen/xend/XendAPI.py +++ xen-3.0.4-testing/tools/python/xen/xend/XendAPI.py @@ -1040,6 +1040,7 @@ class XendAPI: 'VDI', 'device', 'mode', + 'type', 'driver'] VBD_attr_inst = VBD_attr_rw + ['image'] @@ -1117,6 +1118,11 @@ class XendAPI: return xen_api_success(xendom.get_dev_property('vbd', vbd_ref, 'driver')) + def VBD_get_type(self, session, vbd_ref): + xendom = XendDomain.instance() + return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref, + 'type')) + # Xen API: Class VIF # ---------------------------------------------------------------- Index: xen-3.0.4-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-3.0.4-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-3.0.4-testing/tools/python/xen/xend/XendDomainInfo.py @@ -1988,6 +1988,14 @@ class XendDomainInfo: if dev_class == 'vbd': config['VDI'] = config.get('VDI', '') config['device'] = config.get('dev', '') + if ':' in config['device']: + vbd_name, vbd_type = config['device'].split(':', 1) + config['device'] = vbd_name + if vbd_type == 'cdrom': + config['type'] = XEN_API_VBD_TYPE[0] + else: + config['type'] = XEN_API_VBD_TYPE[1] + config['driver'] = 'paravirtualised' # TODO config['image'] = config.get('uname', '') config['io_read_kbs'] = 0.0