]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
VMware: Fix exception logging
authorVipin Balachandran <vbala@vmware.com>
Tue, 10 Mar 2015 23:23:02 +0000 (04:53 +0530)
committerVipin Balachandran <vbala@vmware.com>
Tue, 10 Mar 2015 23:58:55 +0000 (05:28 +0530)
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

index ca555a67f07b0913bf7f2ea8738824e2aa7677ea..35af423329afbab1960833b19bf087996408f250 100644 (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'],