Skip to content

Commit c2d4a35

Browse files
Merge pull request openstack-k8s-operators#495 from antonioromito/instanceha-redfish-400-status-code
Accept HTTP 400 status code for Redfish fencing when host is already off
2 parents 04d2def + beb712e commit c2d4a35

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

templates/instanceha/bin/instanceha.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -686,17 +686,18 @@ def _host_fence(host, action):
686686
return True
687687
logging.error('Power off of %s timed out' % host)
688688
return False
689-
elif r.status_code == 409:
689+
elif r.status_code in [400, 409]:
690690
# Check if server is already powered off
691+
# Some vendors (e.g., HPE iLo) return 400, others (e.g., Dell iDRAC) return 409
691692
power_state = _redfish_get_power_state(url, user, passwd, timeout)
692693
if power_state == 'OFF':
693694
logging.info('Power off of %s ok (already off)' % host)
694695
return True
695696
else:
696-
logging.error('Could not power off %s (409 but not OFF: %s)' % (host, power_state))
697+
logging.error('Could not power off %s (%d but not OFF: %s)' % (host, r.status_code, power_state))
697698
return False
698699
else:
699-
logging.error('Could not power off %s' % host)
700+
logging.error('Could not power off %s (status code: %d)' % (host, r.status_code))
700701
return False
701702
else:
702703
r = _redfish_reset(url, user, passwd, timeout, "On")

0 commit comments

Comments
 (0)