VMware Cloud Director API - POST-InstantiateOvf

VMware Cloud Director API - POST-InstantiateOvf

POST /vdc/{id}/action/instantiateOvf

Operation:
POST /vdc/{id}/action/instantiateOvf
Description:
Instantiate a vApp or VM from an OVF
Since:
5.5
Input parameters
Consume media type(s):
application/vnd.vmware.vcloud.instantiateOvfParams+xml
application/vnd.vmware.vcloud.instantiateOvfParams+json
Input type:
InstantiateOvfParamsType
Output parameters
VAppType

The response includes an upload link for the OVF descriptor

Produce media type(s):
application/vnd.vmware.vcloud.vApp+xml
application/vnd.vmware.vcloud.vApp+json
Output type:
VAppType
Examples
Request
HTTP 1.1
POST /api/vdc/afaafb99-228c-4838-ad07-5bf3aa649d42/action/instantiateOvf

Headers:
Content-Length: 2649
Content-Type: application/vnd.vmware.vcloud.instantiateOvfParams+xml; charset=ISO-8859-1
x-vcloud-authorization: GOV36tW1h9toImB+yHyLVnQkbOMchQQNt6NObzn7O4E=

Body:
<?xml version="1.0" encoding="UTF-8"?><vcloud:InstantiateOvfParams
    xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
    xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
    name="Instantiate OVF example">
    <vcloud:Description>vApp from uploaded OVF</vcloud:Description>
    <vcloud:InstantiationParams>
        <vcloud:NetworkConfigSection>
            <ovf:Info/>
            <vcloud:NetworkConfig
                networkName="Network 1">
                <vcloud:Configuration>
                    <vcloud:ParentNetwork
                        href="https://vcloud.example.com/api/network/1fcc8a15-340d-43cc-a200-76c2cbbe70ba"
                        name="VM Network"
                        type="application/vnd.vmware.vcloud.network+xml"/>
                    <vcloud:FenceMode>bridged</vcloud:FenceMode>
                </vcloud:Configuration>
            </vcloud:NetworkConfig>
        </vcloud:NetworkConfigSection>
    </vcloud:InstantiationParams>
    <vcloud:AllEULAsAccepted>true</vcloud:AllEULAsAccepted>
    <vcloud:NetworkMapping>
        <vcloud:Source>Network 1</vcloud:Source>
        <vcloud:Target>VM Network</vcloud:Target>
    </vcloud:NetworkMapping>
    <vcloud:InstantiateOvfProperty>
        <vcloud:ClassId>vami</vcloud:ClassId>
        <vcloud:InstanceId>instantiateOvfExample</vcloud:InstanceId>
        <vcloud:Key>ip0</vcloud:Key>
        <vcloud:Value>10.20.30.40</vcloud:Value>
    </vcloud:InstantiateOvfProperty>
    <vcloud:InstantiateVmParams
        id="instantiateOvfExample">
        <vcloud:NetworkConnectionSection>
            <ovf:Info/>
            <vcloud:PrimaryNetworkConnectionIndex>0</vcloud:PrimaryNetworkConnectionIndex>
            <vcloud:NetworkConnection
                network="Network 1">
                <vcloud:NetworkConnectionIndex>0</vcloud:NetworkConnectionIndex>
                <vcloud:IsConnected>true</vcloud:IsConnected>
                <vcloud:IpAddressAllocationMode>POOL</vcloud:IpAddressAllocationMode>
            </vcloud:NetworkConnection>
        </vcloud:NetworkConnectionSection>
        <vcloud:ComputerName>vm.computerName</vcloud:ComputerName>
        <vcloud:VdcStorageProfile
            href="https://vcloud.example.com/api/vdcStorageProfile/eb6aacbd-f0d8-4a07-8248-1de28151e98f"
            name="profile"
            type="application/vnd.vmware.vcloud.vdcStorageProfile+xml"/>
        <vcloud:HardwareCustomization>
            <vcloud:NumberOfCpus>2</vcloud:NumberOfCpus>
            <vcloud:CoresPerSocket>2</vcloud:CoresPerSocket>
            <vcloud:MemorySize>512</vcloud:MemorySize>
            <vcloud:Disk
                instanceId="5">
                <vcloud:Size>10240</vcloud:Size>
            </vcloud:Disk>
        </vcloud:HardwareCustomization>
    </vcloud:InstantiateVmParams>
</vcloud:InstantiateOvfParams>
Response
HTTP/1.1 201 Created

