meta-bletchley: power-ctrl: revise host power action

1. Newer versions of the managed system require extra delay between
`ac-on` and `on` action. Add 3 seconds delay after `ac-on` action to
avoid power on failed.
2. When the host status is turned on and the `on` operation is called,
shows `already on` then return.
3. When the host status is turned off and the `off` operation is
called, shows `already off` then return.

Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I7de0575e7869e0debd2aad17b793c223660020ba
diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl
index 5fe14db..2738364 100755
--- a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl
+++ b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl
@@ -367,6 +367,7 @@
     local SLED_NUM=$1
     echo "sled${SLED_NUM}: turn on AC"
     set_gpio "power-host${SLED_NUM}" 1
+    sleep 3 # Newer versions of the managed system needs 3 second delay
     echo "$ACTION_AC_ON" > "/tmp/sled${SLED_NUM}-last-action"
 }
 
@@ -454,6 +455,9 @@
         "$ACTION_CYCLE")
             do_action_cycle "$SLED_NUM"
             ;;
+        "$ACTION_ON")
+            echo "already on"
+            ;;
         *)
             echo "Invalid action ($ACTION) for current host state (On)"
             return 1
@@ -513,6 +517,9 @@
         "$ACTION_CYCLE")
             do_action_cycle "$SLED_NUM"
             ;;
+        "$ACTION_OFF")
+            echo "already off"
+            ;;
         *)
             echo "Invalid action ($ACTION) for current host state (Off)"
             return 1