summaryrefslogtreecommitdiff
path: root/ironic_python_agent/agent.py
diff options
context:
space:
mode:
authorJay Faulkner <jay@jvf.cc>2014-12-19 13:24:21 -0800
committerJay Faulkner <jay@jvf.cc>2015-01-08 15:15:13 -0800
commit2bbec5770c459b339b0924e8ffcd1382e22d44df (patch)
tree1a1035f408aa3d1557a9d91772c4f5f71e820c2f /ironic_python_agent/agent.py
parent8dd54446e3a7a1e13fee91a4f7cfa064b085b03b (diff)
downloadironic-python-agent-2bbec5770c459b339b0924e8ffcd1382e22d44df.tar.gz
Allow use of multiple simultaneous HW managers
Currently we pick the most specific manager and use it. Instead, call each method on each hardware manager in priority order, and consider the call successful if the method exists and doesn't throw IncompatibleHardwareMethodError. This is an API breaking change for anyone with out-of-tree HardwareManagers. Closes-bug: 1408469 Change-Id: I30c65c9259acd4f200cb554e7d688344b7486a58
Diffstat (limited to 'ironic_python_agent/agent.py')
-rw-r--r--ironic_python_agent/agent.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/ironic_python_agent/agent.py b/ironic_python_agent/agent.py
index ab4593b8..6fef34a7 100644
--- a/ironic_python_agent/agent.py
+++ b/ironic_python_agent/agent.py
@@ -70,7 +70,6 @@ class IronicPythonAgentHeartbeater(threading.Thread):
"""
super(IronicPythonAgentHeartbeater, self).__init__()
self.agent = agent
- self.hardware = hardware.get_manager()
self.api = ironic_api_client.APIClient(agent.api_url,
agent.driver_name)
self.log = log.getLogger(__name__)
@@ -156,7 +155,6 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
self.api = app.VersionSelectorApplication(self)
self.heartbeater = IronicPythonAgentHeartbeater(self)
self.heartbeat_timeout = None
- self.hardware = hardware.get_manager()
self.log = log.getLogger(__name__)
self.started_at = None
self.node = None
@@ -201,7 +199,8 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
attempts = 0
while (attempts < self.ip_lookup_attempts):
for iface in ifaces:
- found_ip = self.hardware.get_ipv4_addr(iface)
+ found_ip = hardware.dispatch_to_managers('get_ipv4_addr',
+ iface)
if found_ip is not None:
self.advertise_address = (found_ip,
self.advertise_address[1])
@@ -223,7 +222,7 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
be found.
"""
iface_list = [iface.serialize()['name'] for iface in
- self.hardware.list_network_interfaces()]
+ hardware.dispatch_to_managers('list_network_interfaces')]
iface_list = [name for name in iface_list if 'lo' not in name]
if len(iface_list) == 0:
@@ -278,7 +277,8 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
self.started_at = _time()
if not self.standalone:
content = self.api_client.lookup_node(
- hardware_info=self.hardware.list_hardware_info(),
+ hardware_info=hardware.dispatch_to_managers(
+ 'list_hardware_info'),
timeout=self.lookup_timeout,
starting_interval=self.lookup_interval)