Resource limits check sometimes enforced for forced scheduling
Resource limit checks on a compute manager are based on the contents of filter_properites['limits']. This in turn is populated by the scheduler after the host has been selected by scheduler.utils.populate_filter_properties. The limits value is taken from the host_state, which is maintained as a local data in the host manager. The host_state limits values are populated by the various filters, for example the ram filter sets limits['memory_mb'] based on its configuration. In the case of scheduling to a forced host the filters are bypassed, so the contents of the host_state['limits'] value depends on whether the scheduler has already placed a non-forced instance onto that host (and thus run the filters to populate the limits). If it has then the compute manager will impose the limits, if it hasn't then the limits will be empty and there will be no check. As forcing bypasses the filters and is a privileged operation the limits should always be cleared in the filter_properties in this case to avoid the limit check on the compute manager. Fixed bug: 1231963 Change-Id: Ic7ff5d1fc652a8bdf6a0cf8e6ef063d9f2e7ab16
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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']],
|
||||
|
||||
Reference in New Issue
Block a user