Headers:
Content-Length: 3379
Content-Type: application/vnd.vmware.vcloud.vapp+xml;version=5.5
Location: https://vcloud.example.com/api/vApp/vapp-4adfd936-9959-4547-a912-9af762617317
Vary: Accept-Encoding

Body:
<?xml version="1.0" encoding="UTF-8"?><VApp
    xmlns="http://www.vmware.com/vcloud/v1.5"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    deployed="false"
    href="https://vcloud.example.com/api/vApp/vapp-4adfd936-9959-4547-a912-9af762617317"
    id="urn:vcloud:vapp:4adfd936-9959-4547-a912-9af762617317"
    name="Instantiate OVF example"
    ovfDescriptorUploaded="false"
    status="0"
    type="application/vnd.vmware.vcloud.vApp+xml"
    xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://https://vcloud.example.com/api/v1.5/schema/master.xsd">
    <Link
        href="https://vcloud.example.com/api/vApp/vapp-4adfd936-9959-4547-a912-9af762617317/controlAccess/"
        rel="down"
        type="application/vnd.vmware.vcloud.controlAccess+xml"/>
    <Link
        href="https://vcloud.example.com/api/vdc/afaafb99-228c-4838-ad07-5bf3aa649d42"
        rel="up"
        type="application/vnd.vmware.vcloud.vdc+xml"/>
    <Link
        href="https://vcloud.example.com/api/vApp/vapp-4adfd936-9959-4547-a912-9af762617317/owner"
        rel="down"
        type="application/vnd.vmware.vcloud.owner+xml"/>
    <Link
        href="https://vcloud.example.com/api/vApp/vapp-4adfd936-9959-4547-a912-9af762617317/metadata"
        rel="down"
        type="application/vnd.vmware.vcloud.metadata+xml"/>
    <Link
        href="https://vcloud.example.com/api/vApp/vapp-4adfd936-9959-4547-a912-9af762617317/ovf"
        rel="ovf"
        type="text/xml"/>
    <Link
        href="https://vcloud.example.com/api/vApp/vapp-4adfd936-9959-4547-a912-9af762617317/productSections/"
        rel="down"
        type="application/vnd.vmware.vcloud.productSections+xml"/>
    <Description>vApp from uploaded OVF</Description>
    <Tasks>
        <Task
            cancelRequested="false"
            expiryTime="2013-05-14T18:49:50.983+03:00"
            href="https://vcloud.example.com/api/task/405840f6-363d-435a-abbc-5ceda1f117f4"
            id="urn:vcloud:task:405840f6-363d-435a-abbc-5ceda1f117f4"
            name="task"
            operation="Importing Virtual Application Instantiate OVF example(4adfd936-9959-4547-a912-9af762617317)"
            operationName="vdcUploadOvfContents"
            serviceNamespace="com.vmware.vcloud"
            startTime="2013-02-13T18:49:50.983+02:00"
            status="running"
            type="application/vnd.vmware.vcloud.task+xml">
            <Link
                href="https://vcloud.example.com/api/task/405840f6-363d-435a-abbc-5ceda1f117f4/action/cancel"
                rel="task:cancel"/>
            <Owner
                href="https://vcloud.example.com/api/vApp/vapp-4adfd936-9959-4547-a912-9af762617317"
                name="Instantiate OVF example"
                type="application/vnd.vmware.vcloud.vApp+xml"/>
            <User
                href="https://vcloud.example.com/api/admin/user/51e86769-9e2d-4edc-af4e-5d3606494cbf"
                name="system"
                type="application/vnd.vmware.admin.user+xml"/>
            <Organization
                href="https://vcloud.example.com/api/org/7b832bc5-3d65-45a2-8d35-da28388ab80a"
                name="Default"
                type="application/vnd.vmware.vcloud.org+xml"/>
            <Progress>1</Progress>
            <Details/>
        </Task>
    </Tasks>
    <Files>
        <File
            bytesTransferred="0"
            name="descriptor.ovf"
            size="-1">
            <Link
                href="https://vcloud.example.com/transfer/5a5cad30-b08a-41d8-a489-bc2331479a26/descriptor.ovf"
                rel="upload:default"/>
        </File>
    </Files>
    <DateCreated>2013-02-13T18:49:50.962+02:00</DateCreated>
    <Owner
        type="application/vnd.vmware.vcloud.owner+xml">
        <User
            href="https://vcloud.example.com/api/admin/user/51e86769-9e2d-4edc-af4e-5d3606494cbf"
            name="system"
            type="application/vnd.vmware.admin.user+xml"/>
    </Owner>
    <InMaintenanceMode>false</InMaintenanceMode>
