Hello
I am new to vSphere PowerCLI (just over a month of dabbling), and I'm building up a script that we can use to perform various operations.
My current hurdle is how to find out what LUN a datastore is on. The vSphere Client shows this data with apparent ease.
I can obviously get info for a datastore:
$objDataStore = get-datastore -name "PLOEVA01_VMFS_001"
$objDataStore | Format-List
FreeSpaceMB : 467655
CapacityMB : 511744
Accessible : True
Type : VMFS
Id : Datastore-datastore-113
Name : PLOEVA01_VMFS_001
...and I can then get a .NET view, and delve a bit deeper:
$objDataStoreView = Get-View -id $objDataStore.id
$objDataStoreView
Info : VMware.Vim.VmfsDatastoreInfo
Summary : VMware.Vim.DatastoreSummary
Host : {VMware.Vim.ManagedObjectReference, VMware.Vim.ManagedObjectReference}
Vm : {VMware.Vim.ManagedObjectReference, VMware.Vim.ManagedObjectReference, VMware.Vim.ManagedObjectRe
ference, VMware.Vim.ManagedObjectReference}
Browser : VMware.Vim.ManagedObjectReference
Capability : VMware.Vim.DatastoreCapability
Parent : VMware.Vim.ManagedObjectReference
CustomValue : {}
OverallStatus : green
ConfigStatus : gray
ConfigIssue : {}
EffectiveRole : {-1, 5}
Permission : {}
Name : PLOEVA01_VMFS_001
DisabledMethod : {}
RecentTask : {}
DeclaredAlarmState : {alarm-9.datastore-113}
TriggeredAlarmState : {}
AlarmActionsEnabled : True
Tag : {}
Value : {}
AvailableField : {}
MoRef : VMware.Vim.ManagedObjectReference
Client : VMware.Vim.VimClient
...the Info and Summary properties give some additional info:
$objDataStoreView.info
Vmfs : VMware.Vim.HostVmfsVolume
Name : PLOEVA01_VMFS_001
Url : sanfs://vmfs_uuid:4a6daf9a-fde9d1f2-ee8b-001b784495e2/
FreeSpace : 490371809280
MaxFileSize : 274877906944
Timestamp : 03/11/2009 14:18:46
DynamicType :
DynamicProperty :
$objDataStoreView.summary
Datastore : VMware.Vim.ManagedObjectReference
Name : PLOEVA01_VMFS_001
Url : sanfs://vmfs_uuid:4a6daf9a-fde9d1f2-ee8b-001b784495e2/
Capacity : 536602476544
FreeSpace : 490371809280
Uncommitted : 8694775296
Accessible : True
MultipleHostAccess : True
Type : VMFS
DynamicType :
DynamicProperty :
...but I just cannot find a correlation between this and a LUN. In desperation, I knocked up a routine (below) which enumerates the fibre HBAs in a given host, enumerates the visible LUNs, then the paths, picks the active paths and reports any paths that lead to a fibre disk. The last step would be to list the datastores on this disk. But how?
Any thoughts... anyone?
Thank you
Simon Catlin
-
MY FUNCTION FOR ENUMERATING A HOST'S STORAGE:
<See EXAMPLE_CODE.TXT attachment>
EXAMPLE OUTPUT:
<See EXAMPLE_OUTPUT.txt attachment>