diff options
author | Ratan Gupta <ratagupt@in.ibm.com> | 2016-09-06 21:47:05 +0530 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-09-27 18:43:35 +0000 |
commit | 520f8b05742916b920f20ac916a0e20fb981ce56 (patch) | |
tree | a95f89d7450e96de4513f2038c509cbc130f682d /pystatemgr | |
parent | a7ac805b407617f7a83eb152ff823f44d243a9b2 (diff) | |
download | talos-skeleton-520f8b05742916b920f20ac916a0e20fb981ce56.tar.gz talos-skeleton-520f8b05742916b920f20ac916a0e20fb981ce56.zip |
Fix for Power Restore Policy
This fix is to make the Restore_last_state of Power Restore Policy
to working properly.
eg:- if the last state is Host_powered_on/off and system goes for pdu
reboot then system should reach to the Host_Powred_On/Off state.
Fixes openbmc/openbmc#196
Change-Id: If4bdb65a21452d7aa041312fcdbb1daa1b1b0424
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
Diffstat (limited to 'pystatemgr')
-rw-r--r-- | pystatemgr/discover_system_state.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/pystatemgr/discover_system_state.py b/pystatemgr/discover_system_state.py index 7cdb4c1..f793314 100644 --- a/pystatemgr/discover_system_state.py +++ b/pystatemgr/discover_system_state.py @@ -34,6 +34,11 @@ dbus_objects = { 'object_name': '/org/openbmc/settings/host0', 'interface_name': 'org.freedesktop.DBus.Properties' }, + 'system': { + 'bus_name': 'org.openbmc.managers.System', + 'object_name': '/org/openbmc/managers/System', + 'interface_name': 'org.freedesktop.DBus.Properties' + }, } @@ -61,18 +66,19 @@ if (pgood == 1): intf = getInterface(bus, dbus_objects, 'occstatus1') intf.setValue("Enabled") else: - ## Power is off, so check power policy + # Power is off, so check power policy settings_intf = getInterface(bus, dbus_objects, 'settings') - system_state = settings_intf.Get( - "org.openbmc.settings.Host", "system_state") - power_policy = settings_intf.Get( - "org.openbmc.settings.Host", "power_policy") - - print "Last System State: "+system_state+"; Power Policy: "+power_policy + system_intf = getInterface(bus, dbus_objects, 'system') + system_last_state = system_intf.Get("org.openbmc.managers.System", + "system_last_state") + power_policy = settings_intf.Get("org.openbmc.settings.Host", + "power_policy") + print "Last System State:"+system_last_state+"Power Policy:"+power_policy chassis_intf = getInterface(bus, dbus_objects, 'chassis') + if (power_policy == "ALWAYS_POWER_ON" or - (power_policy == "RESTORE_LAST_STATE" and - system_state == "HOST_POWERED_ON")): + (power_policy == "RESTORE_LAST_STATE" and + system_last_state == "HOST_POWERED_ON")): chassis_intf.powerOn() # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |