Wait for IOM to come back online after restart instead of fixed sleep
A fixed 30s sleep is not enough for a full BMC boot cycle. Add _wait_for_iom_online() which polls GET /redfish/v1/ every 15s until the IOM responds (up to 5 minutes), then call it after every IOM restart in both _update_iom_fw and _update_fabric_fw. This ensures the fabric card update (and post-update validation) don't run while the IOM is still booting and unreachable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -181,6 +181,25 @@ def _redfish_poll_tasks(password: str, host: str, timeout: int = 600) -> tuple:
|
||||
return False, f"Timeout after {timeout}s waiting for tasks."
|
||||
|
||||
|
||||
def _wait_for_iom_online(password: str, host: str, timeout: int = 300) -> bool:
|
||||
"""
|
||||
Poll GET /redfish/v1/ until the IOM responds successfully, indicating it
|
||||
has finished rebooting. Waits up to `timeout` seconds.
|
||||
Returns True if the IOM came back online, False if timeout was exceeded.
|
||||
"""
|
||||
deadline = time.monotonic() + timeout
|
||||
attempt = 0
|
||||
while time.monotonic() < deadline:
|
||||
attempt += 1
|
||||
ok_flag, _ = _redfish_request(password, "GET", "/redfish/v1/", host=host)
|
||||
if ok_flag:
|
||||
return True
|
||||
elapsed = int(time.monotonic() - (deadline - timeout))
|
||||
info(f" Waiting for IOM to come back online... [{elapsed}s elapsed]")
|
||||
time.sleep(15)
|
||||
return False
|
||||
|
||||
|
||||
def _redfish_restart_iom(password: str, host: str, iom: str) -> tuple:
|
||||
return _redfish_request(
|
||||
password, "POST",
|
||||
|
||||
Reference in New Issue
Block a user