HMC

 View Only
Expand all | Collapse all

How to change lparname and rename default_profile via rest call

  • 1.  How to change lparname and rename default_profile via rest call

    Posted Fri October 04, 2019 10:01 AM

    Originally posted by: Dominic_Schweizer


    Hi There,

    I have automated everything with powervc to create an LPAR. Now the last thing to do is rename the lpar (without these UUIDs) and rename the profile. But my first priority is to rename the lparname.

    My Rest Call is as follow to rename the Lpar:

    curl -k -c cookies.txt -b cookies.txt -i -H "Content-Type: application/vnd.ibm.powervm.uom+xml; Type=LogicalPartition" -H "Accept: application/atom+xml; charset=UTF-8" -X POST -H "Expect:" -d @partitionname.xml https://hmc301.eng.zkb.ch:12443/rest/api/uom/LogicalPartition/2FBD8BF1-C3D1-41BA-8A38-B44D4F9D1BBE

    --> the ID at the end is the lpar UUID...

    ---

    my xml body is the following:

    <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":PartitionProfiles schemaVersion="V1_7_0">
        <Metadata>
            <Atom/>
        </Metadata>
            <PartitionName kxe="false" kb="CUR">aix9020.eng</PartitionName>
    </LogicalPartition:LogicalPartition>


    ----

    I have always Problems with the first xml element <LogicalPartition:LogicalPartition>. There seems to be always an error....with xml parsing, i think my xml body is not good enough....

    1. error i had was:

    The content of element 'LogicalPartition:LogicalPartition' is not complete

    2. error i had after a little modification:

    LogicalPartition" must be followed by either attribute specifications, "&gt;" or "/&gt;"

    ........

    Can you provide me a rest call and a xml body to rename the lparname, or do you see what i did wrong?

    Hope u can help me!

    Thanks in advance

    Cheers

    Dominic

     



  • 2.  Re: How to change lparname and rename default_profile via rest call

    Posted Sat October 05, 2019 01:10 AM

    Originally posted by: Sridevi Joshi


    The error "The content of element 'LogicalPartition:LogicalPartition' is not complete" comes because it expects the other mandatory elements like 'PartitionProcessorConfiguration' , 'PartitionType' etc.

    Always perform the GET on the resource(in this case LogicalPartition), Modify the content as desired and then perform POST operation.

     

    To modify the Partition name please perform below steps.

    1. Perform GET using below curl command

    curl -k  -c cookies.txt -b cookies.txt  -i -H "Content-Type: application/vnd.ibm.powervm.uom+xml; Type=LogicalPartition" -H "Accept: application/atom+xml; charset=UTF-8" -X GET  https://hmc301.eng.zkb.ch:12443/rest/api/uom/LogicalPartition/2FBD8BF1-C3D1-41BA-8A38-B44D4F9D1BBE

    2. Copy the response from <LogicalPartition:LogicalPartition> to </LogicalPartition:LogicalPartition> and save it in partitionname.xml

    3. Edit the xml to modify the <PartitionName> attribute with desired name and save.

    4. Now perform the curl command which was used earlier.

    curl -k -c cookies.txt -b cookies.txt -i -H "Content-Type: application/vnd.ibm.powervm.uom+xml; Type=LogicalPartition" -H "Accept: application/atom+xml; charset=UTF-8" -X POST -H "Expect:" -d @partitionname.xml https://hmc301.eng.zkb.ch:12443/rest/api/uom/LogicalPartition/2FBD8BF1-C3D1-41BA-8A38-B44D4F9D1BBE

    This will modify the Partition name with desired name.

     

     

     

     



  • 3.  Re: How to change lparname and rename default_profile via rest call

    Posted Mon October 07, 2019 09:48 AM

    Originally posted by: Dominic_Schweizer


    Hi Sridevi Joshi

     

    Thank you very much for your quick reply!

    It worked! so great.. you are my hero :-)

     

    Wish you a wonderful day!

    Cheers

    Dominic