Merge "Add resource aggregates filed to flavor"
This commit is contained in:
commit
b69a5d5a94
@ -36,6 +36,7 @@ Response
|
||||
- description: flavor_description
|
||||
- resources: flavor_resources
|
||||
- resource_traits: flavor_resource_traits
|
||||
- resource_aggregates: flavor_aggregates
|
||||
- uuid: flavor_uuid
|
||||
- created_at: created_at
|
||||
- updated_at: updated_at
|
||||
@ -71,6 +72,7 @@ Request
|
||||
- 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
|
||||
|
||||
@ -89,6 +91,7 @@ Response
|
||||
- description: flavor_description
|
||||
- resources: flavor_resources
|
||||
- resource_traits: flavor_resource_traits
|
||||
- resource_aggregates: flavor_aggregates
|
||||
- uuid: flavor_uuid
|
||||
- created_at: created_at
|
||||
- updated_at: updated_at
|
||||
@ -140,6 +143,7 @@ Response
|
||||
- description: flavor_description
|
||||
- resources: flavor_resources
|
||||
- resource_traits: flavor_resource_traits
|
||||
- resource_aggregates: flavor_aggregates
|
||||
- uuid: flavor_uuid
|
||||
- created_at: created_at
|
||||
- updated_at: updated_at
|
||||
@ -179,6 +183,7 @@ Response
|
||||
- description: flavor_description
|
||||
- resources: flavor_resources
|
||||
- resource_traits: flavor_resource_traits
|
||||
- resource_aggregates: flavor_aggregates
|
||||
- uuid: flavor_uuid
|
||||
- created_at: created_at
|
||||
- updated_at: updated_at
|
||||
|
@ -232,6 +232,13 @@ flavor_access:
|
||||
in: body
|
||||
required: true
|
||||
type: array
|
||||
flavor_aggregates:
|
||||
description: |
|
||||
A dict of key and value pairs associate with the flavor including the resources
|
||||
aggregate metadata.
|
||||
in: body
|
||||
required: true
|
||||
type: object
|
||||
flavor_description:
|
||||
description: |
|
||||
The description of the flavor.
|
||||
@ -277,7 +284,7 @@ flavor_resources:
|
||||
name and the quantity.
|
||||
in: body
|
||||
required: true
|
||||
type: string
|
||||
type: object
|
||||
flavor_uuid:
|
||||
description: |
|
||||
The UUID of the flavor.
|
||||
|
@ -7,6 +7,9 @@
|
||||
"resource_traits": {
|
||||
"CUSTOM_BAREMETAL_GOLD": "FPGA"
|
||||
},
|
||||
"resource_aggregates": {
|
||||
"high_mem": "true"
|
||||
},
|
||||
"is_public": true,
|
||||
"disabled": true
|
||||
}
|
||||
|
@ -16,6 +16,9 @@
|
||||
"resource_traits": {
|
||||
"CUSTOM_BAREMETAL_GOLD": "FPGA"
|
||||
},
|
||||
"resource_aggregates": {
|
||||
"high_mem": "true"
|
||||
},
|
||||
"created_at": "2016-09-27T02:37:21.966342+00:00",
|
||||
"uuid": "7de2859d-ec6d-42c7-bb86-9d630ba5ac94",
|
||||
"updated_at": null,
|
||||
|
@ -16,6 +16,9 @@
|
||||
"resource_traits": {
|
||||
"CUSTOM_BAREMETAL_GOLD": "FPGA"
|
||||
},
|
||||
"resource_aggregates": {
|
||||
"high_mem": "true"
|
||||
},
|
||||
"created_at": "2016-09-27T02:37:21.966342+00:00",
|
||||
"uuid": "7de2859d-ec6d-42c7-bb86-9d630ba5ac94",
|
||||
"updated_at": null,
|
||||
|
@ -16,6 +16,9 @@
|
||||
"resource_traits": {
|
||||
"CUSTOM_BAREMETAL_GOLD": "FPGA"
|
||||
},
|
||||
"resource_aggregates": {
|
||||
"high_mem": "true"
|
||||
},
|
||||
"created_at": "2016-09-27T02:37:21.966342+00:00",
|
||||
"uuid": "7de2859d-ec6d-42c7-bb86-9d630ba5ac94",
|
||||
"updated_at": null,
|
||||
|
@ -18,6 +18,9 @@
|
||||
"resource_traits": {
|
||||
"CUSTOM_BAREMETAL_GOLD": "FPGA"
|
||||
},
|
||||
"resource_aggregates": {
|
||||
"high_mem": "true"
|
||||
},
|
||||
"created_at": "2016-09-22T03:21:57+00:00",
|
||||
"uuid": "2ce3df6b-f571-42e8-b6a8-8f7fa1c019ce",
|
||||
"updated_at": null,
|
||||
@ -43,6 +46,9 @@
|
||||
"resource_traits": {
|
||||
"CUSTOM_BAREMETAL_GOLD": "FPGA"
|
||||
},
|
||||
"resource_aggregates": {
|
||||
"high_mem": "true"
|
||||
},
|
||||
"created_at": "2016-09-27T02:37:21+00:00",
|
||||
"uuid": "7de2859d-ec6d-42c7-bb86-9d630ba5ac94",
|
||||
"updated_at": null,
|
||||
|
@ -72,6 +72,9 @@ class Flavor(base.APIBase):
|
||||
resource_traits = {wtypes.text: types.jsontype}
|
||||
"""The resource traits of the flavor"""
|
||||
|
||||
resource_aggregates = {wtypes.text: types.jsontype}
|
||||
"""The resource aggregates of the flavor"""
|
||||
|
||||
links = wsme.wsattr([link.Link], readonly=True)
|
||||
"""A list containing a self link"""
|
||||
|
||||
|
@ -24,6 +24,7 @@ create_flavor = {
|
||||
'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,
|
||||
},
|
||||
|
@ -38,6 +38,7 @@ def upgrade():
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('resources', sa.Text(), nullable=True),
|
||||
sa.Column('resource_traits', sa.Text(), nullable=True),
|
||||
sa.Column('resource_aggregates', sa.Text(), nullable=True),
|
||||
sa.Column('is_public', sa.Boolean(), nullable=False),
|
||||
sa.Column('disabled', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
|
@ -148,6 +148,7 @@ class Flavors(Base):
|
||||
description = Column(MediumText())
|
||||
resources = Column(db_types.JsonEncodedDict)
|
||||
resource_traits = Column(db_types.JsonEncodedDict)
|
||||
resource_aggregates = Column(db_types.JsonEncodedDict)
|
||||
is_public = Column(Boolean, default=True)
|
||||
disabled = Column(Boolean, default=False)
|
||||
servers = orm.relationship(
|
||||
|
@ -39,6 +39,7 @@ class Flavor(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
'disabled': object_fields.BooleanField(),
|
||||
'resources': object_fields.FlexibleDictField(nullable=True),
|
||||
'resource_traits': object_fields.FlexibleDictField(nullable=True),
|
||||
'resource_aggregates': object_fields.FlexibleDictField(nullable=True),
|
||||
'projects': object_fields.ListOfStringsField(),
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,8 @@ 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_traits": {"CUSTOM_GOLD": "FPGA"},
|
||||
"resource_aggregates": {"high_mem": "true"}}
|
||||
resp = self.post_json(
|
||||
'/flavors', body, headers=self.headers, status=201)
|
||||
resp = resp.json
|
||||
@ -50,6 +51,7 @@ class TestFlavor(v1_test.APITestV1):
|
||||
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)
|
||||
|
||||
|
@ -29,6 +29,7 @@ class BaremetalComputeAPITest(base.BaseBaremetalComputeTest):
|
||||
body = {"name": "mogan_flavor_" + {0: 'public', 1: 'private'}[i],
|
||||
"description": "mogan flavor description",
|
||||
"resources": {"CUSTOM_GOLD": 1},
|
||||
"resource_aggregates": {"high_mem": "true"},
|
||||
'is_public': not bool(i)}
|
||||
resp = cls.baremetal_compute_client.create_flavor(**body)
|
||||
cls.flavor_ids.append(resp['uuid'])
|
||||
@ -52,7 +53,8 @@ class BaremetalComputeAPITest(base.BaseBaremetalComputeTest):
|
||||
body = {"name": 'mogan_flavor_create',
|
||||
"description": "mogan flavor description",
|
||||
'is_public': True, 'resources': {'gold': 1},
|
||||
'resource_traits': {'gold': 'foo'}}
|
||||
'resource_traits': {'gold': 'foo'},
|
||||
'resource_aggregates': {'high_mem': 'true'}}
|
||||
resp = self.baremetal_compute_client.create_flavor(**body)
|
||||
self.assertEqual('mogan_flavor_create', resp['name'])
|
||||
self.assertEqual('mogan flavor description',
|
||||
@ -61,6 +63,7 @@ class BaremetalComputeAPITest(base.BaseBaremetalComputeTest):
|
||||
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)
|
||||
self.flavor_ids.append(resp['uuid'])
|
||||
|
@ -92,6 +92,7 @@ def get_test_flavor(**kw):
|
||||
'description': kw.get('description', 'test'),
|
||||
'resources': kw.get('resources', {}),
|
||||
'resource_traits': kw.get('resource_traits', {}),
|
||||
'resource_aggregates': kw.get('resource_aggregates', {}),
|
||||
'is_public': kw.get('is_public', 1),
|
||||
'disabled': kw.get('disabled', 0),
|
||||
'updated_at': kw.get('updated_at'),
|
||||
|
@ -385,7 +385,7 @@ expected_object_fingerprints = {
|
||||
'Server': '1.0-dc54162c0cc91fac43fed5304cd2c968',
|
||||
'ServerFault': '1.0-74349ff701259e4834b4e9dc2dac1b12',
|
||||
'ServerFaultList': '1.0-43e8aad0258652921f929934e9e048fd',
|
||||
'Flavor': '1.0-f53b71bd4aaaadea0d9284b811a82bb5',
|
||||
'Flavor': '1.0-9f7166aa387d89ec40cd699019d0c9a9',
|
||||
'MyObj': '1.1-aad62eedc5a5cc8bcaf2982c285e753f',
|
||||
'ServerNic': '1.0-0494306157ef437802260ff8b51cf5cf',
|
||||
'ServerNics': '1.0-33a2e1bb91ad4082f9f63429b77c1244',
|
||||
|
Loading…
Reference in New Issue
Block a user