# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# 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 <atse@xxxxxxxxxxxxx>
---
tools/python/xen/xend/XendAPI.py | 6 ++++++
tools/python/xen/xend/XendDomainInfo.py | 8 ++++++++
2 files changed, 14 insertions(+)
diff -r 8331aca2f29c -r 4f5772324e67 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py Wed Jan 24 12:02:56 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py Wed Jan 24 12:07:54 2007 +0000
@@ -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 -r 8331aca2f29c -r 4f5772324e67 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Wed Jan 24 12:02:56 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Wed Jan 24 12:07:54 2007 +0000
@@ -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
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|