As part of a SAN maintenance task that was being performed I wanted to obtain the virtual machines where the hard disks were hosted on those affected datastores, this was a non-disruptive task so there was no requirement to perform Storage vMotion.
Again, the method to retrieve this information was vSphere PowerCLI and no longer than 30 seconds to compile and invoke. The naming convention of the datastores allows for the SAN to be distinguished therefore by retrieving a list of virtual machines and filtering by datastore using a wildcard this was easily achieved:
In my example, I am using the below datastore name naming convention where the affected SAN would be named SAN1 (obviously in the real world by naming conventions are far more imaginative!) :
SAN1-LUN1
SAN1-LUN2
SAN1-LUN3
SAN2-LUN1
SAN2-LUN2
SAN2-LUN3
Get-VM -Datastore SAN1* | fl Name
This would ensure that only VMs where hard disks on the below datastores would be returned:
SAN1-LUN1
SAN1-LUN2
SAN1-LUN3