Modify api schema for remove pool group

Since we added the pool_list instead of pool_group, but we didn't
support pool_list in 1.1 api. So we need to change the API schema
for compatibility.

Change-Id: Ic05fc730ca2858fa6846a67af4c19f6b6130d575
This commit is contained in:
wanghao 2019-08-20 11:24:42 +08:00
parent a3a2ac338a
commit 2e69bc5b2c
3 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,51 @@
# Copyright (c) 2013 Rackspace Hosting, Inc.
#
# 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.
"""flavors: JSON schema for zaqar-queues flavors resources."""
# NOTE(flaper87): capabilities can be anything. These will be unique to
# each storage driver, so we don't perform any further validation at
# the transport layer.
patch_capabilities = {
'type': 'object',
'properties': {
'capabilities': {
'type': 'object'
}
}
}
# NOTE(gengchc): Add pool_list in flavor creation for removing pool_group
patch_pool_list = {
'type': 'object',
'properties': {
'pool_list': {
'type': 'array'
},
'additionalProperties': False
}
}
create = {
'type': 'object',
'properties': {
'capabilities': patch_capabilities['properties']['capabilities']
},
# NOTE(flaper87): capabilities need not be present. Storage drivers
# must provide reasonable defaults.
# NOTE(wanghao): remove the whole folder when we remove the 1.1 API
# totally.
'additionalProperties': False
}

View File

@ -18,7 +18,7 @@ import jsonschema
from oslo_log import log
import six
from zaqar.common.api.schemas import flavors as schema
from zaqar.common.api.schemas.v1_1 import flavors as schema
from zaqar.common import utils as common_utils
from zaqar.i18n import _
from zaqar.storage import errors