From 6d0d9e288f9333d88a73f4e0f0222a0064e905e9 Mon Sep 17 00:00:00 2001 From: Kun Huang Date: Mon, 22 Jul 2013 00:19:08 +0800 Subject: [PATCH] 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 --- cinder/volume/manager.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) 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): -- 2.45.2