From 6247c949f5253737998405f698654644a364a9b7 Mon Sep 17 00:00:00 2001 From: lzyeval Date: Fri, 30 Dec 2011 17:11:03 +0900 Subject: [PATCH] re-raising exceptions fix Fixes bug #910008 Change-Id: I7914fe1eaffeb0be5feb414f3ea0ad563a36c21f --- Authors | 1 + nova/compute/manager.py | 27 ++++++++++++--------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Authors b/Authors index ef9550f54567..ab44d3814070 100644 --- a/Authors +++ b/Authors @@ -151,4 +151,5 @@ Yun Mao Yun Shen Yuriy Taraday Zhixue Wu +Zhongyue Luo Zed Shaw diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 40ef65923c14..ab582114b026 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1509,14 +1509,12 @@ class ComputeManager(manager.SchedulerDependentManager): instance_ref['name'], mountpoint) except Exception: # pylint: disable=W0702 - exc = sys.exc_info() - # NOTE(vish): The inline callback eats the exception info so we - # log the traceback here and reraise the same - # ecxception below. - LOG.exception(_("instance %(instance_uuid)s: attach failed" - " %(mountpoint)s, removing") % locals(), context=context) - self.volume_api.terminate_connection(context, volume_id, address) - raise exc + with utils.save_and_reraise_exception(): + LOG.exception(_("instance %(instance_uuid)s: attach failed" + " %(mountpoint)s, removing") % locals(), + context=context) + self.volume_api.terminate_connection(context, volume_id, + address) self.volume_api.attach(context, volume_id, instance_id, mountpoint) values = { @@ -1749,13 +1747,12 @@ class ComputeManager(manager.SchedulerDependentManager): 'disk': disk}}) except Exception: - exc = sys.exc_info() - i_name = instance_ref.name - msg = _("Pre live migration for %(i_name)s failed at %(dest)s") - LOG.exception(msg % locals()) - self.rollback_live_migration(context, instance_ref, - dest, block_migration) - raise exc + with utils.save_and_reraise_exception(): + i_name = instance_ref.name + msg = _("Pre live migration for %(i_name)s failed at %(dest)s") + LOG.exception(msg % locals()) + self.rollback_live_migration(context, instance_ref, dest, + block_migration) # Executing live migration # live_migration might raises exceptions, but