Merge "Remove traces of now unused host capabilities from scheduler"

This commit is contained in:
Jenkins 2014-06-25 17:08:35 +00:00 committed by Gerrit Code Review
commit 0fa99567ab
2 changed files with 8 additions and 20 deletions

View File

@ -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

View File

@ -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__,