ia64/xen-unstable

changeset 14479:dace880e871a

When creating a VBD, save the devid in the device info structure. If creation
fails, remove the device config entry.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Mar 20 11:44:13 2007 +0000 (2007-03-20)
parents 8b527e3d27d6
children e2f302488983
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 20 11:34:14 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 20 11:44:13 2007 +0000
     1.3 @@ -2301,12 +2301,21 @@ class XendDomainInfo:
     1.4              dev_control = None
     1.5              
     1.6              if vdi_image_path.startswith('tap'):
     1.7 -                dev_control =  self.getDeviceController('tap')
     1.8 +                dev_control = self.getDeviceController('tap')
     1.9              else:
    1.10                  dev_control = self.getDeviceController('vbd')
    1.11 -                
    1.12 -            config['devid'] = dev_control.createDevice(config)
    1.13  
    1.14 +            try:
    1.15 +                devid = dev_control.createDevice(config)
    1.16 +                dev_control.waitForDevice(devid)
    1.17 +                self.info.device_update(dev_uuid,
    1.18 +                                        cfg_xenapi = {'devid': devid})
    1.19 +            except Exception, exn:
    1.20 +                log.exception(exn)
    1.21 +                del self.info['devices'][dev_uuid]
    1.22 +                self.info['vbd_refs'].remove(dev_uuid)
    1.23 +                raise
    1.24 +            
    1.25          return dev_uuid
    1.26  
    1.27      def create_phantom_vbd_with_vdi(self, xenapi_vbd, vdi_image_path):