Below are bestpractices to unmount datastore from vCenter.
Below checks should be considered.
-No VM resides on the datastore
-The datastore is not part of Datastore cluster
-The datastore is not managed by storage DRS
-SIOC is disabled for this datastore
-The datastore is not used for vSphere HA heartbeat.
If you unmount from VI client connecting to vCenter, these checks will be handled by VI client.
From ESXi host
- Only check feasible is : -No VM resides on the datastore
-Remaining checks are not easy to code if we want to unmount from ESXI directly. The reason is ESXi can not know weather SIOC/SDRS etc are enabled.
-If you have to unmount from ESXi, you first should check either manaully or pro-grammatically from VC & if everything is OK, finally unmount/detach the datastore from ESXi