VMware, Inc. 67
Chapter 5 Datacenter Operations
Recompose a vApp to Add or Remove Virtual Machines
ThevCloudAPIsupportsrecompositionofavApptoaddorremovevirtualmachines(Vmelements).To
recomposeavApp,aclientmakesarecomposeVApprequest,supplyingaRecomposeVAppParamselementas
therequestbody.TheRecomposeVAppParamselementallowsanarbitrarynumberofDeleteItemelements,
butisotherwiseidenticaltoComposeVAppParams.
Thismeansthatinadditiontoaddingorremovingvirtual
machines,arecomposeVApprequestcanalsochangethenameanddescriptionofthevApp,andcansupply
newInstantiationParamstochangevarioussectionsofthecomposedvApporanyoftheaddedvirtual
machines.
Example 5-6. vApp Before Recomposition
Request:
GET http://vcloud.example.com/api/v1.0/vApp/vapp-33
Response:
200 OK
Content-type: application/vnd.vmware.vcloud.vApp+xml
...
<VApp name="Example Corp’s CRM Appliance" type="application/vnd.vmware.vcloud.vApp+xml"
status="8" href="http://vcloud.example.com/api/v1.0/vApp/vapp-33" ...>
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
href="http://vcloud.example.com/api/v1.0/vdc/5"/>
<Description>Composed CRM Appliance</Description>
...
<Children>
<Vm status="8" name="CRM-DB" href="http://vcloud.example.com/api/v1.0/vApp/vm-7" ...>
...
</Vm>
<Vm status="8" name="CRM-CRM" href="http://vcloud.example.com/api/v1.0/vApp/vm-44" ...>
...
</Vm>
<Vm status="8" name="CRM-HTTP" href="http://vcloud.example.com/api/v1.0/vApp/vm-45" ...>
...
</Vm>
</Children>
...
</VApp>
Example 5‐7showsarecomposeVApprequestthatmodifiesthevAppshowninExample 5‐6byremovingone
ofthevirtualmachinesitcontainsandcreatinganewStartupSectionthatspecifiesastartuporderforthe
twovirtualmachinesthatremaininthevApp.
Example 5-7. Recompose a vApp
Request:
POST http://vcloud.example.com/api/v1.0/vApp/vapp-33/action/recomposeVApp
Content-Type: application/vnd.vmware.vcloud.recomposeVAppParams+xml
...
<RecomposeVAppParams name="Example Corp’s CRM Appliance" xmlns="http://www.vmware.com/vcloud/v1"
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
<InstantiationParams>
<NetworkConfigSection>
<ovf:Info>Configuration parameters for logical networks</ovf:Info>
<NetworkConfig networkName="CRMApplianceNetwork">
<Configuration>
<ParentNetwork href="http://vcloud.example.com/api/v1.0/network/54"/>
<FenceMode>bridged</FenceMode>
</Configuration>
</NetworkConfig>
</NetworkConfigSection>