host-reboot: add host instance in get_reboot_count()
Add multi-host support to get_reboot_count()
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I77c00273bfcf4a45a6e24ac8e1a8540f2d609e04
diff --git a/scripts/host-reboot b/scripts/host-reboot
index e9d7692..82f478d 100755
--- a/scripts/host-reboot
+++ b/scripts/host-reboot
@@ -10,8 +10,8 @@
get_reboot_count()
{
- busctl get-property xyz.openbmc_project.State.Host \
- /xyz/openbmc_project/state/host0 \
+ busctl get-property xyz.openbmc_project.State.Host"$1" \
+ /xyz/openbmc_project/state/host"$1" \
xyz.openbmc_project.Control.Boot.RebootAttempts AttemptsLeft \
| cut -d ' ' -f2
}
@@ -37,7 +37,7 @@
host_instance=$1
-reboot_count=$(get_reboot_count)
+reboot_count=$(get_reboot_count "$host_instance")
if [ "$reboot_count" -eq 0 ]; then
echo "reboot count is 0, go to host quiesce"
host_quiesce "$host_instance"