nova/nova/scheduler
Matthew Booth 52679374a4 Fix an error in _get_host_states when deleting a compute node
_get_host_states returns a generator which closes over seen_nodes, which
is local, and self.host_state_map, which is global. It also modifies
self.host_state_map, and will remove entries whose compute nodes are no
longer present.

If a compute node is deleted while a filter is still evaluating the
generator returned by _get_host_states, the entry in self.host_state_map
will be deleted if _get_host_states is called again. This will cause a
KeyError when the first generator comes to evaluate the entry for the
deleted compute node.

We fix this by modifying the returned generator expression to check
that a host_state_map entry still exists before returning it. An
existing unit test is modified to exhibit the bug.

Conflicts:
      nova/scheduler/filter_scheduler.py
      nova/scheduler/host_manager.py

NOTE(mriedem): The conflict in filter_scheduler.py is due to
48268c73e3 in Pike which is not
needed here. The conflict in host_manager.py is due to
d1de538523 in Pike which is not
needed here.

Change-Id: Ibb7c43a0abc433f93fc3de71146263e6d5923666
Closes-Bug: #1739323
(cherry picked from commit d72b33b986)
(cherry picked from commit b6a1a19295)
2017-12-21 11:15:22 -05:00
..
client Changing deleting stale allocations warning to debug 2017-06-12 09:24:07 +00:00
filters Refined fix for validating image on rebuild 2017-11-28 09:48:20 -05:00
weights conf: Attempt to resolve TODOs in scheduler.py 2016-11-01 14:40:46 +00:00
__init__.py Improve hacking rule to avoid author markers 2014-05-05 14:35:20 +02:00
caching_scheduler.py Scheduler calling the Placement API 2017-01-27 16:36:34 -08:00
chance.py Move config options from nova/compute/rpcapi.py file 2016-04-21 22:26:13 +00:00
driver.py conf: Group scheduler options 2016-10-07 14:36:21 +01:00
filter_scheduler.py Fix an error in _get_host_states when deleting a compute node 2017-12-21 11:15:22 -05:00
host_manager.py Fix an error in _get_host_states when deleting a compute node 2017-12-21 11:15:22 -05:00
ironic_host_manager.py Fix TypeError in _update_from_compute_node race 2017-01-06 17:15:49 +00:00
manager.py Allow scheduler to run cell host discovery periodically 2017-02-01 12:22:23 -08:00
rpcapi.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
utils.py Refined fix for validating image on rebuild 2017-11-28 09:48:20 -05:00