Merge "[placement] Separate API schemas (allocation_candidate)"
This commit is contained in:
commit
cd2010e027
@ -21,6 +21,7 @@ from oslo_utils import timeutils
|
|||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import microversion
|
from nova.api.openstack.placement import microversion
|
||||||
|
from nova.api.openstack.placement.schemas import allocation_candidate as schema
|
||||||
from nova.api.openstack.placement import util
|
from nova.api.openstack.placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from nova.api.openstack.placement import wsgi_wrapper
|
||||||
from nova import exception
|
from nova import exception
|
||||||
@ -30,21 +31,6 @@ from nova.objects import resource_provider as rp_obj
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Represents the allowed query string parameters to the GET
|
|
||||||
# /allocation_candidates API call
|
|
||||||
_GET_SCHEMA_1_10 = {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"resources": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"resources",
|
|
||||||
],
|
|
||||||
"additionalProperties": False,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _transform_allocation_requests_dict(alloc_reqs):
|
def _transform_allocation_requests_dict(alloc_reqs):
|
||||||
"""Turn supplied list of AllocationRequest objects into a list of
|
"""Turn supplied list of AllocationRequest objects into a list of
|
||||||
@ -208,8 +194,7 @@ def list_allocation_candidates(req):
|
|||||||
"""
|
"""
|
||||||
context = req.environ['placement.context']
|
context = req.environ['placement.context']
|
||||||
want_version = req.environ[microversion.MICROVERSION_ENVIRON]
|
want_version = req.environ[microversion.MICROVERSION_ENVIRON]
|
||||||
schema = _GET_SCHEMA_1_10
|
util.validate_query_params(req, schema.GET_SCHEMA_1_10)
|
||||||
util.validate_query_params(req, schema)
|
|
||||||
|
|
||||||
requests = util.parse_qs_request_groups(req.GET)
|
requests = util.parse_qs_request_groups(req.GET)
|
||||||
|
|
||||||
|
27
nova/api/openstack/placement/schemas/allocation_candidate.py
Normal file
27
nova/api/openstack/placement/schemas/allocation_candidate.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# 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.
|
||||||
|
"""Placement API schemas for getting allocation candidates."""
|
||||||
|
|
||||||
|
# Represents the allowed query string parameters to the GET
|
||||||
|
# /allocation_candidates API call
|
||||||
|
GET_SCHEMA_1_10 = {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"resources": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"resources",
|
||||||
|
],
|
||||||
|
"additionalProperties": False,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user