direct-io.hg

changeset 13577:4f5772324e67

[XEND] Strip suffix from device name and add support for 'VBD.type'

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Wed Jan 24 12:07:54 2007 +0000 (2007-01-24)
parents 8331aca2f29c
children f7a52957b427
files tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Wed Jan 24 12:02:56 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Wed Jan 24 12:07:54 2007 +0000
     1.3 @@ -1090,6 +1090,7 @@ class XendAPI:
     1.4                     'VDI',
     1.5                     'device',
     1.6                     'mode',
     1.7 +                   'type',                   
     1.8                     'driver']
     1.9  
    1.10      VBD_attr_inst = VBD_attr_rw + ['image']
    1.11 @@ -1170,6 +1171,11 @@ class XendAPI:
    1.12          return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
    1.13                                                                 'driver'))
    1.14  
    1.15 +    def VBD_get_type(self, session, vbd_ref):
    1.16 +        xendom = XendDomain.instance()
    1.17 +        return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
    1.18 +                                                              'type'))        
    1.19 +
    1.20      # Xen API: Class VIF
    1.21      # ----------------------------------------------------------------
    1.22  
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Jan 24 12:02:56 2007 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Jan 24 12:07:54 2007 +0000
     2.3 @@ -2058,6 +2058,14 @@ class XendDomainInfo:
     2.4          if dev_class == 'vbd':
     2.5              config['VDI'] = config.get('VDI', '')
     2.6              config['device'] = config.get('dev', '')
     2.7 +            if ':' in config['device']:
     2.8 +                vbd_name, vbd_type = config['device'].split(':', 1)
     2.9 +                config['device'] = vbd_name
    2.10 +                if vbd_type == 'cdrom':
    2.11 +                    config['type'] = XEN_API_VBD_TYPE[0]
    2.12 +                else:
    2.13 +                    config['type'] = XEN_API_VBD_TYPE[1]
    2.14 +
    2.15              config['driver'] = 'paravirtualised' # TODO
    2.16              config['image'] = config.get('uname', '')
    2.17              config['io_read_kbs'] = 0.0