diff options
author | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-01-21 06:01:29 -0600 |
---|---|---|
committer | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-01-21 06:01:29 -0600 |
commit | 8270de468befb156789db2aa297aaed3b608bd9b (patch) | |
tree | d7846637f6eed73785ba4cc6fc7d92c8f36aef02 | |
parent | 914d683cf83051e2f22c4c0e81087118677e135f (diff) | |
download | talos-skeleton-8270de468befb156789db2aa297aaed3b608bd9b.tar.gz talos-skeleton-8270de468befb156789db2aa297aaed3b608bd9b.zip |
Update IPL status observer to allow IPL complete target holdoff
-rw-r--r-- | pyiplobserver/ipl_status_observer.py | 33 |
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): |