sdague / amt

Python tools for interacting with Intel's AMT hardware control interfaces
Apache License 2.0
64 stars 30 forks source link

No pxeboot when power state is "off" #16

Open Rixillo opened 7 years ago

Rixillo commented 7 years ago

I find that the pxeboot command works if the target machine is in "standby", but fails if the machine is in state "off".

I offer the following explanation: the pxeboot command of amtctrl sends two wsman commands to the target machine, first a boot config setting of "PXE", followed by a power state change request of "reboot". I suspect it is not valid to send a "reboot" to a machine that is off.

With the old amttool program, I could branch to handle either state correctly (after initially querying to get power state).

if ($powerstate == 'off') { 
    amttool 10.0.0.xx powerup pxe
} elsif ($powerstate == 'standby') {
    amttool 10.0.0.xx powercycle pxe
}

amtctrl provides pxe-reboot capability, but not pxe-boot.

Below is the (unhandled) error message returned when the target machine was in state "off":

/usr/bin/amtctrl -p  10.0.0.142 pxeboot
<?xml version="1.0" ?>
<a:Envelope xmlns:a="http://www.w3.org/2003/05/soap-envelope" xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:d="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:e="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:f="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:g="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PowerManagementService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <a:Header>
    <b:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</b:To>
    <b:RelatesTo>uuid:fc49c92a-8b5d-46e6-a695-e0baca76d80d</b:RelatesTo>
    <b:Action a:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PowerManagementService/RequestPowerStateChangeResponse</b:Action>
    <b:MessageID>uuid:00000000-8086-8086-8086-000000000047</b:MessageID>
    <c:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PowerManagementService</c:ResourceURI>
  </a:Header>
  <a:Body>
    <g:RequestPowerStateChange_OUTPUT>
      <g:ReturnValue>2</g:ReturnValue>
    </g:RequestPowerStateChange_OUTPUT>
  </a:Body>
</a:Envelope>

The return value of 2 is an error code. (reference: http://www.dmtf.org/sites/default/files/standards/documents/DSP1027_2.0.1.pdf)