From e5d459ae7176f25c2b43606e37c049a52e54e5dc Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Mon, 2 Dec 2013 14:58:57 -0500 Subject: [PATCH] Don't stop volume service for failed re-export operations Commit b71570 "Set vol driver initialized before deleting volumes" changed the manager behavior to call set_initialized() before attempting to re-export volumes. Drivers should not be considered initialized before re-export has succeeded. Otherwise a failure to export causes the volume service to stop, when that failure should be handled like any other failure to initialize. Closes-Bug: 1257049 Related-Bug: 1232177 Change-Id: Ic6bc89ef3f15dbbc971fdd8c91117cccb5c2801b --- cinder/volume/manager.py | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index fcfd80dc8..413311ba5 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -198,23 +198,32 @@ class VolumeManager(manager.SchedulerDependentManager): # 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: -- 2.45.2