Merge "Update comments in HostManager._get_instance_info"

This commit is contained in:
Zuul 2019-08-12 12:55:53 +00:00 committed by Gerrit Code Review
commit 52b9359d6c

View File

@ -873,19 +873,18 @@ class HostManager(object):
def _get_instance_info(self, context, compute): def _get_instance_info(self, context, compute):
"""Gets the host instance info from the compute host. """Gets the host instance info from the compute host.
Some older compute nodes may not be sending instance change updates to Some sites may disable ``track_instance_changes`` for performance or
the Scheduler; other sites may disable this feature for performance isolation reasons. In either of these cases, there will either be no
reasons. In either of these cases, there will either be no information information for the host, or the 'updated' value for that host dict
for the host, or the 'updated' value for that host dict will be False. will be False. In those cases, we need to grab the current InstanceList
In those cases, we need to grab the current InstanceList instead of instead of relying on the version in _instance_info.
relying on the version in _instance_info.
""" """
host_name = compute.host host_name = compute.host
host_info = self._instance_info.get(host_name) host_info = self._instance_info.get(host_name)
if host_info and host_info.get("updated"): if host_info and host_info.get("updated"):
inst_dict = host_info["instances"] inst_dict = host_info["instances"]
else: else:
# Host is running old version, or updates aren't flowing. # Updates aren't flowing from nova-compute.
inst_dict = self._get_instances_by_host(context, host_name) inst_dict = self._get_instances_by_host(context, host_name)
return inst_dict return inst_dict