Use hard coded values in schema than reference

API request schema should be using hard coded values
than reference of other nova code.

If refference code is changed for any reason and without
knowledge of that is being used in schema then, it can
change the schema unintentionally which leads to API backward
incompatible change.

It is always better to use raw and hard coded values in schema
to avoid unintentional API changes.

This commit removes the db value reference from few schema.

Change-Id: Ie1431b7f08172292d77d72fd8d0471a2c1b392b0
This commit is contained in:
ghanshyam 2018-07-10 09:28:40 +00:00 committed by Ghanshyam Mann
parent 7d2223e4ec
commit 9610b6e252
3 changed files with 9 additions and 6 deletions

View File

@ -15,7 +15,6 @@
import copy
from nova.api.validation import parameter_types
from nova.db import api as db
create = {
'type': 'object',
@ -42,7 +41,9 @@ create = {
'type': ['number', 'string'],
'pattern': '^[0-9]+(\.[0-9]+)?$',
'minimum': 0, 'exclusiveMinimum': True,
'maximum': db.SQL_SP_FLOAT_MAX
# maximum's value is limited to db constant's
# SQL_SP_FLOAT_MAX (in nova/db/constants.py)
'maximum': 3.40282e+38
},
'os-flavor-access:is_public': parameter_types.boolean,
},

View File

@ -15,14 +15,15 @@
import copy
from nova.api.validation import parameter_types
from nova.db import api as db
common_quota = {
'type': ['integer', 'string'],
'pattern': '^-?[0-9]+$',
# -1 is a flag value for unlimited
'minimum': -1,
'maximum': db.MAX_INT
# maximum's value is limited to db constant's MAX_INT
# (in nova/db/constants.py)
'maximum': 0x7FFFFFFF
}
quota_resources = {

View File

@ -21,7 +21,6 @@ import unicodedata
import six
from nova.db import api as db
from nova.i18n import _
from nova.objects import tag
@ -427,7 +426,9 @@ volume_size = {
'type': ['integer', 'string'],
'pattern': '^[0-9]+$',
'minimum': 1,
'maximum': db.MAX_INT
# maximum's value is limited to db constant's MAX_INT
# (in nova/db/constants.py)
'maximum': 0x7FFFFFFF
}
disk_config = {