VMware {code} Community
mooncake51
Contributor
Contributor

VMware REST API - Committed storage

Hello,

I use this methode that I found in this discussion to get the committed storage. 

But now my dev team ask me a way to get this information in REST API.

On the VMware dev doc (https://developer.vmware.com/apis/vsphere-automation/latest/vcenter/vm/) I found the hard disk and the information about the guest disk, but nothing about the committed storage.

Is there a way to have it in REST API ?
Thanks in advance.

Best regards.

Reply
0 Kudos
1 Reply
doskiran
Enthusiast
Enthusiast

As per my understanding, All Rest APIs related to VM are not available in current vSphere releases, we might expect them in the next vSphere major releases.
 
For now to get this VM committed storage use vSphere Management SDK (SOAP based):
 
VM committed storage(VirtualMachineStorageSummary ) - Total storage space, in bytes, committed to this virtual machine across all data stores. Essentially an aggregate of the property committed across all data stores that this virtual machine is located on. 
 
Here is the sample code to get the VM committed storage using VIJava API: 

 

ServiceInstance si = new ServiceInstance(new URL("https://" + vcIPaddress + "/sdk"), userName, password, true);
VirtualMachine vm = (VirtualMachine) new InventoryNavigator(si.getRootFolder())
.searchManagedEntity("VirtualMachine", "<VM_Name>");
System.out.println("VM Committed storage::"+vm.getSummary().getStorage().getCommitted());
System.out.println("VM UnCommitted storage::"+vm.getSummary().getStorage().getUncommitted());

 

 

Reply
0 Kudos