api: Add response body schemas for server topology API
Change-Id: I2cd4086d7b348f6d7f1b93a956b8b25f3a60d07f Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
@@ -16,3 +16,42 @@ query_params_v21 = {
|
||||
'properties': {},
|
||||
'additionalProperties': True,
|
||||
}
|
||||
|
||||
index_response = {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'nodes': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'cpu_pinning': {
|
||||
'type': 'object',
|
||||
'patternProperties': {
|
||||
'^[0-9]+$': {'type': 'integer'},
|
||||
},
|
||||
'additionalProperties': False,
|
||||
},
|
||||
'host_node': {'type': 'integer'},
|
||||
'memory_mb': {'type': 'integer'},
|
||||
'siblings': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'array',
|
||||
'items': {'type': 'integer'},
|
||||
},
|
||||
},
|
||||
'vcpu_set': {
|
||||
'type': 'array',
|
||||
'items': {'type': 'integer'},
|
||||
},
|
||||
},
|
||||
'required': ['memory_mb', 'siblings', 'vcpu_set'],
|
||||
'additionalProperties': False,
|
||||
},
|
||||
},
|
||||
'pagesize_kb': {'type': ['integer', 'null']},
|
||||
},
|
||||
'required': ['nodes', 'pagesize_kb'],
|
||||
'additionalProperties': False,
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ from nova.compute import api as compute
|
||||
from nova.policies import server_topology as st_policies
|
||||
|
||||
|
||||
@validation.validated
|
||||
class ServerTopologyController(wsgi.Controller):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -28,6 +29,7 @@ class ServerTopologyController(wsgi.Controller):
|
||||
@wsgi.api_version("2.78")
|
||||
@wsgi.expected_errors(404)
|
||||
@validation.query_schema(schema.query_params_v21)
|
||||
@validation.response_body_schema(schema.index_response)
|
||||
def index(self, req, server_id):
|
||||
context = req.environ["nova.context"]
|
||||
instance = common.get_instance(self.compute_api, context, server_id,
|
||||
|
||||
Reference in New Issue
Block a user