vmfsfilelockinfo : Command to know vm on which host

A script to find out the locking information about a file on VMFS datastore.

Script involves gettting host name and MAC address mapping by talking back to
Virtual Center Server using Property Collectors

vmfsfilelockinfo

Version 1.0
Please provide a valid File path
Usage: vmfsfilelockinfo -p <file path> -v <vc host name>

Options:
-h, –help show this help message and exit
-p filepath, –filepath=filepath
Path to the file on VMFS datastore
-v vcserverip, –vchostname=vcserverip
Name/IP address of the Virtual Center Server
-u username, –vcadminuser=username
Admin user name of the Virtual Center Server
-t SHA thumbprint, –thumbprint=SHA thumbprint
SHA-1 thumbprint required for Connecting to
Virtual Center Server

[root@test:/opt/vmware/fdm/fdm] vmfsfilelockinfo -p /vmfs/volumes/iscsi-DS500GB-2/test/test.vmx
vmfsfilelockinfo Version 1.0
Looking for lock owners on “test.vmx”
“testibm.vmx” is locked in Exclusive mode by host having mac address [‘d2:d3:85:aa:93:62’]
Trying to make use of Fault Domain Manager
———————————————————————-
Found 2 ESX hosts using Fault Domain Manager.
———————————————————————-
Searching on Host 10.184.216.233
Searching on Host 10.184.218.140
MAC Address : d2:d3:85:aa:93:62
Host owning the lock on the vmdk is 10.184.218.140, lockMode : Exclusive
Total time taken : 0.11 seconds.

Internally this script calls FDM command to fetch the server info. This script is located in /opt/vmware/fdm/fdm.

./prettyPrint.sh hostlist

Above script will only be available when server is part of cluster.