Disable flavor traits on API side

As we can't support traits now when talking to placement, so
disable it to avoid to confuse users.

Change-Id: Ib739f0cae03bf12b1c7ae1af7c3a9ec94b40cce1
This commit is contained in:
Zhenguo Niu 2017-09-13 13:02:45 +08:00
parent f84c62f291
commit b55a988327
14 changed files with 1 additions and 55 deletions

View File

@ -35,7 +35,6 @@ Response
- links: links
- description: flavor_description
- resources: flavor_resources
- resource_traits: flavor_resource_traits
- resource_aggregates: flavor_aggregates
- uuid: flavor_uuid
- created_at: created_at
@ -71,7 +70,6 @@ Request
- name: flavor_name
- description: flavor_description
- resources: flavor_resources
- resource_traits: flavor_resource_traits
- resource_aggregates: flavor_aggregates
- is_public: flavor_is_public_not_required
- disabled: flavor_disabled
@ -90,7 +88,6 @@ Response
- links: links
- description: flavor_description
- resources: flavor_resources
- resource_traits: flavor_resource_traits
- resource_aggregates: flavor_aggregates
- uuid: flavor_uuid
- created_at: created_at
@ -142,7 +139,6 @@ Response
- links: links
- description: flavor_description
- resources: flavor_resources
- resource_traits: flavor_resource_traits
- resource_aggregates: flavor_aggregates
- uuid: flavor_uuid
- created_at: created_at
@ -182,7 +178,6 @@ Response
- links: links
- description: flavor_description
- resources: flavor_resources
- resource_traits: flavor_resource_traits
- resource_aggregates: flavor_aggregates
- uuid: flavor_uuid
- created_at: created_at

View File

@ -289,13 +289,6 @@ flavor_name:
in: body
required: true
type: string
flavor_resource_traits:
description: |
A dict of key and value pairs associate with the flavor including the resource
name and the qualities.
in: body
required: false
type: object
flavor_resources:
description: |
A dict of key and value pairs associate with the flavor including the resource

View File

@ -4,9 +4,6 @@
"resources": {
"CUSTOM_BAREMETAL_GOLD": 1
},
"resource_traits": {
"CUSTOM_BAREMETAL_GOLD": "FPGA"
},
"resource_aggregates": {
"high_mem": "true"
},

View File

@ -13,9 +13,6 @@
"resources": {
"CUSTOM_BAREMETAL_GOLD": 1
},
"resource_traits": {
"CUSTOM_BAREMETAL_GOLD": "FPGA"
},
"resource_aggregates": {
"high_mem": "true"
},

View File

@ -13,9 +13,6 @@
"resources": {
"CUSTOM_BAREMETAL_GOLD": 1
},
"resource_traits": {
"CUSTOM_BAREMETAL_GOLD": "FPGA"
},
"resource_aggregates": {
"high_mem": "true"
},

View File

@ -13,9 +13,6 @@
"resources": {
"CUSTOM_BAREMETAL_GOLD": 1
},
"resource_traits": {
"CUSTOM_BAREMETAL_GOLD": "FPGA"
},
"resource_aggregates": {
"high_mem": "true"
},

View File

@ -15,9 +15,6 @@
"resources": {
"CUSTOM_BAREMETAL_GOLD": 1
},
"resource_traits": {
"CUSTOM_BAREMETAL_GOLD": "FPGA"
},
"resource_aggregates": {
"high_mem": "true"
},
@ -43,9 +40,6 @@
"resources": {
"CUSTOM_BAREMETAL_GOLD": 1
},
"resource_traits": {
"CUSTOM_BAREMETAL_GOLD": "FPGA"
},
"resource_aggregates": {
"high_mem": "true"
},

View File

@ -69,9 +69,6 @@ class Flavor(base.APIBase):
resources = {wtypes.text: types.jsontype}
"""The resources of the flavor"""
resource_traits = {wtypes.text: types.jsontype}
"""The resource traits of the flavor"""
resource_aggregates = {wtypes.text: types.jsontype}
"""The resource aggregates of the flavor"""
@ -112,7 +109,6 @@ class FlavorPatchType(types.JsonPatchType):
def internal_attrs():
defaults = types.JsonPatchType.internal_attrs()
return defaults + ['/description', '/resources',
'/resource_traits',
'/resource_aggregates']

