Skip to content

Commit

Permalink
Avoid infinite loop for node power off (#79)
Browse files Browse the repository at this point in the history
Update block to retry 14 times every 30 seconds and then exit

Related to: openshift/release#55817
  • Loading branch information
sgoveas authored Aug 27, 2024
1 parent 8792795 commit c26a21c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions images/fcos-bastion-image/root/usr/bin/prepare_host_for_boot
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,19 @@ function ipmi_cmd() {
}

log "Powering off the host..."
until ipmi_cmd power status | grep -i -q "Chassis Power is off"; do
log "Host is powered on: forcing power off..."
ipmi_cmd power off || true
sleep 30
for i in {1..16}; do
if [ "${i}" -eq 16 ]; then
log "Exiting after $((i - 1)) retries"
exit 1
fi
if ! ipmi_cmd power status | grep -i -q "Chassis Power is off"; then
log "Attemp ${i}: Host is powered on: forcing power off..."
ipmi_cmd power off || true
sleep 30
else
log "Attemp ${i}: Host is powered off"
break
fi
done

if [[ "${ipxe_via_vmedia}" == "true" ]] && [[ "${BOOT_MODE}" == "pxe" ]]; then
Expand Down

0 comments on commit c26a21c

Please sign in to comment.