Merge server create schema for availability zone extension
As nova extensions has been deprecated already and goal is to merge all scattered code into main controller side. Currently schema and request/response extended code are there among all extensions. This commit merge the schema part of create server for AZ extensions. Partially implements: blueprint api-extensions-merge-queens Change-Id: I3671e63187b79cb7a80594d4d7a948565a9003bb
This commit is contained in:
parent
87ea686f9f
commit
43f4755d5e
|
@ -12,7 +12,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.api.openstack.compute.schemas import availability_zone as schema
|
||||
from nova.api.openstack import wsgi
|
||||
from nova import availability_zones
|
||||
from nova import compute
|
||||
|
@ -127,9 +126,3 @@ def server_create(server_dict, create_kwargs, body_deprecated_param):
|
|||
# with some users already created availability_zone with
|
||||
# leading/trailing spaces with legacy v2 API.
|
||||
create_kwargs['availability_zone'] = server_dict.get(ATTRIBUTE_NAME)
|
||||
|
||||
|
||||
def get_server_create_schema(version):
|
||||
if version == "2.0":
|
||||
return schema.server_create_v20
|
||||
return schema.server_create
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
# Copyright 2014 NEC Corporation. All rights reserved.
|
||||
#
|
||||
# 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 nova.api.validation import parameter_types
|
||||
|
||||
server_create = {
|
||||
'availability_zone': parameter_types.name,
|
||||
}
|
||||
|
||||
server_create_v20 = {
|
||||
'availability_zone': parameter_types.name_with_leading_trailing_spaces,
|
||||
}
|
|
@ -54,6 +54,7 @@ base_create = {
|
|||
'accessIPv4': parameter_types.accessIPv4,
|
||||
'accessIPv6': parameter_types.accessIPv6,
|
||||
'personality': parameter_types.personality,
|
||||
'availability_zone': parameter_types.name,
|
||||
},
|
||||
'required': ['name', 'flavorRef'],
|
||||
'additionalProperties': False,
|
||||
|
@ -67,6 +68,8 @@ base_create = {
|
|||
base_create_v20 = copy.deepcopy(base_create)
|
||||
base_create_v20['properties']['server'][
|
||||
'properties']['name'] = parameter_types.name_with_leading_trailing_spaces
|
||||
base_create_v20['properties']['server']['properties'][
|
||||
'availability_zone'] = parameter_types.name_with_leading_trailing_spaces
|
||||
|
||||
|
||||
base_create_v219 = copy.deepcopy(base_create)
|
||||
|
|
|
@ -90,7 +90,6 @@ class ServersController(wsgi.Controller):
|
|||
# NOTE(alex_xu): Please do not add more items into this list. This list
|
||||
# should be removed in the future.
|
||||
schema_func_list = [
|
||||
availability_zone.get_server_create_schema,
|
||||
block_device_mapping.get_server_create_schema,
|
||||
block_device_mapping_v1.get_server_create_schema,
|
||||
config_drive.get_server_create_schema,
|
||||
|
|
Loading…
Reference in New Issue