

@ucs_helper.requires_ucs_client
def get_power_state(self, task, helper=None):
    'Get the current power state.\n\n        Poll the host for the current power state of the node.\n\n        :param task: instance of `ironic.manager.task_manager.TaskManager`.\n        :param helper: ucs helper instance\n        :raises: MissingParameterValue if required CiscoDriver parameters\n            are missing.\n        :raises: UcsOperationError on error from UCS Client.\n        :returns: power state. One of :class:`ironic.common.states`.\n        '
    try:
        power_handle = ucs_power.UcsPower(helper)
        power_status = power_handle.get_power_state()
    except ucs_error.UcsOperationError as ucs_exception:
        LOG.error(_LE('%(driver)s: get_power_state operation failed for node %(uuid)s with error: %(msg)s.'), {
            'driver': task.node.driver,
            'uuid': task.node.uuid,
            'msg': ucs_exception,
        })
        operation = _('getting power status')
        raise exception.UcsOperationError(operation=operation, error=ucs_exception, node=task.node.uuid)
    return UCS_TO_IRONIC_POWER_STATE.get(power_status, states.ERROR)

dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/ucs/power.py Power.get_power_state/original