HMC

 View Only
  • 1.  HMC API restart

    Posted 24 days ago

    Hello,

      can anyone share some code that someone wrote in running this HMC API endpoint? 

    " /rest/api/uom/ManagementConsole/{UUID}/do/ShutdownHMC "

    having a hard time using this endpoint in my go code ... any language will work i just want to see if this endpoint tested and is working for others.  



    ------------------------------
    Marvin Jones
    ------------------------------


  • 2.  RE: HMC API restart

    Posted 21 days ago

    Hi Marvin,

    Good day,

    To use the REST API to perform  HMC shutdown or restart. Giving a sample from a 1060 HMC version

    1. Perform login using with the user who has got the authorisation 

             i.e PUT operation to get the X-API-Session  using the URI:-  https://{IP_OR_DOMAIN}/rest/api/web/Logon

    Curl Sample:- 

    curl --insecure --request PUT '${URI}' \

    --header 'Content-Type:  application/vnd.ibm.powervm.web+xml; type=LogonRequest' \

    --data '<LogonRequest

        schemaVersion="V1_0"

        xmlns="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/"

        xmlns:mc="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/">

          <UserID>hscroot</UserID>

          <Password>{password}</Password>

    </LogonRequest>'

       2. Perform a GET call to get the ManagementConsole UUID

            e.g:- URI  = https://{IP_OR_DOMAIN}/rest/api/uom/ManagementConsole

    Curl Sample:- 

    curl  --insecure --request GET --url ${URI}  --header 'X-API-Session: ${API_SESSSION}' 

        3.  Next we need to perform a PUT call to perform shutdown or restart operation of HMC.  

            URI:- https://{IP_OR_DOMAIN}/rest/api/uom/ManagementConsole/{UUID}/do/ShutdownHMC . 

               UUID is the value obtained from step2.  Ensure you set the header params.

            i.e :-  

              3.1) Content-Type =. application/vnd.ibm.powervm.web+xml; type=JobRequest 

              3.2) X-API-Session. Value obtained from  step1.

          

           3.A)  The XML body sample  for restart of HMC:-

    <JobRequest:JobRequest

     xmlns:JobRequest="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/"

     xmlns="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/"

     xmlns:ns2="http://www.w3.org/XML/1998/namespace/k2" schemaVersion="V1_1_0">

        <Metadata>

            <Atom/>

        </Metadata>

        <RequestedOperation kb="CUR" kxe="false" schemaVersion="V1_1_0">

            <Metadata>

                <Atom/>

            </Metadata>

            <OperationName kb="ROR" kxe="false">ShutdownHMC</OperationName>

            <GroupName kb="ROR" kxe="false">ManagementConsole</GroupName>

        </RequestedOperation>

        <JobParameters kb="CUR" kxe="false" schemaVersion="V1_1_0">

            <Metadata>

                <Atom/>

            </Metadata>

            <JobParameter schemaVersion="V1_0"><Metadata><Atom/></Metadata>

            <ParameterName kb="ROR" kxe="false">Operation</ParameterName>

            <ParameterValue kb="CUR" kxe="false">Restart</ParameterValue>

        </JobParameter>

       </JobParameters>

    </JobRequest:JobRequest>

     3.B) The XML body sample  for shutdown of HMC:-

    <JobRequest:JobRequest

     xmlns:JobRequest="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/"

     xmlns="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/"

     xmlns:ns2="http://www.w3.org/XML/1998/namespace/k2" schemaVersion="V1_1_0">

        <Metadata>

            <Atom/>

        </Metadata>

        <RequestedOperation kb="CUR" kxe="false" schemaVersion="V1_1_0">

            <Metadata>

                <Atom/>

            </Metadata>

            <OperationName kb="ROR" kxe="false">ShutdownHMC</OperationName>

            <GroupName kb="ROR" kxe="false">ManagementConsole</GroupName>

        </RequestedOperation>

        <JobParameters kb="CUR" kxe="false" schemaVersion="V1_1_0">

            <Metadata>

                <Atom/>

            </Metadata>

            <JobParameter schemaVersion="V1_0"><Metadata><Atom/></Metadata>

            <ParameterName kb="ROR" kxe="false">Operation</ParameterName>

            <ParameterValue kb="CUR" kxe="false">Shutdown</ParameterValue>

        </JobParameter>

       </JobParameters>

    </JobRequest:JobRequest>

    Curl Sample for restart:- 

    curl  --insecure --request PUT \

      --url ${URI} \

      --header 'Content-Type: application/vnd.ibm.powervm.web+xml; type=JobRequest' \

      --header 'X-API-Session: $'{API_SESSION} \

      --data '<JobRequest:JobRequest

     xmlns:JobRequest="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/"

     xmlns="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/"

     xmlns:ns2="http://www.w3.org/XML/1998/namespace/k2" schemaVersion="V1_1_0">

        <Metadata>

            <Atom/>

        </Metadata>

        <RequestedOperation kb="CUR" kxe="false" schemaVersion="V1_1_0">

            <Metadata>

                <Atom/>

            </Metadata>

            <OperationName kb="ROR" kxe="false">ShutdownHMC</OperationName>

            <GroupName kb="ROR" kxe="false">ManagementConsole</GroupName>

        </RequestedOperation>

        <JobParameters kb="CUR" kxe="false" schemaVersion="V1_1_0">

            <Metadata>

                <Atom/>

            </Metadata>

            <JobParameter schemaVersion="V1_0"><Metadata><Atom/></Metadata>

            <ParameterName kb="ROR" kxe="false">Operation</ParameterName>

            <ParameterValue kb="CUR" kxe="false">Restart</ParameterValue>

        </JobParameter>

       </JobParameters>

    </JobRequest:JobRequest>'



    ------------------------------
    Vardhaman Narasagoudar
    ------------------------------



  • 3.  RE: HMC API restart

    Posted 21 days ago

    Vardhaman,

       Thanks you!!!  kindly for this example. I was trying to look for some official documentation on upgrading and update HMCs with the correct XML payload. Do you have a link for the doc? 



    ------------------------------
    Marvin Jones
    ------------------------------



  • 4.  RE: HMC API restart

    Posted 20 days ago

    Hi Marvin,

    You can find the HMC job details here:
    https://www.ibm.com/docs/en/power10?topic=jobs-updatemanagementconsole-managementconsole-job

    Upgrade job details:
    https://www.ibm.com/docs/en/power10?topic=jobs-upgradehmc



    ------------------------------
    Vijay Kumar Bana
    ------------------------------