From: Juan Manuel Olle Date: Thu, 22 May 2014 13:24:36 +0000 (-0300) Subject: Fix a message format error in migration cleanup X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7521e6dce39a9ec99d35892780a39bf8049e38db;p=openstack-build%2Fcinder-build.git Fix a message format error in migration cleanup 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 --- diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 0852e29ca..ae8753f3a 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -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,