summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorArmando Migliaccio <armando.migliaccio@eu.citrix.com>2012-01-17 18:45:53 +0000
committerArmando Migliaccio <armando.migliaccio@eu.citrix.com>2012-01-25 18:33:18 +0000
commitf84a08528a5a604dbbff7e4ae0bdcd0e4e3fc19d (patch)
tree8f6a5174908af5f6d9cd105d26c44e5fa2704dad /nova/compute
parent0a617713b881780bed67902833e1b971c9179042 (diff)
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
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py12
1 files changed, 8 insertions, 4 deletions
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."""