VMware: Fix exception logging

At some places, logging.exception is called with a formatted
string containing info of the current exception. The exception
info in the log message is redundant since logging.exception
always logs the current exception.

Change-Id: I4ec6b3dabf6e0f2c22b06bd65d765eaa453b819d
Closes-Bug: #1269345
This commit is contained in:
Vipin Balachandran 2015-03-11 04:53:02 +05:30
parent b7452ac30b
commit 15ee40e627
1 changed files with 8 additions and 7 deletions

View File

@ -1222,13 +1222,13 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
vm_import_spec=vm_import_spec,
image_size=image_size)
except (exceptions.VimException,
exceptions.VMwareDriverException) as excep:
exceptions.VMwareDriverException):
with excutils.save_and_reraise_exception():
LOG.exception(_LE("Exception in copy_image_to_volume: %s."),
excep)
LOG.exception(_LE("Error occurred while copying image: %(id)s "
"to volume: %(vol)s."),
{'id': image_id, 'vol': volume['name']})
backing = self.volumeops.get_backing(volume['name'])
if backing:
LOG.exception(_LE("Deleting the backing: %s"), backing)
# delete the backing
self.volumeops.delete_backing(backing)
@ -1314,10 +1314,11 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
context, volume, image_service, image_id,
image_size_in_bytes, image_adapter_type, image_disk_type)
except (exceptions.VimException,
exceptions.VMwareDriverException) as excep:
exceptions.VMwareDriverException):
with excutils.save_and_reraise_exception():
LOG.exception(_LE("Exception in copying the image to the "
"volume: %s."), excep)
LOG.exception(_LE("Error occurred while copying image: %(id)s "
"to volume: %(vol)s."),
{'id': image_id, 'vol': volume['name']})
LOG.debug("Volume: %(id)s created from image: %(image_id)s.",
{'id': volume['id'],