VMware Cloud Community
Barre81
Contributor
Contributor

getting SCSI ID from VRA API

Hi there,

I'm looking to automate expanding a disk trough the API, mostly for Ubuntu servers.

For this, I have to identify which disk to expand by mapping sdb to the right disk by comparing SCSI ID's

On Ubuntu, I can fetch the SCSI id trough the command ls -d /sys/block/sd*/device/scsi_device/* |awk -F '[/]' '{print $4,"- SCSI",$7}'

which results in (for example)

sda - SCSI 2:0:0:0

sdb - SCSI 2:0:1:0

sdc - SCSI 2:0:2:0

But for the life of me, I cannot seem to get the SCSI ID from the VRA API.

However, I do see it on the UI (machine-id)

vra.png

using the endpoint {{vraurl}}/catalog-service/api/consumer/resources/740d901a-c796-40d8-bc7c-9ef9eff4dbc7 doesn't show it.

Can anyone give me a few tips how to fetch this data?

thanks a lot

regards

Bart

0 Kudos
5 Replies
eoinbyrne
Expert
Expert

If you can get the Custom Properties of the VM you should find the SCSI ID under

VirtualMachine.Disk<N>.DeviceID

0 Kudos
Barre81
Contributor
Contributor

How would I go about getting the custom properties of a vm trough the API?

When i use the endpoint  {{vraurl}}/catalog-service/api/consumer/resources/740d901a-c796-40d8-bc7c-9ef9eff4dbc7

I do get custom properties, but it doesn't contain the VirtualMachine.Disk

json1.png

json2.png

json3.png

0 Kudos
Alex_Romeo
Leadership
Leadership

HI,

Get-VM | Get-HardDisk |

Select @{N='VM';E={$_.Parent.Name}},Name,@{N='SCSIid';E={$_.ExtensionData.UnitNumber}}

VMware PowerCLI Forum - VMware {code}

Best Regards,

Alessandro ROmeo

Blog: https://www.aleadmin.it/
0 Kudos
eoinbyrne
Expert
Expert

Hmmm - the property I referenced is an IaaS level property which the API seems to either not expose or just ignores....

I took a look and even tried this

consumer/resources/<resource-id>?withExtendedData=true

but you sitll don't get the low-level IaaS properties for the disks etc

The only other option I can think of would be to use the vRA API to get the Resource details and then use the another API / mechanism to get the the VM hardware data

- PowerCLI calls as AlessandroRomeo68​ suggested

- VM external ID with the vCenter API to get the VM hardware info

- vRO Workflow call via API to access the IaaS sub-system and get the SCSI ID

0 Kudos
Barre81
Contributor
Contributor

Thanks for your responses guys!

I'm gonna try and fetch it trough powershell.

Another option i'm considering is using the VMware api and expanding the disk from there, instead of VRA. (but less desirable)

0 Kudos