Reduce the number of SQL queries in compute host association logic
Today, there is a sql query for each VM from the compute resource to check
if it can be associated. After refactoring, the sql queries should be consolidated
to some batches to reduce the N+1 issue.
Updated by Ivan Necas almost 6 years ago
Came as a review comment from PR https://github.com/theforeman/foreman/pull/4911#discussion_r160059586