View File

@ -23,7 +23,6 @@ create_flavor = {
'name': parameter_types.name,
'description': {'type': 'string', 'minLength': 1},
'resources': parameter_types.resources,
'resource_traits': parameter_types.resource_traits,
'resource_aggregates': parameter_types.metadata,
'is_public': parameter_types.boolean,
'disabled': parameter_types.boolean,

View File

@ -92,17 +92,6 @@ resources = {
}
resource_traits = {
'type': 'object',
'patternProperties': {
'^[a-zA-Z0-9-_:.]{1,255}$': {
'type': 'string', 'maxLength': 255
}
},
'additionalProperties': False
}
mac_address = {
'type': 'string',
'pattern': '^([0-9a-fA-F]{2})(:[0-9a-fA-F]{2}){5}$'

View File

@ -41,7 +41,6 @@ class TestFlavor(v1_test.APITestV1):
def test_flavor_post(self):
body = {"name": "test", "description": "just test",
"resources": {"CUSTOM_GOLD": 1},
"resource_traits": {"CUSTOM_GOLD": "FPGA"},
"resource_aggregates": {"high_mem": "true"}}
resp = self.post_json(
'/flavors', body, headers=self.headers, status=201)
@ -50,7 +49,6 @@ class TestFlavor(v1_test.APITestV1):
self.assertEqual('just test', resp['description'])
self.assertTrue(resp['is_public'])
self.assertEqual({'CUSTOM_GOLD': 1}, resp['resources'])
self.assertEqual({'CUSTOM_GOLD': 'FPGA'}, resp['resource_traits'])
self.assertEqual({'high_mem': 'true'}, resp['resource_aggregates'])
self.assertIn('uuid', resp)
self.assertIn('links', resp)

View File

@ -56,8 +56,7 @@ class BaseBaremetalComputeTest(tempest.test.BaseTestCase):
resource_class = CONF.baremetal_compute_plugin.baremetal_resource_class
body = {"name": data_utils.rand_name('tempest-flavor'),
"description": "flavor to be used by tempest",
'is_public': True, 'resources': {resource_class: 1},
'resource_traits': {resource_class: 'foo'}}
'is_public': True, 'resources': {resource_class: 1}}
tempest_flavor = cls.baremetal_compute_client.create_flavor(**body)
return tempest_flavor['uuid']

View File

@ -53,7 +53,6 @@ class BaremetalComputeAPITest(base.BaseBaremetalComputeTest):
body = {"name": 'mogan_flavor_create',
"description": "mogan flavor description",
'is_public': True, 'resources': {'gold': 1},
'resource_traits': {'gold': 'foo'},
'resource_aggregates': {'high_mem': 'true'}}
resp = self.baremetal_compute_client.create_flavor(**body)
self.assertEqual('mogan_flavor_create', resp['name'])
@ -62,7 +61,6 @@ class BaremetalComputeAPITest(base.BaseBaremetalComputeTest):
self.assertTrue(resp['is_public'])
self.assertFalse(resp['disabled'])
self.assertEqual({'gold': 1}, resp['resources'])
self.assertEqual({'gold': 'foo'}, resp['resource_traits'])
self.assertEqual({'high_mem': 'true'}, resp['resource_aggregates'])
self.assertIn('uuid', resp)
self.assertIn('links', resp)
@ -77,7 +75,6 @@ class BaremetalComputeAPITest(base.BaseBaremetalComputeTest):
self.assertTrue(resp['is_public'])
self.assertFalse(resp['disabled'])
self.assertEqual({'CUSTOM_GOLD': 1}, resp['resources'])
self.assertEqual({}, resp['resource_traits'])
self.assertIn('uuid', resp)
self.assertIn('links', resp)

View File

@ -34,7 +34,6 @@ class TestFlavorAuthorization(v1_test.APITestV1):
self.assertIn('description', resp)
self.assertIn('links', resp)
self.assertNotIn('resources', resp)
self.assertNotIn('resource_traits', resp)
def test_flavor_get_one_by_admin(self):
# role is admin, he can get everything.
@ -47,4 +46,3 @@ class TestFlavorAuthorization(v1_test.APITestV1):
self.assertIn('description', resp)
self.assertIn('links', resp)
self.assertIn('resources', resp)
self.assertIn('resource_traits', resp)