'Deletes the aggregate.'

@wrap_exception()
def delete_aggregate(self, context, aggregate_id):

    aggregate_payload = {'aggregate_id': aggregate_id}
    compute_utils.notify_about_aggregate_update(context, 'delete.start', aggregate_payload)
    aggregate = objects.Aggregate.get_by_id(context, aggregate_id)
    compute_utils.notify_about_aggregate_action(context=context, aggregate=aggregate, action=fields_obj.NotificationAction.DELETE, phase=fields_obj.NotificationPhase.START)
    if (len(aggregate.hosts) > 0):
        msg = _('Host    aggregate    is    not    empty')
        raise exception.InvalidAggregateActionDelete(aggregate_id=aggregate_id, reason=msg)
    aggregate.destroy()
    self.scheduler_client.delete_aggregate(context, aggregate)
    compute_utils.notify_about_aggregate_update(context, 'delete.end', aggregate_payload)
    compute_utils.notify_about_aggregate_action(context=context, aggregate=aggregate, action=fields_obj.NotificationAction.DELETE, phase=fields_obj.NotificationPhase.END)
