An instantiateOvf request uploads an OVF package and then creates a vApp from it. By default, this operation also deploys the vApp and powers it on.

If you want to deploy an OVF package as a vApp without creating a vApp template and corresponding catalog item, make an instantiateOvf request. This request initiates a workflow similar to the one shown in Upload an OVF Package to Create a vApp Template, but with a few important differences.

  • The target of the upload is a VDC, not a catalog.
  • The request body is an InstantiateOvfParams element, not an UploadVAppTemplateParams element.
  • The response is a VApp element that includes an upload URL for the OVF descriptor.

After you retrieve the VApp element created by the instantiateOvf request, you can upload the descriptor and the files it references.

Prerequisites

Verify that the following are true:

  • You have an OVF package to upload.
  • You are logged in as a user who has permission to upload OVF packages and create vApps.
  • You know the URL of the target VDC that will receive the upload. Retrieve the XML representation of your organization to see a list of the VDCs that it contains.

Review the contents of the Envelope element in the descriptor file of your OVF package. Several properties in this file have implications for the InstantiateOvfParams request body you must construct to initiate the upload.

Procedure

  1. Retrieve the XML representation of the target VDC.
  2. Examine the response to locate the Link element that contains the URL for creating a vApp from an OVF package.
    This element has a rel attribute value of add and a type attribute value of application/vnd.vmware.vcloud.instantiateOvfParams+xml, as shown here:
    <Link
       rel="add"
       type="application/vnd.vmware.vcloud.instantiateOvfParams+xml"
       href="https://vcloud.example.com/api/vdc/44/action/instantiateOvf" />
  3. Create an InstantiateOvfParams request body.
    See the request portion of Create a vApp From an OVF Package.
  4. POST the InstantiateOvfParams to the instantiateOvf URL you retrieved in Step 2
    See the request portion of Create a vApp From an OVF Package.
  5. Examine the response.
    The response, a VApp element, contains a File element that specifies an upload URL for the OVF descriptor. See the response portion of Create a vApp From an OVF Package
  6. Upload the OVF descriptor.
    Make a PUT request to the upload URL in the VApp. The upload URL for the OVF descriptor is in a Link element with the following form:
    <Link
       rel="upload:default"
       href="https://vcloud.example.com/transfer/.../descriptor.ovf" />
    Supply the OVF descriptor as the request body. The OVF descriptor contains a single Envelope element.
  7. Retrieve the remaining upload URLs
    1. Retrieve the VApp.
    2. Verify that the value of the ovfDescriptorUploaded attribute is true.
    3. Examine the VApp to find the upload URLs for the files referenced in the OVF descriptor.
      These URLs are contained in Link elements where rel="upload:default".
  8. Upload the referenced files.
    You can follow the progress of the upload by retrieving the vApp and noting the progress of the embedded Task.

Results

After all of the referenced files are uploaded, the VApp element no longer includes an embedded Task. The vApp is placed in the power and deployment state that the values of the powerOn and deploy attributes specify in the request body.

Example: Create a vApp From an OVF Package

This request includes a NetworkMapping element that maps a network name found in the uploaded OVF descriptor to the name of a network available in the target VDC.

Request:
POST https://vcloud.example.com/api/vdc/5/action/instantiateOvf
Content-Type: application/vnd.vmware.vcloud.instantiateOvfParams+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<InstantiateOvfParams
   xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
   xmlns="http://www.vmware.com/vcloud/v1.5"
   name="W2K8">
   <Description>Example vApp</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>
   <AllEULAsAccepted>true</AllEULAsAccepted>
   <NetworkMapping>
      <Source>Network 1</Source>
      <Target>vAppNetwork</Target>
   </NetworkMapping>
   <InstantiateVmParams
      id="VM-1">
      <Name>VM-1</Name>
      <NetworkConnectionSection>
         <ovf:Info />
         <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
         <NetworkConnection
            network="Network 1">
            <NetworkConnectionIndex>0</NetworkConnectionIndex>
            <IsConnected>true</IsConnected>
            <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
         </NetworkConnection>
      </NetworkConnectionSection>
      <ComputerName>W2K8</ComputerName>
   </InstantiateVmParams>
</InstantiateOvfParams>

The response is a sparsely populated VApp element that includes an upload URL for the OVF descriptor. See Uploading Referenced Files for file upload procedures.

Response:
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="W2K8"
   type="application/vnd.vmware.vcloud.vApp+xml"
   href="https://vcloud.example.com/api/vApp/vapp-23">
   <Link
      rel="up"
      type="application/vnd.vmware.vcloud.vdc+xml"
      href="https://vcloud.example.com/api/vdc/5"/>
   <Description>Example vApp</Description>
      <Link
      rel="remove"
      href="https://vcloud.example.com/api/vApp/vapp-23" />
   <Description>Example vApp</Description>
   <Tasks>
      <Task
         status="running"
         operation="Creating Virtual Application W2K8(23)"
         ... >
         ...
      </Task>
   </Tasks>
   <Files>
      <File
         name="descriptor.ovf"
         bytesTransferred="0">
         <Link
            rel="upload:default"
            href="https://vcloud.example.com/transfer/.../descriptor.ovf" />
      </File>
   </Files>
   <Owner>
      ...
   </Owner>
   <InMaintenanceMode>false</InMaintenanceMode>
</VApp>