From 9ddbaa15cb55d1245a8a63d9414d134746fc2f3c Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Mon, 27 Nov 2017 13:48:13 -0500 Subject: [PATCH] Fix 'force' parameter in os-quota-sets PUT schema A regression was introduced in the 2.36 API microversion where the 'force' parameter was missing from the 'PUT /os-quota-sets/{tenant_id}' API request schema so users could not force quota updates with microversion 2.36 or later. The bug is now fixed so that the 'force' parameter can once again be specified during quota updates. There is no new microversion for this change since it is an admin-only API. Change-Id: I947e927802f755ccb25a91efd82cac895779d19e Closes-Bug: #1733886 --- .../v2.36/quotas-show-defaults-get-resp.json | 11 +--- .../v2.36/quotas-show-detail-get-resp.json | 55 +++++++++++++++++++ .../v2.36/quotas-show-get-resp.json | 15 +++++ .../v2.36/quotas-update-force-post-req.json | 6 ++ .../v2.36/quotas-update-force-post-resp.json | 14 +++++ .../v2.36/quotas-update-post-req.json | 5 ++ .../v2.36/quotas-update-post-resp.json | 14 +++++ .../v2.36/user-quotas-show-get-resp.json | 15 +++++ .../v2.36/user-quotas-update-post-req.json | 6 ++ .../v2.36/user-quotas-update-post-resp.json | 14 +++++ .../compute/rest_api_version_history.rst | 6 ++ .../openstack/compute/schemas/quota_sets.py | 2 +- .../quotas-show-defaults-get-resp.json.tpl | 15 +++++ .../quotas-show-detail-get-resp.json.tpl | 55 +++++++++++++++++++ .../v2.36/quotas-show-get-resp.json.tpl | 15 +++++ .../quotas-update-force-post-req.json.tpl | 6 ++ .../quotas-update-force-post-resp.json.tpl | 14 +++++ .../v2.36/quotas-update-post-req.json.tpl | 5 ++ .../v2.36/quotas-update-post-resp.json.tpl | 14 +++++ .../v2.36/user-quotas-show-get-resp.json.tpl | 15 +++++ .../user-quotas-update-post-req.json.tpl | 6 ++ .../user-quotas-update-post-resp.json.tpl | 14 +++++ .../api_sample_tests/test_quota_sets.py | 5 ++ ...uota-sets-force-2.36-5866924621ecc857.yaml | 12 ++++ 24 files changed, 330 insertions(+), 9 deletions(-) rename nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl => doc/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json (59%) create mode 100644 doc/api_samples/os-quota-sets/v2.36/quotas-show-detail-get-resp.json create mode 100644 doc/api_samples/os-quota-sets/v2.36/quotas-show-get-resp.json create mode 100644 doc/api_samples/os-quota-sets/v2.36/quotas-update-force-post-req.json create mode 100644 doc/api_samples/os-quota-sets/v2.36/quotas-update-force-post-resp.json create mode 100644 doc/api_samples/os-quota-sets/v2.36/quotas-update-post-req.json create mode 100644 doc/api_samples/os-quota-sets/v2.36/quotas-update-post-resp.json create mode 100644 doc/api_samples/os-quota-sets/v2.36/user-quotas-show-get-resp.json create mode 100644 doc/api_samples/os-quota-sets/v2.36/user-quotas-update-post-req.json create mode 100644 doc/api_samples/os-quota-sets/v2.36/user-quotas-update-post-resp.json create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json.tpl create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-detail-get-resp.json.tpl create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-get-resp.json.tpl create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-force-post-req.json.tpl create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-force-post-resp.json.tpl create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-post-req.json.tpl create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-post-resp.json.tpl create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-show-get-resp.json.tpl create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-update-post-req.json.tpl create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-update-post-resp.json.tpl create mode 100644 releasenotes/notes/bug-1733886-os-quota-sets-force-2.36-5866924621ecc857.yaml diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl b/doc/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json similarity index 59% rename from nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl rename to doc/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json index bf567a8046c1..1a4d5e5e15e5 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl +++ b/doc/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json @@ -1,20 +1,15 @@ { "quota_set": { "cores": 20, - "floating_ips": 10, - "fixed_ips": -1, + "id": "fake_tenant", "injected_file_content_bytes": 10240, "injected_file_path_bytes": 255, "injected_files": 5, - "instances": 45, + "instances": 10, "key_pairs": 100, "metadata_items": 128, "ram": 51200, - "security_group_rules": 20, - "security_groups": 10, "server_groups": 10, - "server_group_members": 10, - "id": "fake_tenant", - "networks": 3 + "server_group_members": 10 } } diff --git a/doc/api_samples/os-quota-sets/v2.36/quotas-show-detail-get-resp.json b/doc/api_samples/os-quota-sets/v2.36/quotas-show-detail-get-resp.json new file mode 100644 index 000000000000..fe6762f85df4 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/quotas-show-detail-get-resp.json @@ -0,0 +1,55 @@ +{ + "quota_set": { + "cores": { + "in_use": 0, + "limit": 20, + "reserved": 0 + }, + "id": "fake_tenant", + "injected_file_content_bytes": { + "in_use": 0, + "limit": 10240, + "reserved": 0 + }, + "injected_file_path_bytes": { + "in_use": 0, + "limit": 255, + "reserved": 0 + }, + "injected_files": { + "in_use": 0, + "limit": 5, + "reserved": 0 + }, + "instances": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "key_pairs": { + "in_use": 0, + "limit": 100, + "reserved": 0 + }, + "metadata_items": { + "in_use": 0, + "limit": 128, + "reserved": 0 + }, + "ram": { + "in_use": 0, + "limit": 51200, + "reserved": 0 + }, + "server_group_members": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "server_groups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + } + } +} diff --git a/doc/api_samples/os-quota-sets/v2.36/quotas-show-get-resp.json b/doc/api_samples/os-quota-sets/v2.36/quotas-show-get-resp.json new file mode 100644 index 000000000000..1a4d5e5e15e5 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/quotas-show-get-resp.json @@ -0,0 +1,15 @@ +{ + "quota_set": { + "cores": 20, + "id": "fake_tenant", + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 10, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/doc/api_samples/os-quota-sets/v2.36/quotas-update-force-post-req.json b/doc/api_samples/os-quota-sets/v2.36/quotas-update-force-post-req.json new file mode 100644 index 000000000000..460d2ac1c7c4 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/quotas-update-force-post-req.json @@ -0,0 +1,6 @@ +{ + "quota_set": { + "force": "True", + "instances": 45 + } +} \ No newline at end of file diff --git a/doc/api_samples/os-quota-sets/v2.36/quotas-update-force-post-resp.json b/doc/api_samples/os-quota-sets/v2.36/quotas-update-force-post-resp.json new file mode 100644 index 000000000000..935766b33800 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/quotas-update-force-post-resp.json @@ -0,0 +1,14 @@ +{ + "quota_set": { + "cores": 20, + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 45, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/doc/api_samples/os-quota-sets/v2.36/quotas-update-post-req.json b/doc/api_samples/os-quota-sets/v2.36/quotas-update-post-req.json new file mode 100644 index 000000000000..b11081d7e456 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/quotas-update-post-req.json @@ -0,0 +1,5 @@ +{ + "quota_set": { + "instances": 45 + } +} \ No newline at end of file diff --git a/doc/api_samples/os-quota-sets/v2.36/quotas-update-post-resp.json b/doc/api_samples/os-quota-sets/v2.36/quotas-update-post-resp.json new file mode 100644 index 000000000000..935766b33800 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/quotas-update-post-resp.json @@ -0,0 +1,14 @@ +{ + "quota_set": { + "cores": 20, + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 45, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/doc/api_samples/os-quota-sets/v2.36/user-quotas-show-get-resp.json b/doc/api_samples/os-quota-sets/v2.36/user-quotas-show-get-resp.json new file mode 100644 index 000000000000..1a4d5e5e15e5 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/user-quotas-show-get-resp.json @@ -0,0 +1,15 @@ +{ + "quota_set": { + "cores": 20, + "id": "fake_tenant", + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 10, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/doc/api_samples/os-quota-sets/v2.36/user-quotas-update-post-req.json b/doc/api_samples/os-quota-sets/v2.36/user-quotas-update-post-req.json new file mode 100644 index 000000000000..cbd6f18af1d7 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/user-quotas-update-post-req.json @@ -0,0 +1,6 @@ +{ + "quota_set": { + "force": "True", + "instances": 9 + } +} \ No newline at end of file diff --git a/doc/api_samples/os-quota-sets/v2.36/user-quotas-update-post-resp.json b/doc/api_samples/os-quota-sets/v2.36/user-quotas-update-post-resp.json new file mode 100644 index 000000000000..9ae2981a8206 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/user-quotas-update-post-resp.json @@ -0,0 +1,14 @@ +{ + "quota_set": { + "cores": 20, + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 9, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/nova/api/openstack/compute/rest_api_version_history.rst b/nova/api/openstack/compute/rest_api_version_history.rst index ec6a079639ac..4cb75d865a00 100644 --- a/nova/api/openstack/compute/rest_api_version_history.rst +++ b/nova/api/openstack/compute/rest_api_version_history.rst @@ -407,6 +407,12 @@ API endpoints as below:: '/os-baremetal-nodes' '/os-fping' +.. note:: A `regression`_ was introduced in this microversion which broke the + ``force`` parameter in the ``PUT /os-quota-sets`` API. The fix will have + to be applied to restore this functionality. + +.. _regression: https://bugs.launchpad.net/nova/+bug/1733886 + 2.37 ---- diff --git a/nova/api/openstack/compute/schemas/quota_sets.py b/nova/api/openstack/compute/schemas/quota_sets.py index 3a6e4fcaf597..ebd0884bba88 100644 --- a/nova/api/openstack/compute/schemas/quota_sets.py +++ b/nova/api/openstack/compute/schemas/quota_sets.py @@ -46,7 +46,7 @@ quota_resources = { update_quota_set = copy.deepcopy(quota_resources) update_quota_set.update({'force': parameter_types.boolean}) -update_quota_set_v236 = copy.deepcopy(quota_resources) +update_quota_set_v236 = copy.deepcopy(update_quota_set) del update_quota_set_v236['fixed_ips'] del update_quota_set_v236['floating_ips'] del update_quota_set_v236['security_groups'] diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json.tpl new file mode 100644 index 000000000000..1a4d5e5e15e5 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json.tpl @@ -0,0 +1,15 @@ +{ + "quota_set": { + "cores": 20, + "id": "fake_tenant", + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 10, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-detail-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-detail-get-resp.json.tpl new file mode 100644 index 000000000000..fe6762f85df4 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-detail-get-resp.json.tpl @@ -0,0 +1,55 @@ +{ + "quota_set": { + "cores": { + "in_use": 0, + "limit": 20, + "reserved": 0 + }, + "id": "fake_tenant", + "injected_file_content_bytes": { + "in_use": 0, + "limit": 10240, + "reserved": 0 + }, + "injected_file_path_bytes": { + "in_use": 0, + "limit": 255, + "reserved": 0 + }, + "injected_files": { + "in_use": 0, + "limit": 5, + "reserved": 0 + }, + "instances": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "key_pairs": { + "in_use": 0, + "limit": 100, + "reserved": 0 + }, + "metadata_items": { + "in_use": 0, + "limit": 128, + "reserved": 0 + }, + "ram": { + "in_use": 0, + "limit": 51200, + "reserved": 0 + }, + "server_group_members": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "server_groups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + } + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-get-resp.json.tpl new file mode 100644 index 000000000000..1a4d5e5e15e5 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-show-get-resp.json.tpl @@ -0,0 +1,15 @@ +{ + "quota_set": { + "cores": 20, + "id": "fake_tenant", + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 10, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-force-post-req.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-force-post-req.json.tpl new file mode 100644 index 000000000000..a58a17912375 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-force-post-req.json.tpl @@ -0,0 +1,6 @@ +{ + "quota_set": { + "force": "True", + "instances": 45 + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-force-post-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-force-post-resp.json.tpl new file mode 100644 index 000000000000..935766b33800 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-force-post-resp.json.tpl @@ -0,0 +1,14 @@ +{ + "quota_set": { + "cores": 20, + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 45, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-post-req.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-post-req.json.tpl new file mode 100644 index 000000000000..a8de270ffbe6 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-post-req.json.tpl @@ -0,0 +1,5 @@ +{ + "quota_set": { + "instances": 45 + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-post-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-post-resp.json.tpl new file mode 100644 index 000000000000..935766b33800 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/quotas-update-post-resp.json.tpl @@ -0,0 +1,14 @@ +{ + "quota_set": { + "cores": 20, + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 45, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-show-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-show-get-resp.json.tpl new file mode 100644 index 000000000000..1a4d5e5e15e5 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-show-get-resp.json.tpl @@ -0,0 +1,15 @@ +{ + "quota_set": { + "cores": 20, + "id": "fake_tenant", + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 10, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-update-post-req.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-update-post-req.json.tpl new file mode 100644 index 000000000000..b322b2a87007 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-update-post-req.json.tpl @@ -0,0 +1,6 @@ +{ + "quota_set": { + "force": "True", + "instances": 9 + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-update-post-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-update-post-resp.json.tpl new file mode 100644 index 000000000000..9ae2981a8206 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/v2.36/user-quotas-update-post-resp.json.tpl @@ -0,0 +1,14 @@ +{ + "quota_set": { + "cores": 20, + "injected_file_content_bytes": 10240, + "injected_file_path_bytes": 255, + "injected_files": 5, + "instances": 9, + "key_pairs": 100, + "metadata_items": 128, + "ram": 51200, + "server_groups": 10, + "server_group_members": 10 + } +} diff --git a/nova/tests/functional/api_sample_tests/test_quota_sets.py b/nova/tests/functional/api_sample_tests/test_quota_sets.py index e16697d92a67..4cbca1a0cfa7 100644 --- a/nova/tests/functional/api_sample_tests/test_quota_sets.py +++ b/nova/tests/functional/api_sample_tests/test_quota_sets.py @@ -75,3 +75,8 @@ class QuotaSetsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): {}) return self._verify_response('user-quotas-update-post-resp', {}, response, 200) + + +class QuotaSetsSampleJsonTests2_36(QuotaSetsSampleJsonTests): + microversion = '2.36' + scenarios = [('v2_36', {'api_major_version': 'v2.1'})] diff --git a/releasenotes/notes/bug-1733886-os-quota-sets-force-2.36-5866924621ecc857.yaml b/releasenotes/notes/bug-1733886-os-quota-sets-force-2.36-5866924621ecc857.yaml new file mode 100644 index 000000000000..64f162068e9e --- /dev/null +++ b/releasenotes/notes/bug-1733886-os-quota-sets-force-2.36-5866924621ecc857.yaml @@ -0,0 +1,12 @@ +--- +fixes: + - | + This release includes a fix for `bug 1733886`_ which was a regression + introduced in the 2.36 API microversion where the ``force`` parameter was + missing from the ``PUT /os-quota-sets/{tenant_id}`` API request schema so + users could not force quota updates with microversion 2.36 or later. The + bug is now fixed so that the ``force`` parameter can once again be + specified during quota updates. There is no new microversion for this + change since it is an admin-only API. + + .. _bug 1733886: https://bugs.launchpad.net/nova/+bug/1733886