From: Alastair Tse Date: Wed, 24 Jan 2007 12:07:54 +0000 (+0000) Subject: [XEND] Strip suffix from device name and add support for 'VBD.type' X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15371^2~81 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e8d1d260310f7700a5c4200ca299b533aa84be9f;p=xen.git [XEND] Strip suffix from device name and add support for 'VBD.type' Signed-off-by: Alastair Tse --- diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index a7ae50fafb..19e7ce6222 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -1090,6 +1090,7 @@ class XendAPI: 'VDI', 'device', 'mode', + 'type', 'driver'] VBD_attr_inst = VBD_attr_rw + ['image'] @@ -1170,6 +1171,11 @@ class XendAPI: return xen_api_success(xendom.get_dev_property_by_uuid('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 # ---------------------------------------------------------------- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 7d9808d6eb..554ce9adca 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -2058,6 +2058,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