Merge "Use utils.save_and_reraise_exception"
This commit is contained in:
commit
d0392a27e7
@ -2523,11 +2523,10 @@ class ComputeManager(manager.SchedulerDependentManager):
|
|||||||
try:
|
try:
|
||||||
self.driver.add_to_aggregate(context, aggregate, host, **kwargs)
|
self.driver.add_to_aggregate(context, aggregate, host, **kwargs)
|
||||||
except exception.AggregateError:
|
except exception.AggregateError:
|
||||||
error = sys.exc_info()
|
with utils.save_and_reraise_exception():
|
||||||
self._undo_aggregate_operation(context,
|
self._undo_aggregate_operation(context,
|
||||||
self.db.aggregate_host_delete,
|
self.db.aggregate_host_delete,
|
||||||
aggregate.id, host)
|
aggregate.id, host)
|
||||||
raise error[0], error[1], error[2]
|
|
||||||
|
|
||||||
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
|
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
|
||||||
def remove_aggregate_host(self, context, aggregate_id, host, **kwargs):
|
def remove_aggregate_host(self, context, aggregate_id, host, **kwargs):
|
||||||
@ -2538,12 +2537,11 @@ class ComputeManager(manager.SchedulerDependentManager):
|
|||||||
aggregate, host, **kwargs)
|
aggregate, host, **kwargs)
|
||||||
except (exception.AggregateError,
|
except (exception.AggregateError,
|
||||||
exception.InvalidAggregateAction) as e:
|
exception.InvalidAggregateAction) as e:
|
||||||
error = sys.exc_info()
|
with utils.save_and_reraise_exception():
|
||||||
self._undo_aggregate_operation(
|
self._undo_aggregate_operation(
|
||||||
context, self.db.aggregate_host_add,
|
context, self.db.aggregate_host_add,
|
||||||
aggregate.id, host,
|
aggregate.id, host,
|
||||||
isinstance(e, exception.AggregateError))
|
isinstance(e, exception.AggregateError))
|
||||||
raise error[0], error[1], error[2]
|
|
||||||
|
|
||||||
def _undo_aggregate_operation(self, context, op, aggregate_id,
|
def _undo_aggregate_operation(self, context, op, aggregate_id,
|
||||||
host, set_error=True):
|
host, set_error=True):
|
||||||
|
Loading…
Reference in New Issue
Block a user