]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixes terminate_connection live migration issue
authorAlessandro Pilotti <apilotti@cloudbasesolutions.com>
Tue, 26 Aug 2014 21:38:43 +0000 (00:38 +0300)
committerAlessandro Pilotti <apilotti@cloudbasesolutions.com>
Wed, 27 Aug 2014 01:03:54 +0000 (04:03 +0300)
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

index 1614b5d5c3af034d248c3bd440ff6bfecd3def27..9a21a7e216b61d4e318944f910f9ecbf76a5877c 100644 (file)
@@ -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