def _reboot(driver_info):
    """Reboot this node.

    If the power is off, turn it on. If the power is on, reset it.

    :param driver_info: the bmc access info for a node.
    :returns: power state POWER_ON, one of :class:`ironic.common.states`.
    :raises: IPMIFailure when the native ipmi call fails.
    :raises: PowerStateFailure when invalid power state is returned
             from ipmi.
    """

    msg = _("IPMI power reboot failed for node %(node_id)s with the "
            "following error: %(error)s")
    try:
        ipmicmd = ipmi_command.Command(bmc=driver_info['address'],
                                       userid=driver_info['username'],
                                       password=driver_info['password'])
        wait = CONF.ipmi.retry_timeout
        ret = ipmicmd.set_power('boot', wait)
    except pyghmi_exception.IpmiException as e:
        error = {'node_id': driver_info['uuid'], 'error': e} % msg
        LOG.error(error)
        raise exception.IPMIFailure(error)

    if 'error' in ret:
        error = _("bad response: %s") % ret
        LOG.error(msg, {'node_id': driver_info['uuid'], 'error': error})
        raise exception.PowerStateFailure(pstate=states.REBOOT)

    return states.POWER_ON
dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/ipminative.py/_reboot/swapped operands of `%`