If the system includes more than one Provider VDC, and at least two of those Provider VDCs use a common set of storage profiles, a VMWVdcTemplate in that system can include multiple ProviderVdcReference elements. Each time this sort of template is instantiated, the system evaluates the current resource commitments of each of the referenced Provider VDCs and chooses the one best able to support a new organization VDC.

A VDC template that includes routed networking and specifies multiple Provider VDCs must include references to the following objects:
  • Two or more candidate Provider VDCs that share at least one storage profile. Each of the Provider VDCs must have at least one available external network.
  • A reference to a Provider VDC storage profile defined in all candidate Provider VDCs
  • A network pool specification.
When this form of VDC template is instantiated, it creates an organization VDC that is backed by one of the candidate Provider VDCs.
Note:

When you specify multiple Provider VDCs in a template that includes networking, you must also add a Binding element to each ProviderVdcReference. A Binding associates a symbolic name with an external network in the Provider VDC. You use this symbolic name as the value of the href attribute of the Network configured in the template. When the template is instantiated, the system replaces the symbolic name with a reference to the network specified in the Value element of the Binding.

Prerequisites

This operation is restricted to system administrators.

Use a procedure like the one shown in Create a VDC Template or Create a VDC Template That Includes Routed Networking to create a VMWVdcTemplate request body. You can specify multiple Provider VDCs in a VDC template whether or not the template includes routed networking. The procedure shown here adds another Provider VDC to the template shown in Create a VDC Template That Includes Routed Networking.

Procedure

  1. List the Provider VDCs that exist in the system.
    You can use a query like this one to list all the Provider VDCs in the system.
    GET https://vcloud.example.com/api/query?type=providerVdc&format=references
  2. List the external networks and network pools available in each Provider VDCto specify in this VDC template.
    Use a request like this one to retrieve the XML representation of the Provider VDC:
    GET https://vcloud.example.com/api/admin/extension/providervdc/35
    The AvailableNetworks element in the response lists the external networks created in that Provider VDC. The NetworkPoolReferences element in the response lists references to all network pools created in that Provider VDC.
    <vmext:VMWProviderVdc ... >
       ...
       <vcloud:AvailableNetworks>
          <vcloud:Network
             type="application/vnd.vmware.admin.network+xml"
             name="VC1-VLAN48"
             href="https://vcloud.example.com/api/admin/network/297" />
          <vcloud:Network ... />
          <vcloud:Network ... />
       </vcloud:AvailableNetworks>
       ...
       <vcloud:NetworkPoolReferences>
          <vcloud:NetworkPoolReference
             type="application/vnd.vmware.admin.networkPool+xml"
             name="VC1-VXLAN"
             href="https://vcloud.example.com/api/admin/extension/networkPool/313" />
       </vcloud:NetworkPoolReferences>
    </vmext:VMWProviderVdc>
    .
  3. For each Provider VDC that you include in this template, create a ProviderVdcReference that references the Provider VDC and includes a Binding element that references an external network available in that Provider VDC.
  4. POST the VMWVdcTemplate request body to the system's add link for vdcTemplates.

Results

The system creates the new VDC template and returns a VMWVdcTemplate element that includes a set of Link elements that you can use to access, remove, or modify the new template.

Example: Create a VDC Template With Routed Networking and Multiple Provider VDCs

This request creates a VDC template that is identical to the one shown in Create a VDC Template That Includes Routed Networking, but adds a second ProviderVdcReference and includes Binding elements that provide symbolic references to external networks.

The Binding element in each ProviderVdcReference pairs a Name element that contains a user-specified identifier in URN format with a Value element that specifies the href of an external network in the candidate Provider VDC. The GatewayConfiguration of the template uses that URN instead of a URL for the href attribute of its Network element.
<Network href="urn:vcloud:binding:35c80ae2-36ef-4e2f-a430-ca704db9709f"/>
When the template is instantiated, this URN is replaced by the network URL in the Value part of the Binding associated with the ProviderVdcReference that the system selects during instantiation.

This example also uses the AutomaticNetworkPoolReference flag to specify that organization VDCs created by instantiating this template use the VXLAN network pool that was created automatically when the Provider VDC was created. If you decide not to use AutomaticNetworkPoolReference in a VDC template that specifies multiple Provider VDCs, you must specify a network pool that exists in one of the candidate Provider VDCs. All organization VDCs that are created from this template use that pool, regardless of the Provider VDC that is chosen during instantiation.

