From: Kun Huang Date: Sun, 21 Jul 2013 16:19:08 +0000 (+0800) Subject: use 'exc_info=1' instead of import traceback X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6d0d9e288f9333d88a73f4e0f0222a0064e905e9;p=openstack-build%2Fcinder-build.git use 'exc_info=1' instead of import traceback We need store traceback message in log sometime. Python logging module already provide a argument to do that. For example, we could: logger.error('msg', exc_info=1) logger.debug(e, exc_info=(type_,value_,tb)) logger.exception('msg') # exception add exc_info automaticly Change-Id: Iaf541e4f4ea139d9315ac1990f0e6079c8f8a20d --- diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 6b0fb3e22..8d831ff46 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -296,8 +296,7 @@ class VolumeManager(manager.SchedulerDependentManager): filter_properties) if rescheduled: - # log the original build error - self._log_original_error(exc_info) + LOG.error(_('Unexpected Error: '), exc_info=exc_info) msg = (_('Creating %(volume_id)s %(snapshot_id)s ' '%(image_id)s was rescheduled due to ' '%(reason)s') @@ -378,11 +377,6 @@ class VolumeManager(manager.SchedulerDependentManager): self._notify_about_volume_usage(context, volume_ref, "create.end") return volume_ref['id'] - def _log_original_error(self, exc_info): - type_, value, tb = exc_info - LOG.error(_('Error: %s') % - traceback.format_exception(type_, value, tb)) - def _reschedule_or_error(self, context, volume_id, exc_info, snapshot_id, image_id, request_spec, filter_properties):