From: liyingjun Date: Thu, 20 Feb 2014 18:58:58 +0000 (+0800) Subject: Add snapshot related data to limits api X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c9c6befe7e19adc168aefe1cfaeac8d68dd398fa;p=openstack-build%2Fcinder-build.git Add snapshot related data to limits api 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 --- diff --git a/cinder/api/contrib/used_limits.py b/cinder/api/contrib/used_limits.py index a36ceb944..bfcb88f0b 100644 --- a/cinder/api/contrib/used_limits.py +++ b/cinder/api/contrib/used_limits.py @@ -34,6 +34,7 @@ class UsedLimitsController(wsgi.Controller): quota_map = { 'totalVolumesUsed': 'volumes', 'totalGigabytesUsed': 'gigabytes', + 'totalSnapshotsUsed': 'snapshots', } used_limits = {} diff --git a/cinder/api/views/limits.py b/cinder/api/views/limits.py index 528ca417d..880c51389 100644 --- a/cinder/api/views/limits.py +++ b/cinder/api/views/limits.py @@ -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"], diff --git a/cinder/tests/api/contrib/test_used_limits.py b/cinder/tests/api/contrib/test_used_limits.py index d102253e8..4511cc83a 100644 --- a/cinder/tests/api/contrib/test_used_limits.py +++ b/cinder/tests/api/contrib/test_used_limits.py @@ -45,6 +45,7 @@ class UsedLimitsTestCase(test.TestCase): quota_map = { 'totalVolumesUsed': 'volumes', 'totalGigabytesUsed': 'gigabytes', + 'totalSnapshotsUsed': 'snapshots', } limits = {}