rindr
Contributor
Contributor

Pair up SCSI Bus sharing mode value with each virtual disk name

Hi,

There's a virtual cluster on ESXi-cluster. It has 4 shared disks. There are 2 VMs sharing 4 disks on the virtual cluster. There are 2 SCSI controllers on each VM. 1st controller on each VM has a local vistual disk connected with OS installed. 2nd controller on each VM is for virtual clustering and has 4 shared disks.

I can easily get SCSI bus mode info like this:

Get-VM VM1 | Get-ScsiController | %{$_.BusSharingMode}

NoSharing

Virtual


or this way

Get-VM VM1 | Get-ScsiController | %{$_.Extensiondata.SharedBus}

noSharing

virtualSharing

I can get virrtual disks names this way for 1st cluster node:

Get-VM VM1 | Get-HardDisk | %{$_.FileName}

[STORAGE01] VM1/VM1.vmdk

[STORAGE02] ClusterName/SharedDisk1.vmdk

[STORAGE02] ClusterName/SharedDisk2.vmdk

[STORAGE02] ClusterName/SharedDisk3.vmdk

[STORAGE02] ClusterName/SharedDisk4.vmdk

and this way for the 2nd one:

Get-VM VM2 | Get-HardDisk | %{$_.FileName}

[STORAGE01] VM2/VM2.vmdk

[STORAGE02] ClusterName/SharedDisk1.vmdk

[STORAGE02] ClusterName/SharedDisk2.vmdk

[STORAGE02] ClusterName/SharedDisk3.vmdk

[STORAGE02] ClusterName/SharedDisk4.vmdk

With a little bit of regex I can get pure vmdk-filenames stored in array (here for the 1st node):

VM1.vmdk

SharedDisk1.vmdk

SharedDisk2.vmdk

SharedDisk3.vmdk

SharedDisk4.vmdk

So there are 2 buses and 5 disks on each VM. Is it possible to pair up or match this info for the virtual disk name and its corresponding SCSI Bus sharing mode value in one liner so I can get an array of 5 elements for each VM like this:

NoSharing

Virtual

Virtual

Virtual

Virtual

or in ExtensionData format like this:

noSharing

virtualSharing

virtualSharing

virtualSharing

virtualSharing

Thank you in advance,

rindr

0 Kudos
1 Reply
rindr
Contributor
Contributor

Alright. It looks like there's no one liner option so I had to come with a scripting alternative.

0 Kudos