# to initialize the driver correctly.
return
- # at this point the driver is considered initailized.
- # next re-initialize exports and clean up volumes that
- # should be deleted.
- self.driver.set_initialized()
-
volumes = self.db.volume_get_all_by_host(ctxt, self.host)
LOG.debug(_("Re-exporting %s volumes"), len(volumes))
- for volume in volumes:
- if volume['status'] in ['available', 'in-use']:
- self.driver.ensure_export(ctxt, volume)
- elif volume['status'] == 'downloading':
- LOG.info(_("volume %s stuck in a downloading state"),
- volume['id'])
- self.driver.clear_download(ctxt, volume)
- self.db.volume_update(ctxt, volume['id'], {'status': 'error'})
- else:
- LOG.info(_("volume %s: skipping export"), volume['id'])
+
+ try:
+ for volume in volumes:
+ if volume['status'] in ['available', 'in-use']:
+ self.driver.ensure_export(ctxt, volume)
+ elif volume['status'] == 'downloading':
+ LOG.info(_("volume %s stuck in a downloading state"),
+ volume['id'])
+ self.driver.clear_download(ctxt, volume)
+ self.db.volume_update(ctxt,
+ volume['id'],
+ {'status': 'error'})
+ else:
+ LOG.info(_("volume %s: skipping export"), volume['id'])
+ except Exception as ex:
+ LOG.error(_("Error encountered during "
+ "re-exporting phase of driver initialization: "
+ " %(name)s") %
+ {'name': self.driver.__class__.__name__})
+ LOG.exception(ex)
+ return
+
+ # at this point the driver is considered initialized.
+ self.driver.set_initialized()
LOG.debug(_('Resuming any in progress delete operations'))
for volume in volumes: