From f84a08528a5a604dbbff7e4ae0bdcd0e4e3fc19d Mon Sep 17 00:00:00 2001 From: Armando Migliaccio Date: Tue, 17 Jan 2012 18:45:53 +0000 Subject: blueprint host-aggregates: OSAPI extensions This commit introduces the OSAPI admin extensions for host aggregates. This is part of a series of commits that have started with change: https://review.openstack.org/#change,3035 Change-Id: If0c92dca7d6f5d794f84bdb2adc172c55dec6e74 --- nova/compute/api.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index fcc1f1652..0f1587dde 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1849,10 +1849,14 @@ class AggregateAPI(base.Base): "args": {"aggregate_id": aggregate_id, "host": host}, }) return self.get_aggregate(context, aggregate_id) - elif aggregate.operational_state == aggregate_states.DISMISSED: - raise exception.InvalidAggregateAction(action='add host', - aggregate_id=aggregate_id, - reason='aggregate deleted') + else: + invalid = {aggregate_states.CHANGING: 'setup in progress', + aggregate_states.DISMISSED: 'aggregate deleted', } + if aggregate.operational_state in invalid.keys(): + raise exception.\ + InvalidAggregateAction(action='remove host', + aggregate_id=aggregate_id, + reason=invalid[aggregate.operational_state]) def _get_aggregate_info(self, context, aggregate): """Builds a dictionary with aggregate props, metadata and hosts.""" -- cgit