Virtual Machine not Auto Importing with VM Discovery turned on in Cloud Director
search cancel

Virtual Machine not Auto Importing with VM Discovery turned on in Cloud Director

book

Article ID: 404387

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

It is desired to manage a certain VM via Cloud Director and auto import is not functioning.
VM Discovery is turned on at the Provider level (https://<vip_fqdn>/provider/) under Administration>General>Other>VM Discovery.
VM Discovery either inherits the setting or is set to Enabled at the Provider level (https://<vip_fqdn>/provider/) under Resources>Organization VDCs>OrgVDC>General>Other
A VM is in the Organization VDC Resource pool in vCenter.

The VM says that the auto import failed when running the following command:

cell-management-tool debug-auto-import --vm vmname
VM with name:vmname, moref vm-### in VC vcentername can be skipped for the following reasons:
1) Virtual Machine is not present in a vCD managed resource pool.
2) Virtual machine auto import failed in last attempt. A retry will be attempted in #### seconds. The retry delay is configurable by property ... Please consult the audit events to know the cause of the failure in auto import.

Examining the /opt/vmware/vcloud-director/logs/vcloud-container-debug.log shows similar to the following:

grep -i "vm-###" /opt/vmware/vcloud-director/logs/vcloud-container-debug.log
####-##-## ##:##:##,### | ERROR | Backend-activity-pool-#### | CreateAutoManagedVappActivity [Activity Execution] Encountered error while importing VM [vcId=########-####-####-####-########### moref=vm-###] from VC ########-####-####-####-########### into VCD - Handle: urn:uuid:########-####-####-####-###########, Current Phase: CreateAutoManagedVAppActivityImportVmFromVcPhase | activity=com.vmware.vcloud.api.presentation.service.BadRequestException: Importing powered on vm vmname (moref vm-### and disk profile [Current Storage Profile Policy Name]) to different datastore OVDC Storage Profile Policy Name is not supported.

Environment

vCenter 8.#
Cloud Director 10.#

Cause

The VM is not configured with a Storage Policy configured for the OVDC, or is not on a datastore that is not supported by the Storage Policy.

Resolution

If available, examine a VM which is already imported and manageable in the Cloud Director UI at the vCenter level to see what storage policy and datastore or datastore cluster it is in.

Configured Storage Policies can be found under the Provider portal (https://<vip_fqdn>/provider/) at Resources>Organization VDCs>OrgVDC>Policies>Storage.

  1. Edit the vCenter VM by right clicking on it and selecting Edit Settings.
  2. Drop down on each of the Hard Disks and select a valid VM storage policy for the OVDC.
  3. Click OK.
  4. Right Click on the VM again and select Migrate...
  5. Change Storage Only, and select a Compatible Datastore or Datastore Cluster.
  6. NEXT and FINISH the migration wizard.

Now that the VM is under a compatible datastore and storage policy it will import on the next retry.  By default, it can take up to an hour to retry.

Additional Information

The VM may have recently been restored to vCenter's inventory after being removed from vCenter's inventory from underneath Cloud Director Management, giving it a new moref in vCenter if so, see: Unable to manage UNKNOWN VM in VMware Cloud Director to remove VMs in an Unknown State.