Solved

How to get VM to Storage Container relation using REST APIs?

  • 3 September 2019
  • 2 replies
  • 2293 views

Dear Friends,
I am trying to find out VMs to Storage Container relations using Nutanix REST APIs but not able to get. I have tried both V2.0 and V3 APIs.
In 'vms/list' v3 API, we do get "disk_list" for each VM but I do not see these vDisks in 'vdisk' or virtual_disks APIs (v2).
Also there is no reference to Storage_Containers in 'vms/list' output so it is difficult for me to find the correlation.

Please help.
icon

Best answer by conradcorbett 4 September 2019, 03:20

View original

This topic has been closed for comments

2 replies

Thanks conradcorbett, this solved my problem.
Badge
With v2 API, in your request for /vms/, include_vm_disk_config=true. For example: https://PRISM_IP:9440/PrismGateway/services/rest/v2.0/vms/?include_vm_disk_config=true

This will return vm_disk_info with storage_container_uuid for each VM.

I think an alternative would be to do a GET /virtual_disks/. This will list all of the virtual disks on the cluster and provides the attached_vmname and storage_container_uuid for each virtual disk.