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 vmnameVM 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.
vCenter 8.#
Cloud Director 10.#
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.
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.
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.
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.