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]https://github.com/openstack/nova/blob/948d63c6dc190ef94041fbeaa30091358a33c484/nova/compute/api.py#L5420-L5423
This Patch hide the delete button if a host in the aggregate
Closes-Bug:
@@ -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)
