On 11/09/2025 08:42, Thamanna Farhath wrote:
Hi All,
I noticed a mismatch between hypervisor data shown in Horizon and via the OpenStack API. The API returns original values without calculating the overcommit ratio.
Could you advise how to retrieve the *effective resources including overcommit ratio* via the API?
if you look at the resocues reported in the placement api the capacity and allocation ratios are part of the inventory. GET /resource_providers/{uuid}/inventories https://docs.openstack.org/api-ref/placement/#id33 ``` <https://docs.openstack.org/api-ref/placement/#id33> { "inventories":{ "DISK_GB":{ "allocation_ratio":1.0, "max_unit":35, "min_unit":1, "reserved":0, "step_size":1, "total":35 }, "MEMORY_MB":{ "allocation_ratio":1.5, "max_unit":5825, "min_unit":1, "reserved":512, "step_size":1, "total":5825 }, "VCPU":{ "allocation_ratio":16.0, "max_unit":4, "min_unit":1, "reserved":0, "step_size":1, "total":4 } }, "resource_provider_generation":7 } ``` nova hypervisor api has never provide the allocation ration information https://docs.openstack.org/api-ref/compute/#list-hypervisors-details so using placement for this is the preferred way to look at the total capacity via the inventory API and the current usage of a resource provider GET /resource_providers/{uuid}/usages https://docs.openstack.org/api-ref/placement/#id82 the uuid in both cases is the compute node uuid which is the same as the hypervisors API uuid the name of the resource provider is the hypervisor_hostname of the compute node. technically the compute node resource provider can have a tree of child providers for additional device like gpus or pci devices so there is a lot more information available in placement then the older hypervisors api. you just need compute the remaining capstiy by taking the inventories multiply by the allocation ratio(normally 1.0) subtract any reserved space (normally 0) and subtracting the usage. that is a little more work then you might like to do but i believe this is what horizon is doing behind the scenes. this over all process is partly described here https://specs.openstack.org/openstack/nova-specs/specs/wallaby/implemented/m...
Thanks,
Thamanna Farhath N
------------------------------------------------------------------------ *Disclaimer :*/ The content of this email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error, please notify the sender and remove the messages from your system. If you are not the named addressee, it is strictly forbidden for you to share, circulate, distribute or copy any part of this e-mail to any third party without the written consent of the sender.// /
/// /
/E-mail transmission cannot be guaranteed to be secured or error free as information could be intercepted, corrupted, lost, destroyed, arrive late, incomplete, or may contain viruses. Therefore, we do not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email."// /