From be0ed5f92eb4b0e0373a44bb1ba9a3328df9b7fd Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Fri, 20 Oct 2023 10:36:30 +1300 Subject: [PATCH] [baremetal] Add missing owner attribute to allocation Change-Id: I9f4529764fc69dd398c800b5f25185e3c5b3202c --- openstack/baremetal/v1/allocation.py | 6 +++++- openstack/tests/unit/baremetal/v1/test_allocation.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openstack/baremetal/v1/allocation.py b/openstack/baremetal/v1/allocation.py index 3179f15ba..dadb5e34d 100644 --- a/openstack/baremetal/v1/allocation.py +++ b/openstack/baremetal/v1/allocation.py @@ -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. diff --git a/openstack/tests/unit/baremetal/v1/test_allocation.py b/openstack/tests/unit/baremetal/v1/test_allocation.py index 4c532d935..5d6bd3087 100644 --- a/openstack/tests/unit/baremetal/v1/test_allocation.py +++ b/openstack/tests/unit/baremetal/v1/test_allocation.py @@ -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)