Ask Your Question

How to get quota usage from nova API?

asked 2013-05-14 12:21:29 -0500

scott-devoid gravatar image

How do I determine how much of a tenant's quota has been used through the nova APIs? I know about the novaclient.v1_1.client.usage module, which provides the following function:

now =
later = now + datetime.timedelta(hour=1)
usage_data =  novaclient.usage(tenant_id, now, later)

But there is an impedance mismatch between usage_data and a tenant's quota settings. usage_data["total_hours"] is approximately instance_count for a one hour window starting from now, but not exactly. total_hours is floating point where instance_count is an integer.

Also, the CLI function $ nova usage-list returns values for the last month by default (and does not support sub-day level --start and --end offsets.

How does Horizon calculate usage in the boot dialog? Should I submit a blueprint for expose that calculation over the API?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-05-14 17:41:18 -0500

jpichon gravatar image

At the moment Horizon tallies the quota usage "manually":

I think you should look into the Limits API though (nova absolute-limits), that Horizon also plans on switching to. It's more accurate than the quotas and can also include reservations.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools


Asked: 2013-05-14 12:21:29 -0500

Seen: 3,373 times

Last updated: May 14 '13