summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
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."""