VMware vSphere ESXi 7.x and above
This issue occurs due to the presence of running vCLS VMs on the datastores.
To resolve this issue:
Prior to unmount or detach a datastore, check if there are any vCLS VMs deployed in that datastore. If there are any, migrate those VMs to another datastore within the cluster if there is another datastore attached to the hosts within the cluster.
If the datastore that is being considered for "unmount" or "detach" is the only datastore connected to the host and this datastore has vCLS VM, then the only option is to power-off this vCLS VM is by using Retreat Mode on the cluster.
Note: This datastore might be connected to different hosts in different clusters and vCLS VMs from all these different clusters might be stored in this datastore. In such a case, Retreat Mode has to configured on all the clusters connected to this datastore, so this datastore can be unmounted or detached.
Alternatively, you can also add the new datastore to the vSphere Cluster Services - allowed datastores list. After adding the allowed datastores, you can then Storage vMotion the vCLS VMs to the newly configured datastores which will in turn free up the datastores that you wish to decommission.
Reference Documentation: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/7-0/vsphere-resource-management-7-0.html
Note: If the storage backing the datastore has been removed before the datastore was unmounted and removed and vCLS VMs are still running on it the only solution is to place the cluster(s) in Retreat Mode and reboot the host(s) with the stuck vCLS VMs. Once rebooted the vCLS VMs will be gone and datastore removal may proceed if still present (typically the datastore will also be removed already as no references remain).