VMware {code} Community
rampang
Contributor
Contributor

How to find the scsi controller number for virtual disks created for a VM?

In the VI Client, for virtual disk "Hard Disk 3", Virtual device node appears as "SCSI (1:2) HardDisk 3" .

How to get this information especially the second part of "SCSI (1:2)" from the SDK?

Thanks

0 Kudos
1 Reply
akutz
Hot Shot
Hot Shot

You enumerate the hardware devices for the VM and look for the hard disks and print out their info. Here is example out using a modified vminfo.pl from VI Perl after inserting the Dumper command:

bless( {

'sharedBus' => bless( {

'val' => 'noSharing'

}, 'VirtualSCSISharing' ),

'device' => [

'2000',

'2001'

],

'key' => '1000',

'hotAddRemove' => '1',

'scsiCtlrUnitNumber' => '7',

'deviceInfo' => bless( {

'summary' => 'LSI Logic',

'label' => 'SCSI Controller 0'

}, 'Description' ),

'unitNumber' => '3',

'controllerKey' => '100',

'busNumber' => '0'

}, 'VirtualLsiLogicController' ),

bless( {

'shares' => bless( {

'shares' => '1000',

'level' => bless( {

'val' => 'normal'

}, 'SharesLevel' )

}, 'SharesInfo' ),

'capacityInKB' => '4194304',

'backing' => bless( {

'writeThrough' => '0',

'thinProvisioned' => '0',

'datastore' => bless( {

'value' => 'datastore-18',

'type' => 'Datastore'

}, 'ManagedObjectReference' ),

'fileName' => '[storage-san-vms00] purple.lostcreations.local/purple.lostcreations.local.vmdk',

'uuid' => '6000C292-bce7-cfa5-c3bd-31190e40f327',

'split' => '0',

'diskMode' => 'persistent'

}, 'VirtualDiskFlatVer2BackingInfo' ),

'unitNumber' => '0',

'deviceInfo' => bless( {

'summary' => '4,194,304 KB',

'label' => 'Hard Disk 1'

}, 'Description' ),

'controllerKey' => '1000',

'key' => '2000'

}, 'VirtualDisk' ),

bless( {

'shares' => bless( {

'shares' => '1000',

'level' => bless( {

'val' => 'normal'

}, 'SharesLevel' )

}, 'SharesInfo' ),

'capacityInKB' => '4194304',

'backing' => bless( {

'writeThrough' => '0',

'thinProvisioned' => '0',

'datastore' => bless( {

'value' => 'datastore-18',

'type' => 'Datastore'

}, 'ManagedObjectReference' ),

'fileName' => '[storage-san-vms00] purple.lostcreations.local/purple.lostcreations.local_1.vmdk',

'uuid' => '6000C29a-d016-d53c-6146-4d5d86de45e0',

'split' => '0',

'diskMode' => 'persistent'

}, 'VirtualDiskFlatVer2BackingInfo' ),

'unitNumber' => '1',

'deviceInfo' => bless( {

'summary' => '4,194,304 KB',

'label' => 'Hard Disk 2'

}, 'Description' ),

'controllerKey' => '1000',

'key' => '2001'

}, 'VirtualDisk' )

0 Kudos