Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if the Host is powered off before probing the console #570

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions common/OpTestConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ class OpTestConstants():
ERROR_SELENIUM_HEADLESS = "Host doesn't have selenium installed"
POWER_ACTIVATE_SUCCESS = "Power limit successfully activated"
POWER_DEACTIVATE_SUCCESS = "Power limit successfully deactivated"
CHASSIS_POWER_ON = 'Chassis Power is on'
CHASSIS_POWER_OFF = 'Chassis Power is off'
GARD_CLEAR_SUCCESSFUL = 'Clearing the entire gard partition...done'
NO_GARD_RECORDS = 'No GARD entries to display'
CMD_NOT_FOUND = 'command not found'
Expand Down
7 changes: 3 additions & 4 deletions common/OpTestIPMI.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,14 +675,13 @@ def ipmi_power_status(self):
'''
Determines the power status of the bmc

:returns: string: Power status of bmc
"Chassis Power is on" or "Chassis Power is off"
:returns: Bool: True if the system is powered on.
'''
l_output = self.ipmitool.run('chassis power status')
if('on' in l_output):
return BMC_CONST.CHASSIS_POWER_ON
return True
elif('off' in l_output):
return BMC_CONST.CHASSIS_POWER_OFF
return False
else:
raise OpTestError(
"Can't recognize chassis power status: " + str(l_output))
Expand Down
7 changes: 7 additions & 0 deletions common/OpTestSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ def goto_state(self, state):
self.util.check_nvram_options(self.console)

def run_DETECT(self, target_state):
if not self.sys_power_is_on():
log.info("Detected powered off system")
return OpSystemState.OFF

self.detect_counter += 1
detect_state = OpSystemState.UNKNOWN
if self.detect_counter >= 3:
Expand Down Expand Up @@ -916,6 +920,9 @@ def sys_power_soft(self):
return BMC_CONST.FW_FAILED
return rc

def sys_power_is_on(self):
return self.cv_IPMI.ipmi_power_status()

##
# @brief Power off the system
#
Expand Down