Import Running VM to vCloud Director

Another nice little feature in the recently released vCloud Director 8.10 (read eight dot ten) is the ability to import running VM under vCloud Director management.

In the past the vCloud system administrator could import virtual machine running in vCloud Director managed vSphere environment, however that VM had to be turned off.

Import from vSphere

Now in vCloud DIrector 8.10 the VM can be running which enables new use cases:

  • You can take existing vSphere environment under management of vCloud Director without impacting the workloads. Example would be going from vSphere only managed services to self service with vSphere + vCloud Director
  • Migrations of running VMs from vSphere to vCloud Director or between vCloud Directors. Cross vCenter Server vMotion nicely complements this feature. Cross-Cloud vMotion.

There are currently some limitations and considerations:

  • It is API only feature. The GUI button (above) can be used to import only powered-off VMs.
  • VM must be running on resources that are available to the Org VDC where it is being imported. That includes compute (cluster), storage policies and network port group. Obviously the networking is the most complex to get it right during the migration and requires some thought.
  • Import of VM with IDE controller is not supported.
  • A new vApp is created for the imported VM. You cannot import VM to an existing vApp.
  • As an input to the API call MoRef ID of the VM must be provided. The existing vCloud API call to list vSphere VMs outside of vCloud Director management however does not list running VMs. Therefore the MoRef ID must be acquired with vSphere API.

Example:

POST https://vcd-01a.corp.local/api/admin/extension/vimServer/3702cc8f-c23f-4a66-b9f3-73fc4b58ba82/importVmAsVApp

Accept: application/*+xml;version=20.0
x-vcloud-authorization: 3e131f9e3bc240269a7758fdb6c1bf7f
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="ImportedTestVM" sourceMove="true">
   <VmMoRef>vm-86</VmMoRef>
   <Vdc href="https://vcd-01a.corp.local/api/vdc/a10bdf92-18dc-474b-aafc-42d31ba83207" />
</ImportVmAsVAppParams>

20 thoughts on “Import Running VM to vCloud Director

  1. Nice post. Cloud be very helpful for upcoming migration tasks. Taking all the benefits from cross vCenter vMotion even MAC would stay.

    1. Thanks for the additional clarification, @onthaxon. We were stuck on this part this morning until we saw your comment. We also found that only VM-level storage policy is respected for import, so all virtual disks will be set to inherit the VM default, regardless of what was configured.

  2. Hi, we need to migrate all the vapps from the current vcenter to a new vcenter (5.5 to 6.0) in vcloud 8.10, how can we migrate all the vapps maintining service ?

      1. Basicly we need to migrate all the content in this vcenter to a new one, if we disconnect the host from the old vcenter a connect them to the new vcenter, coul this be an option ?

  3. Is there a way to import running VMs that are connected to VLAN-backed port groups that are available in the target OvDC as direct (external) networks? So far, we have only been able to import running VMs that are connected to a logical switch / routed OvDC network, and receive HTTP 400 Bad Request errors when one or more vNICs are connected to a VLAN-backed port group / direct OvDC network. ???

  4. Thanks Tom. My previous comment refers to default storage policy restriction: any way to work around this ?

      1. I’m testing on 8.20. When I do the API call I get:

        <Error xmlns="http://www.vmware.com/vcloud/v1.5&quot; stackTrace="com.vmware.vcloud.api.presentation.service.BadRequestException: Importing powered on vm Fortigate-VM2 (vm-300) to different datastore is not supported

        Or do you refer to 8.20 VM auto-import feature?

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.