summaryrefslogtreecommitdiff
path: root/ironic_python_agent/agent.py
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@redhat.com>2016-05-19 17:21:28 +0200
committerDmitry Tantsur <dtantsur@redhat.com>2016-05-24 10:39:52 +0200
commitc09753bb60be1819ef102ba8a86b534bba146ccb (patch)
tree0e554d1c96ae704ffd09d648428e6c962b03e3fa /ironic_python_agent/agent.py
parent015fad6054d0572daadd193b68ba17c9de0ae8e0 (diff)
downloadironic-python-agent-c09753bb60be1819ef102ba8a86b534bba146ccb.tar.gz
Add a configurable sleep before IPA starts working
Some kernel modules take substantial time to initialize. For example, with mpt2sas RAID driver inspection and deployment randomly fail due to IPA starting before the driver finishes initialization. As much as I hate it, the only way to guarantee that the hardware is truely initalized is to wait for it. Apparently all hardware in Linux is treated as hotplugged, so there is no such thing as "hardware initialization is finished". Operators can add a sleep based on their knowledge of their hardware. The default behaviour remains the same. Change-Id: I0446ae81d760dacaf31eea6ad9f9eaa098cf5e93 Partial-Bug: #1582797
Diffstat (limited to 'ironic_python_agent/agent.py')
-rw-r--r--ironic_python_agent/agent.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ironic_python_agent/agent.py b/ironic_python_agent/agent.py
index 75a7e8aa..a0f183fd 100644
--- a/ironic_python_agent/agent.py
+++ b/ironic_python_agent/agent.py
@@ -147,7 +147,8 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
def __init__(self, api_url, advertise_address, listen_address,
ip_lookup_attempts, ip_lookup_sleep, network_interface,
- lookup_timeout, lookup_interval, driver_name, standalone):
+ lookup_timeout, lookup_interval, driver_name, standalone,
+ hardware_initialization_delay=0):
super(IronicPythonAgent, self).__init__()
self.ext_mgr = extension.ExtensionManager(
namespace='ironic_python_agent.extensions',
@@ -175,6 +176,7 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
self.ip_lookup_sleep = ip_lookup_sleep
self.network_interface = network_interface
self.standalone = standalone
+ self.hardware_initialization_delay = hardware_initialization_delay
def get_status(self):
"""Retrieve a serializable status.
@@ -289,6 +291,12 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
# Cached hw managers at runtime, not load time. See bug 1490008.
hardware.load_managers()
+ # Operator-settable delay before hardware actually comes up.
+ # Helps with slow RAID drivers - see bug 1582797.
+ if self.hardware_initialization_delay > 0:
+ LOG.info('Waiting %d seconds before proceeding',
+ self.hardware_initialization_delay)
+ time.sleep(self.hardware_initialization_delay)
if not self.standalone:
# Inspection should be started before call to lookup, otherwise