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.
If the vApp is deployed when you clone it and the target VDC is backed by the same provider VDC as the source VDC, the clone is created with the following properties:
■
|
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. |
This operation requires the rights included in the predefined vApp Author role or an equivalent set of rights.
This request creates a copy of the vApp created in Example: Instantiate a vApp Template and Modify Virtual Machine Name, Description, and Storage Profile in another VDC. Because the ParentNetwork in the Source vApp is not available in the VDC specified in the action/cloneVApp request, the CloneVAppParams request body must include InstantiationParams that specify a new ParentNetwork for the vApp network, one that is available in the target VDC. The request also includes a SourcedItem specifying a new storage profile for the virtual machine in the 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> </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>