Quotas management is broken

Bug #1023311 reported by Sergii
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
High
John Griffith

Bug Description

There several issues with quota management noticed during using Cinder with Folsom2 release.

1. Any changes to quotas made by nova quota-update modify only 'quota' table in nova DB. This causes cinder to ignore any changes in volume quotas.

2. After looking to cinder/quota.py and to cinder DB i see that getting the quotas is broken even if there is something in cinder DB. It takes default quotas as a dictionary and then update it from the database, but field names in database and default dictionary don't match. See code below.
def _get_default_quotas():
    defaults = {
        'instances': FLAGS.quota_instances,
        'cores': FLAGS.quota_cores,
        'ram': FLAGS.quota_ram,
        'volumes': FLAGS.quota_volumes,
        'gigabytes': FLAGS.quota_gigabytes,
        'floating_ips': FLAGS.quota_floating_ips,
        'metadata_items': FLAGS.quota_metadata_items,
        'injected_files': FLAGS.quota_injected_files,
        'injected_file_content_bytes':
            FLAGS.quota_injected_file_content_bytes,
        'security_groups': FLAGS.quota_security_groups,
        'security_group_rules': FLAGS.quota_security_group_rules,
    }
    # -1 in the quota flags means unlimited
    return defaults

def get_project_quotas(context, project_id):
    defaults = _get_default_quotas()
    if context.quota_class:
        get_class_quotas(context, context.quota_class, defaults)
    quota = db.quota_get_all_by_project(context, project_id)
    for key in defaults.keys():
        if key in quota:
            defaults[key] = quota[key]
    return defaults

class Quota(BASE, CinderBase):
    """Represents a single quota override for a project.

    If there is no row for a given project id and resource, then the
    default for the quota class is used. If there is no row for a
    given quota class and resource, then the default for the
    deployment is used. If the row is present but the hard limit is
    Null, then the resource is unlimited.
    """

    __tablename__ = 'quotas'
    id = Column(Integer, primary_key=True)

    project_id = Column(String(255), index=True)

    resource = Column(String(255))
    hard_limit = Column(Integer, nullable=True)

Tags: cinder quota
Changed in cinder:
importance: Undecided → High
milestone: none → folsom-3
Changed in cinder:
assignee: nobody → John Griffith (john-griffith)
status: New → Triaged
Thierry Carrez (ttx)
Changed in cinder:
milestone: folsom-3 → folsom-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/11510

Changed in cinder:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/11510
Committed: http://github.com/openstack/cinder/commit/a3af3f87f5ca95e9b400dc15e7593746d01bc43a
Submitter: Jenkins
Branch: master

commit a3af3f87f5ca95e9b400dc15e7593746d01bc43a
Author: John Griffith <email address hidden>
Date: Thu Aug 16 15:52:52 2012 -0600

    Implement volume quota support in Cinder

    parital fix for bug 1023311
      * To use needs cinderclient https://review.openstack.org/#/c/11509/
      * Updates quota classes with changes in Nova
      * Adds needed quota related DB tables
      * Updates test_quota to reflect changes in Nova
      * Adds absolute limits and empty rate limit functions
      * Updates test/integration/test_volume to make it work w/ above changes

    Change-Id: I221c7a9dc51a2bb9bf7228c056f63ba9546cf5f9

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: folsom-rc1 → 2012.2
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.