[baremetal] Add missing owner attribute to allocation

Change-Id: I9f4529764fc69dd398c800b5f25185e3c5b3202c
This commit is contained in:
Steve Baker 2023-10-20 10:36:30 +13:00
parent e31836f2ce
commit be0ed5f92e
2 changed files with 7 additions and 1 deletions

View File

@ -34,12 +34,14 @@ class Allocation(_common.ListMixin, resource.Resource):
'node',
'resource_class',
'state',
'owner',
fields={'type': _common.fields_type},
)
# Allocation update is available since 1.57
# Backfilling allocations is available since 1.58
_max_microversion = '1.58'
# owner attribute is available since 1.60
_max_microversion = '1.60'
#: The candidate nodes for this allocation.
candidate_nodes = resource.Body('candidate_nodes', type=list)
@ -60,6 +62,8 @@ class Allocation(_common.ListMixin, resource.Resource):
node = resource.Body('node')
#: UUID of the node this allocation belongs to.
node_id = resource.Body('node_uuid')
#: The tenant who owns the object
owner = resource.Body('owner')
#: The requested resource class.
resource_class = resource.Body('resource_class')
#: The state of the allocation.

View File

@ -35,6 +35,7 @@ FAKE = {
],
"name": "test_allocation",
"node_uuid": "6d85703a-565d-469a-96ce-30b6de53079d",
"owner": "demo",
"resource_class": "baremetal",
"state": "active",
"traits": [],
@ -64,6 +65,7 @@ class TestAllocation(base.TestCase):
self.assertEqual(FAKE['links'], sot.links)
self.assertEqual(FAKE['name'], sot.name)
self.assertEqual(FAKE['node_uuid'], sot.node_id)
self.assertEqual(FAKE['owner'], sot.owner)
self.assertEqual(FAKE['resource_class'], sot.resource_class)
self.assertEqual(FAKE['state'], sot.state)
self.assertEqual(FAKE['traits'], sot.traits)