summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaptor Engineering Development Team <support@raptorengineering.com>2018-01-21 06:01:29 -0600
committerRaptor Engineering Development Team <support@raptorengineering.com>2019-04-19 10:26:09 +0000
commit61cdfad0356929c025837e82296ae38869f0a266 (patch)
treed1cdf9dd56de95d576b8fed36b2fc443214eeb23
parent1d3e2bff7d612bbbc41ae5a2c48101f19fec35fb (diff)
downloadtalos-skeleton-61cdfad0356929c025837e82296ae38869f0a266.tar.gz
talos-skeleton-61cdfad0356929c025837e82296ae38869f0a266.zip
Update IPL status observer to allow IPL complete target holdoff
-rw-r--r--pyiplobserver/ipl_status_observer.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/pyiplobserver/ipl_status_observer.py b/pyiplobserver/ipl_status_observer.py
index 3d08b13..f5e3d25 100644
--- a/pyiplobserver/ipl_status_observer.py
+++ b/pyiplobserver/ipl_status_observer.py
@@ -26,6 +26,9 @@ import obmc.system
DBUS_NAME = 'org.openbmc.status.IPL'
OBJ_NAME = u'/org/openbmc/status/IPL'
+IPL_FLAG_DIR = '/run/openbmc/'
+IPL_FLAG_FILE = 'host@0-ipl-complete'
+
HOST_STATUS_RUNNING = "xyz.openbmc_project.State.Host.HostState.Running"
IPL_SBE_DONE_ISTEP_MAJOR = 5
@@ -48,6 +51,9 @@ class IPLStatus(DbusProperties, DbusObjectManager):
self.last_status = "";
self.last_istep = "";
+ if not os.path.exists(IPL_FLAG_DIR):
+ os.makedirs(IPL_FLAG_DIR)
+
host_state_dev = self.bus.get_object("xyz.openbmc_project.State.Host", u'/xyz/openbmc_project/state/host0')
host_state_iface = dbus.Interface(host_state_dev, 'org.freedesktop.DBus.Properties')
host_state_value = host_state_iface.Get("xyz.openbmc_project.State.Host", "CurrentHostState")
@@ -177,15 +183,24 @@ class IPLStatus(DbusProperties, DbusObjectManager):
if (self.prev_access_fail_count < 255):
self.prev_access_fail_count += 1
- if ((current_status == "IPL_COMPLETE") and (self.last_status != current_status)):
- # Signal systemd that IPL is complete
- try:
- systemd_emit_dev = self.bus.get_object("org.freedesktop.systemd1", u"/org/freedesktop/systemd1")
- systemd_emit_iface = dbus.Interface(systemd_emit_dev, 'org.freedesktop.systemd1.Manager')
- systemd_emit_function = getattr(systemd_emit_iface, 'StartUnit')
- systemd_emit_function.call_async('obmc-host-ipl-complete@0.target', 'replace')
- except Exception as e:
- pass
+ if (self.last_status != current_status):
+ if (current_status == "IPL_COMPLETE"):
+ # Signal systemd that IPL is complete
+ try:
+ with open(IPL_FLAG_DIR + IPL_FLAG_FILE, 'a'):
+ os.utime(IPL_FLAG_DIR + IPL_FLAG_FILE, None)
+
+ systemd_emit_dev = self.bus.get_object("org.freedesktop.systemd1", u"/org/freedesktop/systemd1")
+ systemd_emit_iface = dbus.Interface(systemd_emit_dev, 'org.freedesktop.systemd1.Manager')
+ systemd_emit_function = getattr(systemd_emit_iface, 'StartUnit')
+ systemd_emit_function.call_async('obmc-host-ipl-complete@0.target', 'replace')
+ except Exception as e:
+ pass
+ else:
+ try:
+ os.remove(IPL_FLAG_DIR + IPL_FLAG_FILE,)
+ except:
+ pass
# Since it is extremely unlikely that both fetches will fail unless the host is offline, simply check that both fetches passed or failed before continuing
if (sbe_fetch_failed == hostboot_fetch_failed):
OpenPOWER on IntegriCloud