diff --git a/api-ref/source/v3/quota-classes.inc b/api-ref/source/v3/quota-classes.inc index e973010e949..038d027123b 100644 --- a/api-ref/source/v3/quota-classes.inc +++ b/api-ref/source/v3/quota-classes.inc @@ -60,7 +60,7 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/quota-classes-show-response.json +.. literalinclude:: ./samples/quota_classes/quota-classes-show-response.json :language: javascript Update quota classes for a project @@ -103,7 +103,7 @@ Request Request Example --------------- -.. literalinclude:: ./samples/quota-classes-update-request.json +.. literalinclude:: ./samples/quota_classes/quota-classes-update-request.json :language: javascript @@ -127,5 +127,5 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/quota-classes-update-response.json +.. literalinclude:: ./samples/quota_classes/quota-classes-update-response.json :language: javascript diff --git a/api-ref/source/v3/quota-sets.inc b/api-ref/source/v3/quota-sets.inc index 9a715efd084..ea721e5bbd5 100644 --- a/api-ref/source/v3/quota-sets.inc +++ b/api-ref/source/v3/quota-sets.inc @@ -55,7 +55,7 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/quotas-show-response.json +.. literalinclude:: ./samples/quota_sets/quotas-show-response.json :language: javascript @@ -106,7 +106,7 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/quotas-show-usage-response.json +.. literalinclude:: ./samples/quota_sets/quotas-show-usage-response.json :language: javascript @@ -149,7 +149,7 @@ Request Request Example --------------- -.. literalinclude:: ./samples/quotas-update-request.json +.. literalinclude:: ./samples/quota_sets/quotas-update-request.json :language: javascript @@ -173,7 +173,7 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/quotas-update-response.json +.. literalinclude:: ./samples/quota_sets/quotas-update-response.json :language: javascript Delete quotas for a project @@ -248,7 +248,7 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/quotas-show-defaults-response.json +.. literalinclude:: ./samples/quota_sets/quotas-show-defaults-response.json :language: javascript diff --git a/api-ref/source/v3/samples/quota_classes/quota-classes-show-response.json b/api-ref/source/v3/samples/quota_classes/quota-classes-show-response.json new file mode 100644 index 00000000000..dc8a22592ba --- /dev/null +++ b/api-ref/source/v3/samples/quota_classes/quota-classes-show-response.json @@ -0,0 +1,15 @@ +{ + "quota_class_set": { + "backup_gigabytes": 1000, + "backups": 10, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 10, + "id": "test_class", + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 10, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/api-ref/source/v3/samples/quota_classes/quota-classes-update-request.json b/api-ref/source/v3/samples/quota_classes/quota-classes-update-request.json new file mode 100644 index 00000000000..4c7b19ef4ea --- /dev/null +++ b/api-ref/source/v3/samples/quota_classes/quota-classes-update-request.json @@ -0,0 +1,7 @@ +{ + "quota_class_set": { + "volumes": 10, + "gigabytes": 1000, + "snapshots": 10 + } +} \ No newline at end of file diff --git a/api-ref/source/v3/samples/quota_classes/quota-classes-update-response.json b/api-ref/source/v3/samples/quota_classes/quota-classes-update-response.json new file mode 100644 index 00000000000..922a974eed7 --- /dev/null +++ b/api-ref/source/v3/samples/quota_classes/quota-classes-update-response.json @@ -0,0 +1,14 @@ +{ + "quota_class_set": { + "backup_gigabytes": 1000, + "backups": 10, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 10, + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 10, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/api-ref/source/v3/samples/quota_sets/quotas-show-defaults-response.json b/api-ref/source/v3/samples/quota_sets/quotas-show-defaults-response.json new file mode 100644 index 00000000000..8d160b21128 --- /dev/null +++ b/api-ref/source/v3/samples/quota_sets/quotas-show-defaults-response.json @@ -0,0 +1,15 @@ +{ + "quota_set": { + "backup_gigabytes": 1000, + "backups": 10, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 10, + "id": "fake_tenant", + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 10, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/api-ref/source/v3/samples/quota_sets/quotas-show-response.json b/api-ref/source/v3/samples/quota_sets/quotas-show-response.json new file mode 100644 index 00000000000..8d160b21128 --- /dev/null +++ b/api-ref/source/v3/samples/quota_sets/quotas-show-response.json @@ -0,0 +1,15 @@ +{ + "quota_set": { + "backup_gigabytes": 1000, + "backups": 10, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 10, + "id": "fake_tenant", + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 10, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/api-ref/source/v3/samples/quota_sets/quotas-show-usage-response.json b/api-ref/source/v3/samples/quota_sets/quotas-show-usage-response.json new file mode 100644 index 00000000000..7b30cb3da88 --- /dev/null +++ b/api-ref/source/v3/samples/quota_sets/quotas-show-usage-response.json @@ -0,0 +1,55 @@ +{ + "quota_set": { + "backup_gigabytes": { + "in_use": 0, + "limit": 1000, + "reserved": 0 + }, + "backups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "gigabytes": { + "in_use": 0, + "limit": 1000, + "reserved": 0 + }, + "gigabytes___DEFAULT__": { + "in_use": 0, + "limit": -1, + "reserved": 0 + }, + "groups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "id": "fake_tenant", + "per_volume_gigabytes": { + "in_use": 0, + "limit": -1, + "reserved": 0 + }, + "snapshots": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "snapshots___DEFAULT__": { + "in_use": 0, + "limit": -1, + "reserved": 0 + }, + "volumes": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "volumes___DEFAULT__": { + "in_use": 0, + "limit": -1, + "reserved": 0 + } + } +} \ No newline at end of file diff --git a/api-ref/source/v3/samples/quotas-update-request.json b/api-ref/source/v3/samples/quota_sets/quotas-update-request.json similarity index 77% rename from api-ref/source/v3/samples/quotas-update-request.json rename to api-ref/source/v3/samples/quota_sets/quotas-update-request.json index b5c3517f19c..a21ff59d68d 100644 --- a/api-ref/source/v3/samples/quotas-update-request.json +++ b/api-ref/source/v3/samples/quota_sets/quotas-update-request.json @@ -2,7 +2,6 @@ "quota_set":{ "groups": 11, "volumes": 5, - "volumes_ceph": 3, "backups": 4 } } diff --git a/api-ref/source/v3/samples/quota_sets/quotas-update-response.json b/api-ref/source/v3/samples/quota_sets/quotas-update-response.json new file mode 100644 index 00000000000..c4bae05b59b --- /dev/null +++ b/api-ref/source/v3/samples/quota_sets/quotas-update-response.json @@ -0,0 +1,14 @@ +{ + "quota_set": { + "backup_gigabytes": 1000, + "backups": 4, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 11, + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 5, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/api-ref/source/v3/samples/quotas-show-defaults-response.json b/api-ref/source/v3/samples/quotas-show-defaults-response.json deleted file mode 100644 index adc54993ea4..00000000000 --- a/api-ref/source/v3/samples/quotas-show-defaults-response.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "quota_set": { - "id": "a7090a26bc554d93aa845a4d41808251", - "volumes": 10, - "volumes_ceph": -1, - "volumes_lvm-thin": -1, - "volumes_lvmdriver-1": -1, - "snapshots": 10, - "snapshots_ceph": -1, - "snapshots_lvm-thin": -1, - "snapshots_lvmdriver-1": -1, - "backups": 10, - "groups": 10, - "per_volume_gigabytes": -1, - "gigabytes": 1000, - "gigabytes_ceph": -1, - "gigabytes_lvm-thin": -1, - "gigabytes_lvmdriver-1": -1, - "backup_gigabytes": 1000 - } -} diff --git a/api-ref/source/v3/samples/quotas-show-response.json b/api-ref/source/v3/samples/quotas-show-response.json deleted file mode 100644 index adc54993ea4..00000000000 --- a/api-ref/source/v3/samples/quotas-show-response.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "quota_set": { - "id": "a7090a26bc554d93aa845a4d41808251", - "volumes": 10, - "volumes_ceph": -1, - "volumes_lvm-thin": -1, - "volumes_lvmdriver-1": -1, - "snapshots": 10, - "snapshots_ceph": -1, - "snapshots_lvm-thin": -1, - "snapshots_lvmdriver-1": -1, - "backups": 10, - "groups": 10, - "per_volume_gigabytes": -1, - "gigabytes": 1000, - "gigabytes_ceph": -1, - "gigabytes_lvm-thin": -1, - "gigabytes_lvmdriver-1": -1, - "backup_gigabytes": 1000 - } -} diff --git a/api-ref/source/v3/samples/quotas-show-usage-response.json b/api-ref/source/v3/samples/quotas-show-usage-response.json deleted file mode 100644 index 44dc8ce9bf4..00000000000 --- a/api-ref/source/v3/samples/quotas-show-usage-response.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "quota_set": { - "id": "a7090a26bc554d93aa845a4d41808251", - "volumes": { - "reserved": 0, - "allocated": 0, - "limit": 10, - "in_use": 0 - }, - "volumes_lvmdriver-1": { - "reserved": 0, - "allocated": 0, - "limit": -1, - "in_use": 0 - }, - "snapshots": { - "reserved": 0, - "allocated": 0, - "limit": 10, - "in_use": 0 - }, - "snapshots_lvmdriver-1": { - "reserved": 0, - "allocated": 0, - "limit": -1, - "in_use": 0 - }, - "backups": { - "reserved": 0, - "allocated": 0, - "limit": 10, - "in_use": 0 - }, - "groups": { - "reserved": 0, - "allocated": 0, - "limit": 10, - "in_use": 0 - }, - "per_volume_gigabytes": { - "reserved": 0, - "allocated": 0, - "limit": -1, - "in_use": 0 - }, - "gigabytes": { - "reserved": 0, - "allocated": 0, - "limit": 1000, - "in_use": 0 - }, - "gigabytes_lvmdriver-1": { - "reserved": 0, - "allocated": 0, - "limit": 1000, - "in_use": 0 - }, - "backup_gigabytes": { - "reserved": 0, - "allocated": 0, - "limit": 1000, - "in_use": 0 - } - } -} diff --git a/api-ref/source/v3/samples/quotas-update-response.json b/api-ref/source/v3/samples/quotas-update-response.json deleted file mode 100644 index b239ec5d570..00000000000 --- a/api-ref/source/v3/samples/quotas-update-response.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "quota_set": { - "volumes": 10, - "volumes_ceph": -1, - "volumes_lvm-thin": -1, - "volumes_lvmdriver-1": -1, - "snapshots": 10, - "snapshots_ceph": -1, - "snapshots_lvm-thin": -1, - "snapshots_lvmdriver-1": -1, - "backups": 10, - "groups": 10, - "per_volume_gigabytes": -1, - "gigabytes": 1000, - "gigabytes_ceph": -1, - "gigabytes_lvm-thin": -1, - "gigabytes_lvmdriver-1": -1, - "backup_gigabytes": 1000 - } -} diff --git a/cinder/tests/functional/api_sample_tests/samples/quota_classes/quota-classes-show-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/quota_classes/quota-classes-show-response.json.tpl new file mode 100644 index 00000000000..dc8a22592ba --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/quota_classes/quota-classes-show-response.json.tpl @@ -0,0 +1,15 @@ +{ + "quota_class_set": { + "backup_gigabytes": 1000, + "backups": 10, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 10, + "id": "test_class", + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 10, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/quota_classes/quota-classes-update-request.json.tpl b/cinder/tests/functional/api_sample_tests/samples/quota_classes/quota-classes-update-request.json.tpl new file mode 100644 index 00000000000..4c7b19ef4ea --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/quota_classes/quota-classes-update-request.json.tpl @@ -0,0 +1,7 @@ +{ + "quota_class_set": { + "volumes": 10, + "gigabytes": 1000, + "snapshots": 10 + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/quota_classes/quota-classes-update-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/quota_classes/quota-classes-update-response.json.tpl new file mode 100644 index 00000000000..922a974eed7 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/quota_classes/quota-classes-update-response.json.tpl @@ -0,0 +1,14 @@ +{ + "quota_class_set": { + "backup_gigabytes": 1000, + "backups": 10, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 10, + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 10, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-show-defaults-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-show-defaults-response.json.tpl new file mode 100644 index 00000000000..8d160b21128 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-show-defaults-response.json.tpl @@ -0,0 +1,15 @@ +{ + "quota_set": { + "backup_gigabytes": 1000, + "backups": 10, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 10, + "id": "fake_tenant", + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 10, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-show-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-show-response.json.tpl new file mode 100644 index 00000000000..8d160b21128 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-show-response.json.tpl @@ -0,0 +1,15 @@ +{ + "quota_set": { + "backup_gigabytes": 1000, + "backups": 10, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 10, + "id": "fake_tenant", + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 10, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-show-usage-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-show-usage-response.json.tpl new file mode 100644 index 00000000000..7b30cb3da88 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-show-usage-response.json.tpl @@ -0,0 +1,55 @@ +{ + "quota_set": { + "backup_gigabytes": { + "in_use": 0, + "limit": 1000, + "reserved": 0 + }, + "backups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "gigabytes": { + "in_use": 0, + "limit": 1000, + "reserved": 0 + }, + "gigabytes___DEFAULT__": { + "in_use": 0, + "limit": -1, + "reserved": 0 + }, + "groups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "id": "fake_tenant", + "per_volume_gigabytes": { + "in_use": 0, + "limit": -1, + "reserved": 0 + }, + "snapshots": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "snapshots___DEFAULT__": { + "in_use": 0, + "limit": -1, + "reserved": 0 + }, + "volumes": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "volumes___DEFAULT__": { + "in_use": 0, + "limit": -1, + "reserved": 0 + } + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-update-request.json.tpl b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-update-request.json.tpl new file mode 100644 index 00000000000..a21ff59d68d --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-update-request.json.tpl @@ -0,0 +1,7 @@ +{ + "quota_set":{ + "groups": 11, + "volumes": 5, + "backups": 4 + } +} diff --git a/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-update-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-update-response.json.tpl new file mode 100644 index 00000000000..c4bae05b59b --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/quota_sets/quotas-update-response.json.tpl @@ -0,0 +1,14 @@ +{ + "quota_set": { + "backup_gigabytes": 1000, + "backups": 4, + "gigabytes": 1000, + "gigabytes___DEFAULT__": -1, + "groups": 11, + "per_volume_gigabytes": -1, + "snapshots": 10, + "snapshots___DEFAULT__": -1, + "volumes": 5, + "volumes___DEFAULT__": -1 + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/test_quota_classes.py b/cinder/tests/functional/api_sample_tests/test_quota_classes.py new file mode 100644 index 00000000000..00154f901ab --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/test_quota_classes.py @@ -0,0 +1,31 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from cinder.tests.functional.api_sample_tests import test_volumes + + +class QuotaClassesSampleJsonTest(test_volumes.VolumesSampleBase): + sample_dir = "quota_classes" + + def setUp(self): + super(QuotaClassesSampleJsonTest, self).setUp() + + def test_quota_classes_show(self): + response = self._do_get('os-quota-class-sets/test_class') + self._verify_response('quota-classes-show-response', {}, + response, 200) + + def test_quotas_update(self): + response = self._do_put('os-quota-class-sets/test_class', + 'quota-classes-update-request') + self._verify_response('quota-classes-update-response', {}, + response, 200) diff --git a/cinder/tests/functional/api_sample_tests/test_quota_sets.py b/cinder/tests/functional/api_sample_tests/test_quota_sets.py new file mode 100644 index 00000000000..49d09c5de1e --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/test_quota_sets.py @@ -0,0 +1,38 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from cinder.tests.functional.api_sample_tests import test_volumes + + +class QuotaSetsSampleJsonTest(test_volumes.VolumesSampleBase): + sample_dir = "quota_sets" + + def setUp(self): + super(QuotaSetsSampleJsonTest, self).setUp() + + def test_quotas_show(self): + response = self._do_get('os-quota-sets/fake_tenant') + self._verify_response('quotas-show-response', {}, response, 200) + + def test_quotas_show_usage(self): + response = self._do_get('os-quota-sets/fake_tenant?usage=True') + self._verify_response('quotas-show-usage-response', {}, response, 200) + + def test_quotas_update(self): + response = self._do_put('os-quota-sets/fake_tenant', + 'quotas-update-request') + self._verify_response('quotas-update-response', {}, response, 200) + + def test_quotas_defaults(self): + response = self._do_get('os-quota-sets/fake_tenant/defaults') + self._verify_response('quotas-show-defaults-response', + {}, response, 200)