Request:
POST https://vcloud.example.com/api/admin/extension/vdcTemplates
Content-Type: application/vnd.vmware.admin.vmwVdcTemplate+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<vmext:VMWVdcTemplate
   xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
   xmlns="http://www.vmware.com/vcloud/v1.5"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   name="example-vdc-template-2PVDCs">
   <Description>Example AllocationVapp VDC Template with Gateway</Description>
   <vmext:TenantName>PayAsYouGo-VDCTemplate</vmext:TenantName>
   <vmext:TenantDescription>PayAsYouGo-VdcTemplate</vmext:TenantDescription>
   <vmext:ProviderVdcReference
      href="https://vcloud.example.com/api/admin/providervdc/35"
      name="vCenter01"
      type="application/vnd.vmware.admin.providervdc+xml">
      <vmext:Binding>
         <vmext:Name>urn:vcloud:network:35c80ae2-36ef-4e2f-a430-ca704db9709f</vmext:Name>
         <vmext:Value href="https://vcloud.example.com/api/admin/network/297"></vmext:Value>
      </vmext:Binding>
   </vmext:ProviderVdcReference>
   <vmext:ProviderVdcReference
      href="https://vcloud.example.com/api/admin/providervdc/39"
      name="vCenter02"
      type="application/vnd.vmware.admin.providervdc+xml">
      <vmext:Binding>
         <vmext:Name>urn:vcloud:network:35c80ae2-36ef-4e2f-a430-ca704db9709f</vmext:Name>
         <vmext:Value href="https://vcloud.example.com/api/admin/network/99"></vmext:Value>
      </vmext:Binding>
   </vmext:ProviderVdcReference>
   <vmext:VdcTemplateSpecification
      xsi:type="vmext:VMWAllocationVappVdcTemplateSpecificationType">
      <NicQuota>100</NicQuota>
      <VmQuota>50</VmQuota>
      <ProvisionedNetworkQuota>100</ProvisionedNetworkQuota>
      <GatewayConfiguration>
         <Gateway name="theEdge">
            <Description>Edge Gateway defined by VDC template</Description>
            <Configuration>
               <GatewayBackingConfig>compact</GatewayBackingConfig>
               <GatewayInterfaces>
                  <GatewayInterface>
                     <Name>uplink1</Name>
                     <DisplayName>Uplink interface defined by VDC template</DisplayName>
                     <Network
                        href="urn:vcloud:binding:35c80ae2-36ef-4e2f-a430-ca704db9709f"/>
                     <InterfaceType>uplink</InterfaceType>               
                  </GatewayInterface>
               </GatewayInterfaces>
               <HaEnabled>false</HaEnabled>
               <UseDefaultRouteForDnsRelay>false</UseDefaultRouteForDnsRelay>
            </Configuration>
         </Gateway>
         <Network name="RoutedOVDCNet">
            <Description>Routed through an Edge Gateway</Description>
            <Configuration>
               <IpScopes>
                  <IpScope>
                     <IsInherited>false</IsInherited>
                     <Gateway>192.168.0.1</Gateway>
                     <Netmask>255.255.255.0</Netmask>
                     <IpRanges>
                        <IpRange>
                           <StartAddress>192.168.0.100</StartAddress>
                           <EndAddress>192.168.0.199</EndAddress>
                        </IpRange>
                     </IpRanges>
                  </IpScope>
               </IpScopes>
               <FenceMode>natRouted</FenceMode>
            </Configuration>
            <IsShared>false</IsShared>
         </Network>
      </GatewayConfiguration>
      <StorageProfile name="Bronze">
         <Enabled>true</Enabled>
         <Units>MB</Units>
         <Limit>2097152</Limit>
         <Default>true</Default>
      </StorageProfile>
      <vmext:ThinProvision>false</vmext:ThinProvision>
      <vmext:FastProvisioningEnabled>false</vmext:FastProvisioningEnabled>
      <vmext:AutomaticNetworkPoolReference/>
      <CpuAllocationMhz>2048</CpuAllocationMhz>
      <CpuLimitMhzPerVcpu>1000</CpuLimitMhzPerVcpu>
      <MemoryAllocationMB>2048</MemoryAllocationMB>
      <CpuGuaranteedPercentage>1</CpuGuaranteedPercentage>
      <MemoryGuaranteedPercentage>1</MemoryGuaranteedPercentage>
   </vmext:VdcTemplateSpecification>
</vmext:VMWVdcTemplate>