Remove unused filter_class_names kwarg from get_filtered_hosts

Nothing in tree* uses this and now that we've removed the
plug point to load up random scheduler host managers via
out of tree classpath, this should be safe to remove.

*scheduler_host_manager is now only loaded up from the
drivers in the nova.scheduler.host_manager namespace,
which is just HostManager and IronicHostManager in Nova.
It is possible to add your own out of tree host managers
to that entrypoint to get around this, but Nova isn't
supporting that type of interface anymore which is why we
removed the ability to load custom host managers via the
scheduler_host_manager config option.

Change-Id: Id7b54e0879c43a820efd6bae78d0acf5f28fd384
Closes-Bug: #1403020
This commit is contained in:
Matt Riedemann 2016-04-18 17:42:42 -04:00
parent 7e2f5c7d34
commit 7f1ff4b226
3 changed files with 2 additions and 40 deletions

View File

@ -459,8 +459,7 @@ class HostManager(object):
raise exception.SchedulerHostFilterNotFound(filter_name=msg)
return good_filters
def get_filtered_hosts(self, hosts, spec_obj,
filter_class_names=None, index=0):
def get_filtered_hosts(self, hosts, spec_obj, index=0):
"""Filter hosts and return only ones passing all filters."""
def _strip_ignore_hosts(host_map, hosts_to_ignore):
@ -506,10 +505,6 @@ class HostManager(object):
"'force_nodes' value of '%s'")
LOG.info(msg % forced_nodes_str)
if filter_class_names is None:
filters = self.default_filters
else:
filters = self._choose_host_filters(filter_class_names)
ignore_hosts = spec_obj.ignore_hosts or []
force_hosts = spec_obj.force_hosts or []
force_nodes = spec_obj.force_nodes or []
@ -535,7 +530,7 @@ class HostManager(object):
return []
hosts = six.itervalues(name_to_cls_map)
return self.filter_handler.get_filtered_objects(filters,
return self.filter_handler.get_filtered_objects(self.default_filters,
hosts, spec_obj, index)
def get_weighed_hosts(self, hosts, spec_obj):

View File

@ -222,22 +222,6 @@ class HostManagerTestCase(test.NoDBTestCase):
fake_properties)
self._verify_result(info, result)
@mock.patch.object(FakeFilterClass2, '_filter_one', return_value=True)
def test_get_filtered_hosts_with_specified_filters(self, mock_filter_one):
fake_properties = objects.RequestSpec(ignore_hosts=[],
instance_uuid='fake-uuid1',
force_hosts=[],
force_nodes=[])
specified_filters = ['FakeFilterClass1', 'FakeFilterClass2']
info = {'expected_objs': self.fake_hosts,
'expected_fprops': fake_properties}
self._mock_get_filtered_hosts(info)
result = self.host_manager.get_filtered_hosts(self.fake_hosts,
fake_properties, filter_class_names=specified_filters)
self._verify_result(info, result)
def test_get_filtered_hosts_with_ignore(self):
fake_properties = objects.RequestSpec(
instance_uuid='fake-uuid1',

View File

@ -346,23 +346,6 @@ class IronicHostManagerTestFilters(test.NoDBTestCase):
fake_properties)
self._verify_result(info, result)
@mock.patch.object(FakeFilterClass2, '_filter_one', return_value=True)
def test_get_filtered_hosts_with_specified_filters(self, mock_filter_one):
fake_properties = objects.RequestSpec(
instance_uuid='fake-uuid',
ignore_hosts=[],
force_hosts=[],
force_nodes=[])
specified_filters = ['FakeFilterClass1', 'FakeFilterClass2']
info = {'expected_objs': self.fake_hosts,
'expected_fprops': fake_properties}
self._mock_get_filtered_hosts(info)
result = self.host_manager.get_filtered_hosts(self.fake_hosts,
fake_properties, filter_class_names=specified_filters)
self._verify_result(info, result)
def test_get_filtered_hosts_with_ignore(self):
fake_properties = objects.RequestSpec(
instance_uuid='fake-uuid',