When starting nova-api before any nova-computes are started
and registered in the cell DBs, and with
[upgrade_levels]/compute=auto, the compute RPC API client
construction will iterate all cells looking for a minimum
nova-compute service version, not find one, and thus not
cache the result in the LAST_VERSION global.
There are 30+ API controller classes that construct an
instance of nova.compute.api.API which itself constructs
a nova.compute.rpcapi.ComputeAPI object which determines
the version cap as described above, and that is per API
worker. Each cell DB call goes through RequestContext.set_target_cell
which has a lock in it, so in this scenario on start of
nova-api there can be a lot of locking log messages for
get_or_set_cached_cell_and_set_connections.
The RPC API ClientRouter can be a singleton and just constructed
on first access to avoid the redundant database queries which
is what this change does.
To preserve the LAST_VERSION re-calculation that was in
ComputeManager.reset(), we have to also reset the _ROUTER global
so ComputeManager.reset() now resets all of the compute RPC API
globals.
Change-Id: I48109d5e32a2e9635c240da1c77f7f6cc7e3c76d
Related-Bug: #1807219
Related-Bug: #1815697
(cherry picked from commit ae659668b5)