I have an iSCSI target that has been formatted and partitioned to create a volume. I want to be able to map the LUN of iSCSI target to the volume UUID. esxcfig-vmhbadev -m does this directly...
See more...
I have an iSCSI target that has been formatted and partitioned to create a volume. I want to be able to map the LUN of iSCSI target to the volume UUID. esxcfig-vmhbadev -m does this directly, for example in the bottom line LUN 207 maps to the UUID 4ac128de-d4b8f7c3-a4a5-001ec9ab7607. vmhba0:1:0:1 /dev/sdb1 47a3995d-bf8312ea-aa8a-0019b9f36fbf vmhba0:0:0:3 /dev/sda3 479f6ab3-636688b2-277b-0019b9f36fc1 vmhba1:4:200:1 /dev/sdc1 4ac127e9-81fb1fcf-1138-001ec9ab7607 vmhba1:15:207:1 /dev/sdd1 4ac128de-d4b8f7c3-a4a5-001ec9ab7607 How do I do this using the Perl API? I can get two halfs of the information, but I can't see how to map them. This code snippet gives me information about the LUN, and the SCSI UUID print " Canonical Name, UUID\n"; my $scsiLUN = $storageSystem->storageDeviceInfo->scsiLun; foreach (@$scsiLUN) { print " ". $_->canonicalName . ", " . $_->uuid . "\n"; } Canonical Name, UUID vmhba1:15:207, 0100cf000020202020564952545541 vmhba0:1:0, 020000000050014ee0004544c3574443205744 vmhba0:0:0, 020000000050014ee0004544d2574443205744 vmhba1:4:200, 0100c8000020202020564952545541 Then this snippet give me information about the volume: my $mountInfo = $storageSystem->fileSystemVolumeInfo->mountInfo; print " Volume Name, Path, Type, Capacity\n"; foreach (@$mountInfo) { print " ". $_->volume->name . ", " . $_->mountInfo->path . ", " . $_->volume->type . ", " . $_->volume->capacity . "\n"; } Volume Name, Path, Type, Capacity esx7_local_storage2, /vmfs/volumes/47a3995d-bf8312ea-aa8a-0019b9f36fbf, VMFS, 79725330432 esx7_local_storage1, /vmfs/volumes/479f6ab3-636688b2-277b-0019b9f36fc1, VMFS, 71672266752 vol_2_1, /vmfs/volumes/4ac127e9-81fb1fcf-1138-001ec9ab7607, VMFS, 805306368 snap-0e22598d-vol_2_1, /vmfs/volumes/4ac128de-d4b8f7c3-a4a5-001ec9ab7607, VMFS, 805306368 But then how do I map vmhba1:15:207 to /vmfs/volumes/4ac128de-d4b8f7c3-a4a5-001ec9ab7607? Thanks