You can make a copy of a vApp by cloning it. If the vApp is deployed when you clone it, the clone procedure also clones the memory state of the virtual machines in the vApp.
The cloneVApp request makes a copy of the vApp referenced in the Source element of the CloneVappParams request body. The request specifies a new name and, optionally, a new description for the copy.
The request can optionally include an IsSourceDelete element whose value specifies whether to delete the source vApp after the copy is complete. If IsSourceDelete is missing from the request body, or present with a value of false
, the source object remains in place after the copy is complete. Setting IsSourceDelete to true effectively moves or renames the vApp.
The request can also include a SourcedItem element for each VM that you want to modify during the cloning process. In each SourcedItem element, you must specify the target VM in a Source element and the new values of the properties that you want to modify. For example, if you want to configure a new storage profile for a cloned VM, use the StorageProfile element in the SourcedItem element. If you want to configure a VDC compute policy for a cloned VM, use the VdcComputePolicy element in the SourcedItem element. For information about VDC compute policies, see Managing VM-Host Affinity Rules.
- Memory state of all virtual machines in the source vApp is preserved in the clone.
- The clone is suspended and connected to an isolated network.
Prerequisites
This operation requires the rights included in the predefined vApp Author role or an equivalent set of rights.Verify that you are logged in to the vCloud Air Compute Service as an End User.
Procedure
Example: Clone a vApp
POST https://vcloud.example.com/api/vdc/12/action/cloneVApp Content-Type: application/vnd.vmware.vcloud.cloneVAppParams+xml ... <?xml version="1.0" encoding="UTF-8"?> <CloneVAppParams xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" name="cloned" deploy="false" powerOn="false"> <Description>Cloned vApp Example</Description> <InstantiationParams> <NetworkConfigSection> <ovf:Info>Configuration parameters for logical networks</ovf:Info> <NetworkConfig networkName="vAppNetwork"> <Configuration> <ParentNetwork href="https://vcloud.example.com/api/network/101"/> <FenceMode>bridged</FenceMode> </Configuration> </NetworkConfig> </NetworkConfigSection> </InstantiationParams> <Source href="https://vcloud.example.com/api/vApp/vapp-7"/> <IsSourceDelete>false</IsSourceDelete> <SourcedItem> <Source href="https://vcloud.example.com/api/vAppTemplate/vm-4"/> <StorageProfile href="https://vcloud.example.com/api/vdcStorageProfile/45"> </StorageProfile> <VdcComputePolicy href="https://vcloud.example.com/cloudapi/vdcComputePolicies/74" name="policy_vmGroup2_cluster1"> </VdcComputePolicy> </SourcedItem> </CloneVAppParams>
The response is a sparsely populated VApp element in the target VDC. When the Task embedded in the response is complete, the vApp has been cloned.
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="cloned" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/vApp/vapp-103"> ... <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcloud.example.com/api/vdc/12"/> ... <Description>Cloned vApp Example</Description> ... <Tasks> <Task status="running" operation="Copying Virtual Application cloned (103)" ... > </Task> </Tasks> ... </VApp>