To create a vApp from a vApp template, you must bind the template's abstract resource requirements, such as network connections, storage resources, memory, and CPU capacity, to appropriate resources in the target VDC. This binding operation is called instantiation.
To deploy the vApp, you construct an InstantiateVAppTemplateParams element that specifies a vApp template to use and a network to connect to, then POST the element to the action/instantiateVAppTemplate URL of the VDC.
This operation requires the rights included in the predefined vApp Author role or an equivalent set of rights.
1 | Retrieve the XML representation of the vApp template. Make a GET request to the URL provided in the href attribute of the Entity contained by the CatalogItem that references the template. You can also use the query service to return a list of references to vApp templates that you can access. |
2 | Examine the template to find the Vm elements of the virtual machines that it contains. Look for a NetworkConnection element in the Vm. You need some of the information in that element to create a vApp network that the virtual machine can connect to. |
3 | Create an InstantiateVAppTemplateParams element. See Example: Deploying a vApp for guidelines. |
4 | Make a POST request to the action/instantiateVAppTemplate URL of the VDC. Supply the InstantiateVAppTemplateParams element as the request body. |
The server takes the requested action and returns a VApp element. The element has a status attribute value of 0, meaning it is unresolved because the vApp is still being constructed. It also contains a Task element that tracks the progress of the request.
See the response portion of Example: Deploying a vApp.
This simple instantiateVAppTemplate request assumes that the vApp template includes one Vm and has no special requirements other than connecting that Vm to a network. For a look at a more complex instantiation request, see Example: Instantiate a vApp Template and Modify Virtual Machine Name, Description, and Storage Profile. The InstantiateVAppTemplateParams includes the following information:
■
|
A name for the vApp, supplied in the name attribute of the InstantiateVAppTemplateParams element. This request also provides a description, which is optional but a good practice. | ||||||
■
|
A reference to a template, obtained from the href attribute of the Entity contained by the CatalogItem that you retrieved in Retrieve a Catalog Item and suppled in the Source element of the InstantiateVAppTemplateParams. | ||||||
■
|
Configuration parameters for a vApp network, supplied in the NetworkConfigSection element. This specification includes the following parameters:
For more information about creating networks with the vCloud API, see About vCloud Director Networks. |
The target of the request is the instantiateVAppTemplate URL of this VDC. See Example: Deployment Information in a VDC. Because the operation creates a new vApp object, the HTTP request type is POST.
POST https://vcloud.example.com/api/vdc/5/action/instantiateVAppTemplate Content-Type: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml ... <?xml version="1.0" encoding="UTF-8"?> <InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v1.5" name="Linux FTP server" deploy="true" powerOn="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"> <Description>Example FTP Server</Description> <InstantiationParams> <NetworkConfigSection> <ovf:Info>Configuration parameters for logical networks </ovf:Info> <NetworkConfig networkName="vAppNetwork"> <Configuration> <ParentNetwork href="https://vcloud.example.com/api/network/54" /> <FenceMode>bridged</FenceMode> </Configuration> </NetworkConfig> </NetworkConfigSection> </InstantiationParams> <Source href="https://vcloud.example.com/api/vAppTemplate/vappTemplate-111" /> </InstantiateVAppTemplateParams>
The response to the instantiation request is a sparsely populated vApp element that includes the following information:
201 Created Content-Type: application/vnd.vmware.vcloud.vApp+xml ... <VApp xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" deployed="false" status="0" name="Linux FTP server" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/vApp/vapp-7"> <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcloud.example.com/api/vdc/5"/> <Description>Example FTP Server vApp</Description> <Tasks> <Task status="running" operation="Creating Virtual Application Linux FTP server(7)" ... > <Owner type="application/vnd.vmware.vcloud.vApp+xml" name="LinuxFtpServer" href="https://vcloud.example.com/vApp/vapp-7" /> </Task> </Tasks> </VApp>