]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix a message format error in migration cleanup
authorJuan Manuel Olle <juan.m.olle@intel.com>
Thu, 22 May 2014 13:24:36 +0000 (10:24 -0300)
committerJuan Manuel Olle <juan.m.olle@intel.com>
Thu, 29 May 2014 17:35:27 +0000 (14:35 -0300)
In some situations, the volume migration failed. After the cleanup
begin, code was trying to format a string value as an int,
this caused "copy_error = True" not being invoked, resulted
in UnboundLocalError exception.

Change-Id: I445394cc06fe221804901e8014d60e870f0fe2f7
Closes-Bug: #1290317

cinder/volume/driver.py

index 0852e29ca91c9241cc1951cc3eab4618b4981907..ae8753f3aac4dd22fc8133c1b55fa1862eceabe6 100644 (file)
@@ -309,6 +309,7 @@ class VolumeDriver(object):
                 self._detach_volume(context, dest_attach_info, dest_vol,
                                     properties, force=True, remote=dest_remote)
 
+        copy_error = True
         try:
             size_in_mb = int(src_vol['size']) * 1024    # vol size is in GB
             volume_utils.copy_volume(
@@ -319,9 +320,8 @@ class VolumeDriver(object):
             copy_error = False
         except Exception:
             with excutils.save_and_reraise_exception():
-                msg = _("Failed to copy volume %(src)s to %(dest)d")
+                msg = _("Failed to copy volume %(src)s to %(dest)s.")
                 LOG.error(msg % {'src': src_vol['id'], 'dest': dest_vol['id']})
-                copy_error = True
         finally:
             self._detach_volume(context, dest_attach_info, dest_vol,
                                 properties, force=copy_error,