nova should use quota_details neutron api to validate available ports before VM creation

Bug #2027156 reported by Ihar Hrachyshka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
New
Undecided
Unassigned

Bug Description

Originally reported at https://bugzilla.redhat.com/show_bug.cgi?id=2222102

--

When nova creates a VM, it issues a request to fetch all ports for the project, which may take a significant time and even time out.

The code in https://github.com/openstack/nova/blob/master/nova/network/neutron.py#L2654 suggests that nova fetches IDs of all project ports just to count the number of ports in db and compare it to quota (to pre-validate that there's enough free ports to allocate for the request).

Instead of fetching all IDs via get_ports, nova should attempt to use quota_details API that gives ready access to info on available ports:

https://docs.openstack.org/api-ref/network/v2/?expanded=list-quotas-for-projects-with-non-default-quota-values-detail,show-quota-details-for-a-tenant-detail#quotas-details-extension-quota-details

Note that this is an API extension and was added later than the original `quota` API, so it may be that special care should be taken to accommodate to neutron-servers with no such extension.

Also, the extension seems to be controlled by the cfg.CONF.QUOTAS.quota_driver
 config option: https://github.com/openstack/neutron/blob/6fa9142ced0eed8de9a89042747438b93de7202d/neutron/extensions/quotasv2_detail.py#L37

Which means that there may be an (upstream) configuration that would end up with quota_details API missing. So a fallback mechanism may be due.

Side note: it may be argued that neutron should not expose this config option in the first place. This bz doesn't attempt to address this request.

Tags: neutron
tags: added: neutron
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.