nova/nova/conductor
Matt Riedemann 3480454a4b Optimize AZ lookup during schedule_and_build_instances
If we're creating multiple servers, there is a chance
the scheduler returned the same host for more than
one of them, which means we could be redundantly
looking up the AZ for the same host multiple times.
This could happen when creating multiple servers in
the same strict affinity group, or simply if the
scheduler is configured with a pack-first strategy
for filling up hosts. The get_host_availability_zone()
method does not use its own internal cache, so this
change adds a simple cache to the schedule_and_build_instances
method itself so that we only lookup the AZ per unique
host once.

Note that build_instances suffers from the same issue
but that is only called for scheduling with cells v1
which is deprecated so we shouldn't need to care about
optimizing that method.

Change-Id: I2ae5ae7240e5183acca7492ddad017c0c878835b
Closes-Bug: #1785327
(cherry picked from commit 27857c3373)
2018-09-21 14:57:32 +00:00
..
tasks Merge "Fix accumulated nits from port binding for live migration series" 2018-07-28 16:51:52 +00:00
__init__.py Remove conductor local api:s and 'use_local' config option 2016-10-18 14:26:06 +02:00
api.py In Python3.7 async is a keyword [1] 2018-07-20 12:21:34 -04:00
manager.py Optimize AZ lookup during schedule_and_build_instances 2018-09-21 14:57:32 +00:00
rpcapi.py Merge "conf: Remove '[conductor] topic' opt" 2018-03-13 08:00:43 +00:00