Add support to get usage information in limits API

Registered by Rohit Karajgi

Cinder maintains current quota usages of each tenant in quota_usages db table. There is logic to calculate "gigabytes" used for both volumes and snapshots,
and the quotas api in cinder gives information of current usages for a particular tenant.
But, this api is implemented as a cinder extension and there is a possibility that a service provider may not deploy this extension in their environment. In that case horizon will fail to show the usages, which was why horizon replaced quota apis with limit apis across all screens (in bug https://bugs.launchpad.net/horizon/+bug/1178694).

One way to tackle this problem is to enhance the limits API to include usage information in the response, as follows:

A)

{
    "limits": {
        "rate": [],
        "absolute": {
            "maxTotalVolumeGigabytes": 1000,
            "maxTotalVolumes": 10,
            "totalGigabytes" : 50,
            "totalSnapshots": 6,
            "totalVolumes": 3
          }
    }
}

or

B)
{
    "limits": {
        "rate": [],
        "absolute": {
            "maxTotalVolumeGigabytes": 1000,
            "maxTotalVolumes": 10
        },
        "usages" : {
            "totalGigabytes" : 50,
            "totalSnapshots": 6,
            "totalVolumes": 3
       }
    }
}

option A) ensures consistency across openstack services while option B) seems ideal to separate out absolute and usage
figures.

Blueprint information

Status:
Complete
Approver:
John Griffith
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
Tushar Patil
Definition:
Obsolete
Series goal:
None
Implementation:
Started
Milestone target:
None
Started by
Rohit Karajgi
Completed by
Sean McGinnis

Related branches

Sprints

Whiteboard

(smcginnis): Marking obsolete as this has been sitting out there for a long time. If this is still needed, please submit a new bp.

(b) doesn't differentiate between rate and quota limit usages, which it probably should -- DuncanT

-------------------------------------------------------------------
Option A (modified as below) looks appropriate:

A)

{
    "limits": {
        "rate": [],
        "absolute": {
            "maxTotalVolumeGigabytes": 1000,
            "maxTotalVolumes": 10,
            "totalGigabytesUsed" : 50,
            "totalSnapshotsUsed": 6,
            "totalVolumesUsed": 3
          }
    }
}

-- Rohit Karajgi
----------------------------------------------------------------

Or Option B can be modified to something like:

B)
{
    "limits": {
        "rate": {},
        "absolute": {
            "maxTotalVolumeGigabytes": 1000,
            "maxTotalVolumes": 10
        },
        "absolute usages" : {
            "totalGigabytes" : 50,
            "totalSnapshots": 6,
            "totalVolumes": 3
       }
       "rate usages" {},
    }
}

I've no strong preference -- DuncanT

By testing the newest version of cinder, this bp has been implemented by solution A.
Please mark it as implemented or obsoleted so as to not confuse cinder folkers.
---- ling-yun 2014-09-15

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.