HMC

 View Only
Expand all | Collapse all

How to create LPAR using HMC Rest API

  • 1.  How to create LPAR using HMC Rest API

    Posted Sun November 04, 2018 02:13 PM

    Originally posted by: Bart_G


    Dear HMC REST API developers,

    Can you share information/documentation giving an example how to create a new LPAR via REST API ? I'm looking an equivalent of HMC CLI command "mksyscfg -r lpar....:

    According to the documentation I should use PUT request with application/vnd.ibm.powervm.uom+xml; Type=LogicalPartition media type but there must be multiple parameters defined to create an lpar. Can you list them? Is it possible to create an XML with parameters and use it for the PUT request

     

    Deleting an LPAR is easy I do:

    -i -H "Content-Type: application/vnd.ibm.powervm.web+xml; type=LogicalPartitionProfile" -X DELETE -H "Accept: application/atom+xml; charset=UTF-8" -H "X-Audit-Memento: events"  https://HMCURL:12443/rest/api/uom/LogicalPartition/LPARUUID

    I wonder if this is possible to submit as a job to see the positive/negative result.



  • 2.  Re: How to create LPAR using HMC Rest API

    Posted Mon November 05, 2018 06:23 AM

    Originally posted by: Sridevi Joshi


    Bart_G,

    Here is the sample payload that can be used to create new LPAR. This would create a LPAR with name 'test' of type 'AIX/Linux'. This payload can be modified based on requirement.

     

    Payload:

    <LogicalPartition:LogicalPartition xmlns:LogicalPartition="http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/" xmlns="http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/" xmlns:ns2="http://www.w3.org/XML/1998/namespace/k2" schemaVersion="V1_7_0">
               <PartitionID kb="COD" kxe="false">25</PartitionID>
               <PartitionMemoryConfiguration kb="CUD" kxe="false" schemaVersion="V1_7_0">
                   <Metadata>
                       <Atom/>
                   </Metadata>
                   <DesiredMemory kb="CUD" kxe="false">512</DesiredMemory>
                   <MaximumMemory kb="CUD" kxe="false">1024</MaximumMemory>
                   <MinimumMemory kb="CUD" kxe="false">256</MinimumMemory>
               </PartitionMemoryConfiguration>
               <PartitionName kxe="false" kb="CUR">test</PartitionName>
               <PartitionType kxe="false" kb="COD">AIX/Linux</PartitionType>
           </LogicalPartition:LogicalPartition>
          

    Alternatively, you can also get the existing LPAR specification from GET method and use the response as payload to create new partition by changing the specification as required.



  • 3.  Re: How to create LPAR using HMC Rest API

    Posted Mon November 05, 2018 03:48 PM

    Originally posted by: Bart_G


    Dear Sridevi,

    Can you be a little be more specific. There is absolutely no documentation how to use particular operations via REST API. Therefore,  any help is appreciated. Thank you for the Payload but I don't think it would work. There is no details about CPU/VRTCPU and a managed server where the lpar supposed to be built. Also I do not know what API can be used for build an lpar. Is it /rest/api/uom/LogicalPartition or /rest/api/uom/ManagedSystem/{ManagedSystem_uuid}/LogicalPartition/ ?

    I  query an lpar using GET but it is not clear what parameters are required for build.



  • 4.  Re: How to create LPAR using HMC Rest API

    Posted Tue November 13, 2018 05:43 AM

    Originally posted by: Sridevi Joshi


    Above payload has minimal data required to create a partition. Using above payload would create a partition with default dedicated CPU configuration of 1 units to maximum, minimum and desired processors. Below are the details of URI and content-type that would help to create a partition.

    URI: https://<HMC_IP>:12443/rest/api/uom/ManagedSystem/<ManagedSystem_UUID>/LogicalPartition
    Method: PUT
    Content_type: application/vnd.ibm.powervm.uom+xml; type=LogicalPartition

    Payload with CPU configuration:

    <LogicalPartition:LogicalPartition xmlns:LogicalPartition="http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/" xmlns="http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/" xmlns:ns2="http://www.w3.org/XML/1998/namespace/k2" schemaVersion="V1_8_0">
               <PartitionID kb="COD" kxe="false">29</PartitionID>
               <PartitionMemoryConfiguration kb="CUD" kxe="false" schemaVersion="V1_8_0">
                   <Metadata>
                       <Atom/>
                   </Metadata>
                   <DesiredMemory kb="CUD" kxe="false">512</DesiredMemory>
                   <MaximumMemory kb="CUD" kxe="false">1024</MaximumMemory>
                   <MinimumMemory kb="CUD" kxe="false">256</MinimumMemory>
               </PartitionMemoryConfiguration>
               <PartitionName kxe="false" kb="CUR">lpar5</PartitionName>
               <PartitionProcessorConfiguration kb="CUD" kxe="false" schemaVersion="V1_8_0">
                    <Metadata>
                        <Atom/>
                    </Metadata>
                    <DedicatedProcessorConfiguration kb="CUD" kxe="false" schemaVersion="V1_8_0">
                        <Metadata>
                            <Atom/>
                        </Metadata>
                        <DesiredProcessors kb="CUD" kxe="false">2</DesiredProcessors>
                        <MaximumProcessors kxe="false" kb="CUD">2</MaximumProcessors>
                        <MinimumProcessors kb="CUD" kxe="false">2</MinimumProcessors>
                    </DedicatedProcessorConfiguration>
                    <HasDedicatedProcessors kxe="false" kb="CUD">true</HasDedicatedProcessors>
                    <SharingMode kxe="false" kb="CUD">sre idle proces</SharingMode>
                </PartitionProcessorConfiguration>
               <PartitionType kxe="false" kb="COD">AIX/Linux</PartitionType>
           </LogicalPartition:LogicalPartition>