Quota calculation connects to all available cells

Bug #1771810 reported by Belmiro Moreira on 2018-05-17
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Surya Seetharaman

Bug Description

Quota utilisation calculation connects to all cells DBs to get all consumed resources for a project.
When having several cells this can be inefficient and can fail if one of the cell DBs is not available.

To calculate the quota utilization of a project should be enough to use only the cells where the project has/had instances. This information is available in nova_api DB.

Changed in nova:
assignee: nobody → Surya Seetharaman (tssurya)
Matt Riedemann (mriedem) wrote :

This seems like either something that should be a part of https://blueprints.launchpad.net/nova/+spec/handling-down-cell or https://blueprints.launchpad.net/nova/+spec/count-quota-usage-from-placement.

Even if we pre-determined which cells the project has instances in, if any of those cells are down then we're still not getting an accurate usage count if we're using the cell database. To pre-determine which cells a project has instances in, I think we could do that via the instance_mappings records in the nova_api database, maybe similar to how listing instances was modified with this change:


The instance_mappings table doesn't have a user_id column so any quota we would need to count that involves a user_id would not work here though. This bug isn't specific about which quota is being calculated and when (server create or just when hitting the limits API?).

melanie witt (melwitt) wrote :

Agreed that this enhancement will be either part of handling a down cell or moving to count quota usage from placement.

On the latter, we're currently blocked from moving to counting usage from placement because placement has no way to differentiate resource ownership among many potential services. So, calling the placement /usages API will return resource usage for all services that have added allocations to placement, not only a particular instance of nova.

Like Matt said, the best we could do at present is leverage the instance_mappings table to filter which cells we count for quota usage, like we do for instance list.

Looking at the nova/quota.py code, I see that we should also do the same for server group members. We have to count them by user and we don't have 'user_id' in the instance_mappings table, but we could at least filter on the project_id for choosing which cells to query.

Changed in nova:
importance: Undecided → Low
status: New → Confirmed
Matt Riedemann (mriedem) wrote :

Looks like Surya has started something for this here:


Changed in nova:
status: Confirmed → In Progress
Matt Riedemann (mriedem) on 2018-11-08
Changed in nova:
importance: Low → Medium
Changed in nova:
assignee: Surya Seetharaman (tssurya) → Matt Riedemann (mriedem)
Matt Riedemann (mriedem) on 2018-11-08
Changed in nova:
assignee: Matt Riedemann (mriedem) → Surya Seetharaman (tssurya)
Changed in nova:
assignee: Surya Seetharaman (tssurya) → Matt Riedemann (mriedem)
Matt Riedemann (mriedem) on 2018-11-13
Changed in nova:
assignee: Matt Riedemann (mriedem) → Surya Seetharaman (tssurya)

Reviewed: https://review.openstack.org/569055
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=77881659251bdff52163ba1572e13a105eadaf7f
Submitter: Zuul
Branch: master

commit 77881659251bdff52163ba1572e13a105eadaf7f
Author: Surya Seetharaman <email address hidden>
Date: Thu May 17 10:16:56 2018 +0200

    Make _instances_cores_ram_count() be smart about cells

    This makes the _instances_cores_ram_count() method only query for instances
    in cells that the tenant actually has instances landed in. We do this by
    getting a list of cell mappings that have instance mappings owned by the
    project and limiting the scatter/gather operation to just those cells.

    Change-Id: I0e2a9b2460145d3aee92f7fddc4f4da16af63ff8
    Closes-Bug: #1771810

Changed in nova:
status: In Progress → Fix Released

This issue was fixed in the openstack/nova release candidate.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related blueprints