Hide the Button of delete aggregate if a host in the aggregate

According to the code in [1], if there is a host in the aggregate,
an error will be shown when deleting.
[1]948d63c6dc/nova/compute/api.py (L5420-L5423)

This Patch hide the delete button if a host in the aggregate

Change-Id: I79c1e32b84fef00a242e1adf5d87531d3f407c34
Closes-Bug: #1829102
This commit is contained in:
pengyuesheng 2019-05-15 10:31:56 +08:00
parent d6f62bc65d
commit 45e8cb2fef
1 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,11 @@ class DeleteAggregateAction(tables.DeleteAction):
count
)
def allowed(self, request, aggregate):
if aggregate and aggregate.hosts:
return False
return True
def delete(self, request, obj_id):
api.nova.aggregate_delete(request, obj_id)