@task_manager.require_exclusive_lock
    def set_power_state(self, task, pstate):
        if pstate not in IRONIC_TO_CIMC_POWER_STATE:
            msg = _("set_power_state called for %(node)s with "
                    "invalid state %(state)s")
            raise exception.InvalidParameterValue(
                msg % {"node": task.node.uuid, "state": pstate})
        with common.cimc_handle(task) as handle:
            try:
                handle.set_imc_managedobject(
                    None, class_id="ComputeRackUnit",
                    params={
                        imcsdk.ComputeRackUnit.ADMIN_POWER:
                            IRONIC_TO_CIMC_POWER_STATE[pstate],
                        imcsdk.ComputeRackUnit.DN: "sys/rack-unit-1"
                    })
            except imcsdk.ImcException as e:
                raise exception.CIMCException(node=task.node.uuid, error=e)

        if pstate is states.REBOOT:
            pstate = states.POWER_ON

        state = _wait_for_state_change(pstate, task)
        if state != pstate:
            raise exception.PowerStateFailure(pstate=pstate)
Set the power state of the task's node.
dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/cimc/power.py/Power.set_power_state