To import a virtual machine as a vApp, a system administrator can make a request to the importVmAsVApp link of the VimServer that manages the virtual machine.
■
| |
■
|
Identify the virtual machine to import. See Retrieve a List of Virtual Machines from a vCenter Server. |
This example imports one of the virtual machines shown in the response portion of Example: Retrieve a List of Virtual Machines from a vCenter Server. The request body is an ImportVmAsVAppParams element whose sourceMove attribute specifies that the source virtual machine should remain in vCenter inventory after the import is complete. The request body includes the href of the VDC that receives the import and a VmMoRef element that contains the managed object reference of the virtual machine to import. The response is an unresolved vApp body that contains a Task that tracks the import.
POST https://vcloud.example.com/api/admin/extension/vimServer/9/importVmAsVapp Content-type: application/vnd.vmware.admin.importVmAsVAppParams+xml ... <?xml version="1.0" encoding="UTF-8"?> <ImportVmAsVAppParams xmlns="http://www.vmware.com/vcloud/extension/v1.5" name="ImportedWin2K8" sourceMove="false"> <VmMoRef>vm-43</VmMoRef> <Vdc href="http://vcloud.example.com/api/vdc/2" /> </ImportVmAsVAppParams>
201 Created Content-Type: application/vnd.vmware.vcloud.vApp+xml ... <VApp ... status="0" name="ImportedWin2K8" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/vApp/vapp-102" ... > ... <Description /> <Tasks> <Task operation=”Busy Virtual Application Win2K8 ”> ... </Task> </Tasks> </VApp>