From ae992fc3843adcaa73dc4a9770201b71eb2e8dc6 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Thu, 14 Sep 2023 13:49:53 -0700 Subject: [PATCH] [baremetal] Add unhold provision state verb support Adds support for passing the "unhold" provision state verb to Ironic. The underlying feature added allows step executions for cleaning/provisioning (and later service), to pause operations pending external intervention. This "unhold" provision state verb is that intervention which unpauses the underlying operation allowing it to complete normally. Change-Id: Ic833b1e2f50e3540c2455c161eed08931f023d59 --- openstack/baremetal/v1/_common.py | 1 + openstack/baremetal/v1/node.py | 2 +- openstack/tests/unit/baremetal/v1/test_node.py | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/openstack/baremetal/v1/_common.py b/openstack/baremetal/v1/_common.py index 626605e04..f6ad15b1c 100644 --- a/openstack/baremetal/v1/_common.py +++ b/openstack/baremetal/v1/_common.py @@ -31,6 +31,7 @@ PROVISIONING_VERSIONS = { 'provide': 4, 'rescue': 38, 'unrescue': 38, + 'unhold': 85, } """API microversions introducing provisioning verbs.""" diff --git a/openstack/baremetal/v1/node.py b/openstack/baremetal/v1/node.py index 61e0cb56d..3c7cbf3d3 100644 --- a/openstack/baremetal/v1/node.py +++ b/openstack/baremetal/v1/node.py @@ -100,7 +100,7 @@ class Node(_common.ListMixin, resource.Resource): ) # Ability to query for parent_node, and view the field. - _max_microversion = '1.83' + _max_microversion = '1.85' # Properties #: The UUID of the allocation associated with this node. Added in API diff --git a/openstack/tests/unit/baremetal/v1/test_node.py b/openstack/tests/unit/baremetal/v1/test_node.py index c210349cc..01cc80142 100644 --- a/openstack/tests/unit/baremetal/v1/test_node.py +++ b/openstack/tests/unit/baremetal/v1/test_node.py @@ -383,6 +383,18 @@ class TestNodeSetProvisionState(base.TestCase): retriable_status_codes=_common.RETRIABLE_STATUS_CODES, ) + def test_set_provision_state_unhold(self): + result = self.node.set_provision_state(self.session, 'unhold') + + self.assertIs(result, self.node) + self.session.put.assert_called_once_with( + 'nodes/%s/states/provision' % self.node.id, + json={'target': 'unhold'}, + headers=mock.ANY, + microversion='1.85', + retriable_status_codes=_common.RETRIABLE_STATUS_CODES, + ) + @mock.patch.object(node.Node, '_translate_response', mock.Mock()) @mock.patch.object(node.Node, '_get_session', lambda self, x: x)