From 9de9faa0f6080e0e01e676330eff293c3d15ffb2 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 (cherry picked from commit 9ddbaa15cb55d1245a8a63d9414d134746fc2f3c) (cherry picked from commit 6f5b3123cc3e35af7d9054c299f4c2232c8c2a3f) (cherry picked from commit 901377b22bb92747748b25058e31d1099904c8cc) --- .../v2.36/quotas-show-defaults-get-resp.json | 15 +++++ .../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 | 7 +-- .../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 +++++ .../openstack/compute/schemas/quota_sets.py | 2 +- .../openstack/rest_api_version_history.rst | 6 ++ .../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, 329 insertions(+), 7 deletions(-) create mode 100644 doc/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json 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 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-update-force-post-resp.json (61%) 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/doc/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json b/doc/api_samples/os-quota-sets/v2.36/quotas-show-defaults-get-resp.json new file mode 100644 index 000000000000..1a4d5e5e15e5 --- /dev/null +++ b/doc/api_samples/os-quota-sets/v2.36/quotas-show-defaults-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-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/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-update-force-post-resp.json similarity index 61% 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-update-force-post-resp.json index ff23ff6ae470..935766b33800 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-update-force-post-resp.json @@ -1,8 +1,6 @@ { "quota_set": { "cores": 20, - "floating_ips": 10, - "fixed_ips": -1, "injected_file_content_bytes": 10240, "injected_file_path_bytes": 255, "injected_files": 5, @@ -10,10 +8,7 @@ "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" + "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/schemas/quota_sets.py b/nova/api/openstack/compute/schemas/quota_sets.py index 38a9f80e2507..fff4add74313 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/api/openstack/rest_api_version_history.rst b/nova/api/openstack/rest_api_version_history.rst index 89f5e22875de..873b8ed2ef0c 100644 --- a/nova/api/openstack/rest_api_version_history.rst +++ b/nova/api/openstack/rest_api_version_history.rst @@ -386,6 +386,12 @@ user documentation. '/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/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 84d79ad9762e..d15ce688a8e3 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