Add support for inspection using ironic-inspector

Adds a new module ironic_python_agent.inspector and new entry point
for extensions, which will allow vendor-specific inspection.

Inspection is run on service start up just before the lookup.
Due to this early start, and due to the fact we don't even know
MAC address of nodes on inspection (to say nothing about IP addresses),
exception handling is a bit different from other agent features:
we try hard not to error out until we send at least something to inspector.

Change-Id: I00932463d41819fd0a050782e2c88eddf6fc08c6
This commit is contained in:
Dmitry Tantsur
2015-07-24 17:23:33 +02:00
parent cdb4b520eb
commit 096830414b
11 changed files with 735 additions and 15 deletions

@ -28,6 +28,7 @@ from ironic_python_agent import encoding
from ironic_python_agent import errors
from ironic_python_agent.extensions import base
from ironic_python_agent import hardware
from ironic_python_agent import inspector
from ironic_python_agent import ironic_api_client
@ -280,11 +281,16 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
hardware.load_managers()
if not self.standalone:
# Inspection should be started before call to lookup, otherwise
# lookup will fail due to unknown MAC.
uuid = inspector.inspect()
content = self.api_client.lookup_node(
hardware_info=hardware.dispatch_to_managers(
'list_hardware_info'),
timeout=self.lookup_timeout,
starting_interval=self.lookup_interval)
starting_interval=self.lookup_interval,
node_uuid=uuid)
self.node = content['node']
self.heartbeat_timeout = content['heartbeat_timeout']