</VApp>
Upload OVF descriptor

Request
HTTP 1.1
PUT /transfer/5a5cad30-b08a-41d8-a489-bc2331479a26/descriptor.ovf

Headers:
Content-Length: 5462
Content-Type: application/*+xml
x-vcloud-authorization: GOV36tW1h9toImB+yHyLVnQkbOMchQQNt6NObzn7O4E=

Body:
<?xml version="1.0" encoding="UTF-8"?><ovf:Envelope
    xmlns="http://schemas.dmtf.org/ovf/envelope/1"
    xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
    xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
    xmlns:vmw="http://www.vmware.com/schema/ovf"
    xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <References>
    <File
        ovf:href="instantiateOvfExample.vmdk"
        ovf:id="instantiateOvfExample.vmdk_id"
        ovf:size="68096"/>
  </References>
  <NetworkSection>
    <Info>List of logical networks used in the package</Info>
    <Network
        ovf:name="Network 1">
      <Description>Network 1</Description>
    </Network>
  </NetworkSection>
  <vmw:IpAssignmentSection
      ovf:required="false"
      vmw:protocols="IPv4,IPv6"
      vmw:schemes="ovfenv,dhcp">
    <Info>Supported IP assignment schemes</Info>
  </vmw:IpAssignmentSection>
  <DiskSection>
    <Info>List of the virtual disks and partitions needed</Info>
    <Disk
        ovf:capacity="4"
        ovf:capacityAllocationUnits="byte * 2^20"
        ovf:diskId="system"
        ovf:fileRef="instantiateOvfExample.vmdk_id"
        ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"
        ovf:populatedSize="0"/>
  </DiskSection>
  <VirtualSystem
      ovf:id="instantiateOvfExample">
    <Info>A virtual machine</Info>
    <EulaSection>
      <Info>End User License Agreement</Info>
      <License>EXAMPLE END USER LICENSE AGREEMENT</License>
    </EulaSection>
    <ProductSection
        ovf:required="false">
      <Info>VM ISV branding information</Info>
      <Product>Instantiate OVF Example</Product>
      <Vendor>VMware, Inc.</Vendor>
      <Version>1.0.0.0</Version>
      <FullVersion>5.0.0.0 Build 000000</FullVersion>
      <ProductUrl/>
      <VendorUrl>http://www.vmware.com</VendorUrl>
      <AppUrl/>
      <Category>Application</Category>
    </ProductSection>
    <ProductSection
        ovf:class="vami"
        ovf:instance="instantiateOvfExample"
        ovf:required="false">
      <Info>VAMI Properties</Info>
      <Category>Networking Properties</Category>
      <Property
          ovf:key="ip0"
          ovf:type="string"
          ovf:userConfigurable="true"
          vmw:qualifiers="Ip('Network 1')">
        <Label>Network 1 IP Address</Label>
        <Description>The IP address for this interface.</Description>
      </Property>
    </ProductSection>
    <AnnotationSection>
      <Info/>
      <Annotation>Instantiate OVF example package</Annotation>
    </AnnotationSection>
    <OperatingSystemSection
        ovf:id="85"
        ovf:version="11"
        vmw:osType="sles11_64Guest">
      <Info>Guest Operating System</Info>
      <Description>SUSE Linux Enterprise Server 11.1 64bit</Description>
    </OperatingSystemSection>
    <VirtualHardwareSection
        ovf:required="false"
        ovf:transport="com.vmware.guestInfo">
      <Info>Virtual Hardware Requirements</Info>
      <System>
        <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
        <vssd:InstanceID>0</vssd:InstanceID>
        <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
      </System>
      <Item>
        <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
        <rasd:Description>Number of virtual CPUs</rasd:Description>
        <rasd:ElementName>1 virtual CPU</rasd:ElementName>
        <rasd:InstanceID>1</rasd:InstanceID>
        <rasd:ResourceType>3</rasd:ResourceType>
        <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
      </Item>
      <Item>
        <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
        <rasd:Description>Memory Size</rasd:Description>
        <rasd:ElementName>2048 MB of memory</rasd:ElementName>
        <rasd:InstanceID>2</rasd:InstanceID>
        <rasd:ResourceType>4</rasd:ResourceType>
        <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
      </Item>
      <Item>
        <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
        <rasd:Connection>Network 1</