Remove traces of now unused host capabilities from scheduler
This is take two of this patch. This time after preparing Baremetal and Ironic code to work with the HostManager changes introduced in this patch. Host capabilities updates are no longer used by the scheduler. All host state is instead fetched from the DB. Some left over fields are still kept by the host manager but contain no data. This change remove the last traces of host capabilities from the scheduler. Baremetal/Ironic host managers used to rely on capabilities info to decide which host state class to use, VM or baremetal. This has been broken since host capabilities reporting were removed. This change works in tandem with prior updates to Baremetal/Ironic node detection logic to fix this problem. Important: This must not be approved until the Ironic patch in https://review.openstack.org/97447 has first landed! Change-Id: Id5f88c0aa1df9152ddb62904b0544801a8bcfd2a Closes-Bug: #1260265
This commit is contained in:
parent
99002ef53f
commit
5486935a01
@ -109,10 +109,9 @@ class HostState(object):
|
||||
previously used and lock down access.
|
||||
"""
|
||||
|
||||
def __init__(self, host, node, capabilities=None, service=None):
|
||||
def __init__(self, host, node, compute=None):
|
||||
self.host = host
|
||||
self.nodename = node
|
||||
self.update_capabilities(capabilities, service)
|
||||
|
||||
# Mutable available resources.
|
||||
# These will change as resources are virtually "consumed".
|
||||
@ -147,15 +146,10 @@ class HostState(object):
|
||||
self.metrics = {}
|
||||
|
||||
self.updated = None
|
||||
if compute:
|
||||
self.update_from_compute_node(compute)
|
||||
|
||||
def update_capabilities(self, capabilities=None, service=None):
|
||||
# Read-only capability dicts
|
||||
|
||||
if capabilities is None:
|
||||
capabilities = {}
|
||||
self.capabilities = ReadOnlyDict(capabilities)
|
||||
if service is None:
|
||||
service = {}
|
||||
def update_service(self, service):
|
||||
self.service = ReadOnlyDict(service)
|
||||
|
||||
def _update_metrics_from_compute_node(self, compute):
|
||||
@ -325,8 +319,6 @@ class HostManager(object):
|
||||
host_state_cls = HostState
|
||||
|
||||
def __init__(self):
|
||||
# { (host, hypervisor_hostname) : { <service> : { cap k : v }}}
|
||||
self.service_states = {}
|
||||
self.host_state_map = {}
|
||||
self.filter_handler = filters.HostFilterHandler()
|
||||
self.filter_classes = self.filter_handler.get_matching_classes(
|
||||
@ -454,17 +446,13 @@ class HostManager(object):
|
||||
host = service['host']
|
||||
node = compute.get('hypervisor_hostname')
|
||||
state_key = (host, node)
|
||||
capabilities = self.service_states.get(state_key, None)
|
||||
host_state = self.host_state_map.get(state_key)
|
||||
if host_state:
|
||||
host_state.update_capabilities(capabilities,
|
||||
dict(service.iteritems()))
|
||||
host_state.update_from_compute_node(compute)
|
||||
else:
|
||||
host_state = self.host_state_cls(host, node,
|
||||
capabilities=capabilities,
|
||||
service=dict(service.iteritems()))
|
||||
host_state = self.host_state_cls(host, node, compute=compute)
|
||||
self.host_state_map[state_key] = host_state
|
||||
host_state.update_from_compute_node(compute)
|
||||
host_state.update_service(dict(service.iteritems()))
|
||||
seen_nodes.add(state_key)
|
||||
|
||||
# remove compute nodes from host_state_map if they are not active
|
||||
|
@ -30,7 +30,7 @@ class IronicAPIContractsTestCase(test.NoDBTestCase):
|
||||
def test_HostState_signatures(self):
|
||||
self._check_method(host_manager.HostState.__init__,
|
||||
"HostState.__init__",
|
||||
['self', 'host', 'node', 'capabilities', 'service'])
|
||||
['self', 'host', 'node', 'compute'])
|
||||
|
||||
def test_HostManager_signatures(self):
|
||||
self._check_method(host_manager.HostManager.__init__,
|
||||
|
Loading…
Reference in New Issue
Block a user