A workflow I'm creating needs to take a VM and a list of datastores which should be either empty or have a single VMDK on them. I can use the getAllVMDKFile action to get a list of VMDKs on the datastore, but I can't seem to find a scalable way to determine if that VMDK file is in use / attached to an existing VM. I know I can query all all VMs in all vCenters to get a list of datastores, but we'll have thousands of VMs and querying for that each time the workflow gets run seems extremely inefficient. Given a datastore and a VMDK filename, is there a way to determine if it is locked?
Given that I'm expecting a one-to-one VMDK-to-datastore relationship, I guess I can use the getAllVMsOfDatastore? Just seems odd I can't tell if a particular VMDK is locked...