Make xenapi capabilities['enabled'] use service enabled
filters.compute_filter is enabled by default along with libvirt, but the capabilities['enabled'] section of it is only supported by XenAPI. This used to work by adding a parameter to capabilities, but since the capabilities RPC is being removed, use conductor.service_update to tell the scheduler which host is disabled. service_update is already the way to tell the scheduler about other disabled hosts, so to keep backwards compatibility keep host_enabled but use service_update underneath. Part of bp no-compute-fanout-to-scheduler Change-Id: Ica1919cfe9a2402b2107c557c10d47e01a6c430b
This commit is contained in:
@@ -36,7 +36,6 @@ class ComputeFilter(filters.BaseHostFilter):
|
||||
|
||||
def host_passes(self, host_state, filter_properties):
|
||||
"""Returns True for only active compute nodes."""
|
||||
capabilities = host_state.capabilities
|
||||
service = host_state.service
|
||||
|
||||
alive = self.servicegroup_api.service_is_up(service)
|
||||
@@ -44,8 +43,4 @@ class ComputeFilter(filters.BaseHostFilter):
|
||||
LOG.debug(_("%(host_state)s is disabled or has not been "
|
||||
"heard from in a while"), {'host_state': host_state})
|
||||
return False
|
||||
if not capabilities.get("enabled", True):
|
||||
LOG.debug(_("%(host_state)s is disabled via capabilities"),
|
||||
{'host_state': host_state})
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -671,17 +671,6 @@ class HostFiltersTestCase(test.NoDBTestCase):
|
||||
'service': service})
|
||||
self.assertFalse(filt_cls.host_passes(host, filter_properties))
|
||||
|
||||
def test_compute_filter_fails_on_capability_disabled(self):
|
||||
self._stub_service_is_up(True)
|
||||
filt_cls = self.class_map['ComputeFilter']()
|
||||
filter_properties = {'instance_type': {'memory_mb': 1024}}
|
||||
capabilities = {'enabled': False}
|
||||
service = {'disabled': False}
|
||||
host = fakes.FakeHostState('host1', 'node1',
|
||||
{'free_ram_mb': 1024, 'capabilities': capabilities,
|
||||
'service': service})
|
||||
self.assertFalse(filt_cls.host_passes(host, filter_properties))
|
||||
|
||||
def test_image_properties_filter_passes_same_inst_props(self):
|
||||
self._stub_service_is_up(True)
|
||||
filt_cls = self.class_map['ImagePropertiesFilter']()
|
||||
|
||||
Reference in New Issue
Block a user