Make Volume conditionally required attribute in Instance Create Schema
volume attribute may be removed in cases where volume support is off Fixes: bug 1200029 Change-Id: Ic956e3d16cfb981eb778c77e0fe41b2e2e5f6e46
This commit is contained in:
parent
563c274b48
commit
a42419c4fe
|
@ -13,6 +13,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from trove.common import cfg
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
flavorref = {
|
||||
'oneOf': [
|
||||
|
@ -146,7 +149,8 @@ instance = {
|
|||
"properties": {
|
||||
"instance": {
|
||||
"type": "object",
|
||||
"required": ["name", "flavorRef", "volume"],
|
||||
"required": ["name", "flavorRef",
|
||||
"volume" if CONF.trove_volume_support else None],
|
||||
"additionalProperties": False,
|
||||
"properties": {
|
||||
"name": non_empty_string,
|
||||
|
|
|
@ -38,7 +38,11 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
class InstanceController(wsgi.Controller):
|
||||
"""Controller for instance functionality"""
|
||||
schemas = apischema.instance
|
||||
schemas = apischema.instance.copy()
|
||||
if not CONF.trove_volume_support:
|
||||
# see instance.models.create for further validation around this
|
||||
LOG.info("Removing volume attributes from schema")
|
||||
schemas['create']['properties']['instance']['required'].pop()
|
||||
|
||||
@classmethod
|
||||
def get_action_schema(cls, body, action_schema):
|
||||
|
|
Loading…
Reference in New Issue