diff --git a/nova/scheduler/utils.py b/nova/scheduler/utils.py index 93aec54b1596..647e7f548580 100644 --- a/nova/scheduler/utils.py +++ b/nova/scheduler/utils.py @@ -114,7 +114,8 @@ def populate_filter_properties(filter_properties, host_state): _add_retry_host(filter_properties, host, nodename) # Adds oversubscription policy - filter_properties['limits'] = limits + if not filter_properties.get('force_hosts'): + filter_properties['limits'] = limits def _add_retry_host(filter_properties, host, node): diff --git a/nova/tests/scheduler/test_scheduler_utils.py b/nova/tests/scheduler/test_scheduler_utils.py index 31c5b54c5a74..4a0bac566b0a 100644 --- a/nova/tests/scheduler/test_scheduler_utils.py +++ b/nova/tests/scheduler/test_scheduler_utils.py @@ -125,7 +125,13 @@ class SchedulerUtilsTestCase(test.NoDBTestCase): scheduler_utils.populate_filter_properties(filter_properties, host_state) - self.assertEqual('fake-limits', filter_properties['limits']) + if force_hosts: + expected_limits = None + else: + expected_limits = 'fake-limits' + self.assertEqual(expected_limits, + filter_properties.get('limits')) + if with_retry and not force_hosts and not force_nodes: self.assertEqual([['fake-host', 'fake-node'], ['fake-host', 'fake-node']],