VMware {code} Community
hha86
Contributor
Contributor

5.1 API recompose failed with <StorageProfile> specified

We are having strange behavior when attempt to use the 5.1 API recompose to add new VM into existing vApp

When we specify the <StorageProfile> in the request body, the recompose API call either result in

a) 500 internal_server_error

or

b) a task that run successfully, but new VM never added to vApp

pseudo request sample

URL:

POST https://my.vmware.vcd/api/vApp/vapp-b115286e-5940-4feb-b08f-3ff7848ae301/action/recomposeVApp

Request header:

Accept: application/*+xml;version=5.1

Content-Type: application/vnd.vmware.vcloud.recomposeVAppParams+xml

Request Body:

<?xml version="1.0" encoding="UTF-8"?>

<RecomposeVAppParams ...>

    <SourcedItem>

       <Source href="{a valid resource url of vm from another vApp under the same vdc}">

          <InstantiationParams>

              <NetworkConnectionSection xmlns="http://www.vmware.com/vcloud/v1.5"

                                        xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"

                                        type="application/vnd.vmware.vcloud.networkConnectionSection+xml"

                                        ovf:required="false">

                  <ovf:Info />

                  <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>

                  <NetworkConnection network="none">

                      <NetworkConnectionIndex>0</NetworkConnectionIndex>

                      <IsConnected>false</IsConnected>

                      <IpAddressAllocationMode>NONE</IpAddressAllocationMode>

                  </NetworkConnection>

               </NetworkConnectionSection>

           </InstantiationParams>


           <StorageProfile href="{a valid storage profile resource url under the same vdc}"/>

       

        </Source>

    </SourcedItem>

    <AllEULAsAccepted>true</AllEULAsAccepted>

</RecomposeVAppParams>


Strangely enough if we removed the <StorageProfile> element from the request payload, the new VM is properly added to the vApp with default storage profile.


We have to make use of modify VM call to update the new VM's storage profile (using the same storage profile url that failed in recompose) if it defers from the default.


Wonder if anyone having the same issue? any prerequisites missing?


Appreciate any helps.

 

Reply
0 Kudos
1 Reply
cfor
Expert
Expert

I know it has been a while, I hit this same issue and found a solution so I wanted to post it...

Issue I had was the ORDER of the XML attributes.  "StorageProfile" is at the SourcedItem level, and it had to be the LAST item (after Source and after InstantiationParams for it to work) Seems odd order matters, but it did for me.  (VCD 5.5 and 6.0 tested)

ChrisF (VCP4, VCP5, VCP-Cloud) - If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
Reply
0 Kudos