VMware, Inc. 65
Chapter 5 Datacenter Operations
Compose a vApp
ThevCloudAPIsupportscomposingavAppfromanycombinationofvApptemplates,vApps,orvirtual
machines.WhenyoucomposeavApp,allchildrenofeachcompositionsourcebecomepeersintheChildren
collectionofthecomposedvApp.
TocomposeavApp,aclientmakesacomposeVApprequestwhosebody,a
ComposeVAppParamselement,
includesthefollowinginformation:
AnInstantiationParamselementthatappliestothecomposedvAppitselfandanyvApptemplates
referencedinItemelements.Formoreinformation,see“A b o u t InstantiationParameters”onpage 62.
AnItemelementforeachvirtualmachine,vApp,orvAppTemplatetoincludeinthecomposition.Each
Itemcancontainthefollowingelements:
ArequiredSourceelementwhosehrefattributevalueisareferencetoavApptemplate,vApp,or
Vmtoincludeinthecomposition.IftheSourceelementreferencesaVm,theItemmustalsoinclude
anInstantiationParamselementspecifictothatVm.
AnoptionalNetworkAssignmentelementthatspecifieshowthenetworkconnectionsofchildVm
elementsaremappedtovAppnetworksintheparent.
IfanyofthecompositionitemsissubjecttoaEULA,theComposeVAppParamselementmustincludean
AllEULAsAcceptedelementthathasavalueoftrue,indicatingthatyouaccepttheEULA.Otherwise,
compositionfails.
ThecomposedvAppmustbedeployedandpoweredonbeforeitcanbeused.
Example 5‐4showsa
composeVApprequestthatspecifiestwovAppTemplatesourcesandoneVmsource.The
VmsourcerequiresInstantiationParamsthatmodifyitsNetworkConnectionSectiontospecifythevApp
networkcreatedforthisvApp.ThevAppTemplatesourcesinheritthissettingfromthebase
InstantiationParamselement(theonethatappearsbeforethefirstItemisspecified).
Example 5-4. Compose a vApp
Request:
POST http://vcloud.example.com/api/v1.0/vdc/5/action/composeVApp
Content-Type: application/vnd.vmware.vcloud.composeVAppParams+xml
...
<ComposeVAppParams 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>
</InstantiationParams>
<Item>
<Source href="http://vcloud.example.com/api/v1.0/vApp/vm-4"/>
<InstantiationParams>
<NetworkConnectionSection
type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
href="http://vcloud.example.com/api/v1.0/vApp/vm-4/
networkConnectionSection/" ovf:required="false">
<ovf:Info/>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="CRMApplianceNetwork">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IsConnected>true</IsConnected>
<IpAddressAllocationMode>DHCP</IpAddressAllocationMode>
</NetworkConnection>