nova/nova/tests/unit/scheduler
Matthew Booth b6a1a19295 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.

Change-Id: Ibb7c43a0abc433f93fc3de71146263e6d5923666
Closes-Bug: #1739323
(cherry picked from commit d72b33b986)
2017-12-21 10:37:08 -05:00
..
client Remove provider allocs in confirm/revert resize 2017-08-09 16:48:33 -04:00
filters Deprecate TypeAffinityFilter 2017-05-27 10:15:25 +00:00
weights Add PCIWeigher 2017-06-08 09:44:46 +01:00
__init__.py move all tests to nova/tests/unit 2014-11-12 15:31:08 -05:00
fakes.py add dict of allocation requests to select_dests() 2017-07-19 15:27:27 -04:00
ironic_fakes.py Set IronicNodeState.uuid in _update_from_compute_node 2017-07-25 17:52:47 -04:00
test_caching_scheduler.py add dict of allocation requests to select_dests() 2017-07-19 15:27:27 -04:00
test_chance_scheduler.py add dict of allocation requests to select_dests() 2017-07-19 15:27:27 -04:00
test_client.py Pass a list of instance UUIDs to scheduler 2017-06-01 14:54:16 +00:00
test_filter_scheduler.py Add missing unit tests for FilterScheduler._get_all_host_states 2017-12-21 10:37:04 -05:00
test_filters.py Fix invalid uuid warnings 2016-05-10 09:04:37 +00:00
test_host_filters.py Modify left filters for RequestSpec 2015-12-11 12:27:20 +01:00
test_host_manager.py Fix an error in _get_host_states when deleting a compute node 2017-12-21 10:37:08 -05:00
test_ironic_host_manager.py Set IronicNodeState.uuid in _update_from_compute_node 2017-07-25 17:52:47 -04:00
test_rpcapi.py conf: remove *_topic config opts 2017-07-17 21:27:02 -07:00
test_scheduler.py Raise NoValidHost if no allocation candidates 2017-08-08 14:00:08 +02:00
test_scheduler_utils.py _schedule_instances() supporting a RequestSpec object 2017-06-22 14:29:31 +02:00
test_utils.py Refactor out claim_resources_on_destination into a utility 2017-09-12 15:46:19 -04:00