meta-facebook: fby35 : Add support to take actions if Fan/NIC
sensor values crossed thresholds
Added support to trigger hard shutdown alarms and power off the
slots of the platform if the Fan/NIC sensors values getting low
compared to threshold values.
Added platform specific service file and script to take
platorm specific actions.
TESTED : Verified all the slots getting powered Off when fan/nic
sensor values crossed threshold values.
Signed-off-by: Kumar Thangavel <thangavel.k@hcl.com>
Change-Id: Icd1f761c08e8b829eef4f1d28ef68732600c296b
diff --git a/meta-facebook/recipes-phosphor/fans/phosphor-fan/fby35/host-poweroff b/meta-facebook/recipes-phosphor/fans/phosphor-fan/fby35/host-poweroff
new file mode 100644
index 0000000..bd43954
--- /dev/null
+++ b/meta-facebook/recipes-phosphor/fans/phosphor-fan/fby35/host-poweroff
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Power off the hosts when fan sensors crossed thresholds.
+
+echo "Power off the hosts if fansensors threshold crossed ::"
+
+HOST_INSTANCES="HOST_INSTANCES_SED_REPLACEMENT_VALUE"
+
+DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
+DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
+DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
+DBUS_PROPERTY="RequestedPowerTransition"
+PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
+
+# Power off the hosts.
+power-off-all-hosts()
+{
+ for host_id in $HOST_INSTANCES
+ do
+ echo "chosen host id :::$host_id"
+
+ # host power off
+ output=$(busctl set-property $DBUS_SERVICE$host_id $DBUS_OBJECT$host_id $DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
+ echo "$output"
+
+ done
+}
+
+power-off-all-hosts