From 15ee40e627f236011c9117fa65748fe4f03843d1 Mon Sep 17 00:00:00 2001 From: Vipin Balachandran Date: Wed, 11 Mar 2015 04:53:02 +0530 Subject: [PATCH] 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 --- cinder/volume/drivers/vmware/vmdk.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cinder/volume/drivers/vmware/vmdk.py b/cinder/volume/drivers/vmware/vmdk.py index ca555a67f07..35af423329a 100644 --- a/cinder/volume/drivers/vmware/vmdk.py +++ b/cinder/volume/drivers/vmware/vmdk.py @@ -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'],