Warn if fencing will fail

Verify our IPMI state on startup, and then warn if fencing will fail.
For now, this is sufficient, but in future (requires refactoring) we
might want to adjust how fencing occurs based on this information.
This commit is contained in:
Joshua Boniface 2020-08-13 14:38:05 -04:00
parent 0587bcbd67
commit 985ad5edc0
2 changed files with 20 additions and 1 deletions

View File

@ -693,7 +693,13 @@ else:
zkhandler.writedata(zk_conn, { '/primary_node': myhostname }) zkhandler.writedata(zk_conn, { '/primary_node': myhostname })
############################################################################### ###############################################################################
# PHASE 7 - Ensure Libvirt is working # PHASE 7a - Ensure IPMI is reachable and working
###############################################################################
if not fencing.verifyIPMI(config['ipmi_hostname'], config['ipmi_username'], config['ipmi_password']):
logger.out('Our IPMI is not reachable; fencing of this node will likely fail', state='w')
###############################################################################
# PHASE 7b - Ensure Libvirt is working
############################################################################### ###############################################################################
if enable_hypervisor: if enable_hypervisor:

View File

@ -144,3 +144,16 @@ def rebootViaIPMI(ipmi_hostname, ipmi_user, ipmi_password, logger):
logger.out('Failed to reboot dead node', state='e') logger.out('Failed to reboot dead node', state='e')
print(ipmi_reset_stderr) print(ipmi_reset_stderr)
return False return False
#
# Verify that IPMI connectivity to this host exists (used during node init)
#
def verifyIPMI(ipmi_hostname, ipmi_user, ipmi_password):
ipmi_command_status = '/usr/bin/ipmitool -I lanplus -H {} -U {} -P {} chassis power status'.format(
ipmi_hostname, ipmi_user, ipmi_password
)
ipmi_status_retcode, ipmi_status_stdout, ipmi_status_stderr = common.run_os_command(ipmi_command_status, timeout=2)
if ipmi_status_retcode == 0 and ipmi_status_stdout != "Chassis Power is on":
return True
else:
return False