]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add snapshot related data to limits api
authorliyingjun <liyingjun1988@gmail.com>
Thu, 20 Feb 2014 18:58:58 +0000 (02:58 +0800)
committerliyingjun <liyingjun1988@gmail.com>
Mon, 24 Feb 2014 08:07:19 +0000 (16:07 +0800)
When calling the limits api we can only get Volume and Gigabyte data,
the snapshot related limit value should be returned too.

Change-Id: I6a5e1e2d1aa6abbac5d5dacd042223ce49207c1f
Closes-bug: 1282924

cinder/api/contrib/used_limits.py
cinder/api/views/limits.py
cinder/tests/api/contrib/test_used_limits.py

index a36ceb9447b151eefba9b1d634a501703511c67a..bfcb88f0b95c650d0d003d857c955280b5ab481c 100644 (file)
@@ -34,6 +34,7 @@ class UsedLimitsController(wsgi.Controller):
         quota_map = {
             'totalVolumesUsed': 'volumes',
             'totalGigabytesUsed': 'gigabytes',
+            'totalSnapshotsUsed': 'snapshots',
         }
 
         used_limits = {}
index 528ca417dd7382bd047dfb8972a88c6813548cf2..880c51389fc8560c8aca5352995f29146781e15e 100644 (file)
@@ -47,6 +47,7 @@ class ViewBuilder(object):
             "cores": ["maxTotalCores"],
             "gigabytes": ["maxTotalVolumeGigabytes"],
             "volumes": ["maxTotalVolumes"],
+            "snapshots": ["maxTotalSnapshots"],
             "key_pairs": ["maxTotalKeypairs"],
             "floating_ips": ["maxTotalFloatingIps"],
             "metadata_items": ["maxServerMeta", "maxImageMeta"],
index d102253e8fd8da0986554979b45dde84fa8eb47e..4511cc83af11950892479e104fd347f1c2040144 100644 (file)
@@ -45,6 +45,7 @@ class UsedLimitsTestCase(test.TestCase):
         quota_map = {
             'totalVolumesUsed': 'volumes',
             'totalGigabytesUsed': 'gigabytes',
+            'totalSnapshotsUsed': 'snapshots',
         }
 
         limits = {}