From ddcad011db507cde66b6b1e655d5ffc91ab8880f Mon Sep 17 00:00:00 2001 From: Alessandro Pilotti Date: Wed, 27 Aug 2014 00:38:43 +0300 Subject: [PATCH] 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 --- cinder/volume/manager.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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 -- 2.45.2