Main menu

Post navigation

Quota Management in Openstack

[Note: This blog post was originally published on the XiFi blog here.]

One of the main jobs performed by the Infrastructures in XiFi is to manage quotas: the resources available are not infinite and consequently resource management is necessary. In Openstack this is done through quotas. Here we discuss how we work with them in Openstack.

The main modus operandi of the Infrastructures is via command line – the attractive browser based tools developed within XiFi are primarily for the end users: the Infrastuctures typically spend their time in the trenches working with command line tools. Hence, quota management is done via command line tools.

Quotas naturally arise in many areas within Openstack; indeed, each of the major components has its own quotas and quota management. For example, Nova has its own quotas, Neutron has its own quotas, Cinder has its own quotas etc. Further, as each of these projects has evolved separately, the quota management mechanisms have slightly different syntax and worse, there is some overlap between the quotas in some cases which can lead to confusion: for example, Nova quotas contain floating IPs (for the older Nova network solution) as does Neutron.

In XiFi, the main resources we deal with are instances, cores, RAM and floating IPs. Also, most of the nodes have Neutron deployed. In this context, then, the quota management can be done simply using the following Nova and Neutron commands:

Being dynamic administrators who strongly embrace the DevOps approach, we decided to write some basic scripts to support modification of quotas (this was emphatically not because we could not remember the syntax of the above commands!).

This proved less trivial than we thought as the documentation for the python libraries for quota management in Openstack is limited at best. Here we highlight some of the points relating to using quotas programmatically in Openstack.

Quotas are managed through the Nova and Neutron clients. Consequently, these must be initialized using the standard approaches.

Nova and Neutron have slightly different mechanisms to support update of quotas. In Nova, named parameters are passed to the update() function, such that the names match exactly the names in the quota. In Neutron, a dict is passed similar to the dict which is returned from the show_quotas() function. Here is how it looks: