When I present a LUN to an ESX host, it is seen on 2 different SCSI targets, due to the dual controller ports in our SAN. As far as I can tell, ESX assigns one as the primary and sets this as the canonicalname. If I try to map the LUN to a guest, using the new-harddisk cmdlet, I need to know this canonical name. Problem is, I can't work out how to find what the canonical name is for a particular LUN.
The only possible solution I've come up with so far is to check for the existence of the LUN using all both possible canonical names and then mapping on the correct one. Does anyone know if it is possible to find out the correct canonical name from just the LUN?
Thanks