From: Alessandro Pilotti Date: Tue, 26 Aug 2014 21:38:43 +0000 (+0300) Subject: Fixes terminate_connection live migration issue X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ddcad011db507cde66b6b1e655d5ffc91ab8880f;p=openstack-build%2Fcinder-build.git Fixes terminate_connection live migration issue Reverts the changes to cinder/volume/manager.py added in commit b868ae707f9ecbe254101e21d9d7ffa0b05b17d1 as calling remove_export in terminate_connection causes Nova live migration to fail when volumes are attached. Change-Id: I38f3db336db22bb096a8855bcbbfeba16e517b80 Closes-Bug: #1361738 --- diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 1614b5d5c..9a21a7e21 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -673,11 +673,18 @@ class VolumeManager(manager.SchedulerDependentManager): volume = self.db.volume_get(context, volume_id) try: utils.require_driver_initialized(self.driver) + LOG.debug("volume %s: removing export", volume_id) + self.driver.remove_export(context.elevated(), volume) except exception.DriverNotInitialized: with excutils.save_and_reraise_exception(): LOG.exception(_("Error detaching volume %(volume)s, " "due to uninitialized driver."), {"volume": volume_id}) + except Exception as ex: + LOG.exception(_("Error detaching volume %(volume)s, " + "due to remove export failure."), + {"volume": volume_id}) + raise exception.RemoveExportException(volume=volume_id, reason=ex) self._notify_about_volume_usage(context, volume, "detach.end") @@ -870,15 +877,6 @@ class VolumeManager(manager.SchedulerDependentManager): LOG.error(err_msg) raise exception.VolumeBackendAPIException(data=err_msg) - try: - LOG.debug("volume %s: removing export", volume_id) - self.driver.remove_export(context.elevated(), volume_ref) - except Exception as ex: - LOG.exception(_("Error detaching volume %(volume)s, " - "due to remove export failure."), - {"volume": volume_id}) - raise exception.RemoveExportException(volume=volume_id, reason=ex) - def accept_transfer(self, context, volume_id, new_user, new_project): # NOTE(flaper87): Verify the driver is enabled # before going forward. The exception will be caught