Add a warning to user: Unable to remove availability zone from host aggregate
Because the nova API does not allow to set aggregates an empty
availability_zone which has availability_zone at first.
Add a warning to notice users to reduce confusion
Change-Id: I5864c58751ec5f182f30feb302a95923948ad2ad
Closes-Bug: #1644051
(cherry picked from commit 7cb2355dff
)
This commit is contained in:
parent
e2139bd717
commit
1f6b915fda
|
@ -31,11 +31,18 @@ class UpdateAggregateForm(forms.SelfHandlingForm):
|
|||
|
||||
def handle(self, request, data):
|
||||
id = self.initial['id']
|
||||
old_availability_zone = self.initial['availability_zone']
|
||||
name = data['name']
|
||||
availability_zone = data['availability_zone']
|
||||
aggregate = {'name': name}
|
||||
if availability_zone:
|
||||
aggregate['availability_zone'] = availability_zone
|
||||
try:
|
||||
if availability_zone:
|
||||
aggregate['availability_zone'] = availability_zone
|
||||
elif old_availability_zone:
|
||||
raise ValueError
|
||||
except Exception:
|
||||
exceptions.handle(request,
|
||||
_('The new availability zone can\'t be empty'))
|
||||
try:
|
||||
api.nova.aggregate_update(request, id, aggregate)
|
||||
message = (_('Successfully updated aggregate: "%s."')
|
||||
|
|
Loading…
Reference in New Issue