简体   繁体   中英

Openstack API for querying whether enough resources available to instantiate an image

I was looking through the API documentation of openstack for an API using which i can check if openstack has enough resources to instantiate an image. Quite frankly the API guide is quite overwhelming. Just wanted to know if anyone has come across any such documentation which could help me out of this pickle. Alternative pointers are also appreciated.

Thank you

Edit: Based on Albert V's response i tried the following:

curl -s -H "X-Auth-Token: $OS_AUTH_TOKEN" http://localhost:8774/v2/a6bc799ca8544b3f9a6698397fac92f7/os-quota-sets/c32f25d98f974c5a89e7c19cb7292da5/detail

But the ouput i am getting seems to be wrong, because the current usage is wrong and limits are also wrong:

{"quota_set": {"injected_file_content_bytes": {"reserved": 0, "limit": 10240, "in_use": 0}, "metadata_items": {"reserved": 0, "limit": 128, "in_use": 0}, "server_group_members": {"reserved": 0, "limit": 10, "in_use": 0}, "server_groups": {"reserved": 0, "limit": 10, "in_use": 0}, "ram": {"reserved": 0, "limit": 51200, "in_use": 0}, "floating_ips": {"reserved": 0, "limit": 23, "in_use": 0}, "key_pairs": {"reserved": 0, "limit": 100, "in_use": 0}, "id": "db3cceb48ecb4f028cbd7ec48e1e7fb0", "instances": {"reserved": 0, "limit": 10, "in_use": 0}, "security_group_rules": {"reserved": 0, "limit": 20, "in_use": 0}, "injected_files": {"reserved": 0, "limit": 5, "in_use": 0}, "cores": {"reserved": 0, "limit": 20, "in_use": 0}, "fixed_ips": {"reserved": 0, "limit": -1, "in_use": 0}, "injected_file_path_bytes": {"reserved": 0, "limit": 255, "in_use": 0}, "security_groups": {"reserved": 0, "limit": 10, "in_use": 0}}}

Below is a screenshot from the openstack dashboard regardin machine limits and usage summary: Openstack Limit Summary from Dashboard

Until recently, OpenStack had to calculate the usage manually. Now it offers the "absolute limits" to retrieve the usage easily.

Please find both the CLI and API methods in these links:

https://docs.openstack.org/admin-guide/cli-set-compute-quotas.html

https://developer.openstack.org/api-ref/compute/?expanded=show-rate-and-absolute-limits-detail

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM