Only hosts that have a primary nic assigned to a domain should be counted in the domain host count. Previous implementation was flawed in that it only updated the counter in certain occasions and not all, leading sometimes to incorrect host counts. I have implemented the counter updates in `after_commit` to reduce chance of deadlocks.
Related issues
Bug #11444: Domains page shows negative number of hosts
Fixes #11444 - Correctly count hosts in domain
Only hosts that have a primary nic assigned to a domain should be
counted in the domain host count. Previous implementation was flawed in
that it only updated the counter in certain occasions and not all,
leading sometimes to incorrect host counts.
I have implemented the counter updates in `after_commit` to reduce
chance of deadlocks.