Domains page shows negative number of hosts
I only have one domain. In the Domains page, this one domain shows '-53' hosts. The Environments page shows my two environments with 9 and 167 hosts, which sounds about right. All my hosts are assigned to this one domain.
This was the case in 1.8.2, and it remains like this after upgrading to 1.9.0 this morning.
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.