diff --git a/common/OpTestConstants.py b/common/OpTestConstants.py index 454b77d0f..b22f6b9ef 100644 --- a/common/OpTestConstants.py +++ b/common/OpTestConstants.py @@ -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' diff --git a/common/OpTestIPMI.py b/common/OpTestIPMI.py index b80f26132..68b649433 100644 --- a/common/OpTestIPMI.py +++ b/common/OpTestIPMI.py @@ -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)) diff --git a/common/OpTestSystem.py b/common/OpTestSystem.py index 1b8e35a7a..c032248b5 100644 --- a/common/OpTestSystem.py +++ b/common/OpTestSystem.py @@ -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: @@ -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 #