Add baremetal node unhold

- Updates the version of the API to 1.85
- Adds an unhold command to allow a user to tell Ironic
  so it "unholds" the held step from "deploy hold" or "clean hold".

Change-Id: Ib10fca5e9fce89a94fadd97cb7417bd50359b4a5
This commit is contained in:
Julia Kreger 2023-07-26 13:34:58 -07:00
parent b57429ffdb
commit 508073d976
5 changed files with 37 additions and 1 deletions

View File

@ -37,7 +37,7 @@ from ironicclient import exc
# http://specs.openstack.org/openstack/ironic-specs/specs/kilo/api-microversions.html # noqa
# for full details.
DEFAULT_VER = '1.9'
LAST_KNOWN_API_VERSION = 83
LAST_KNOWN_API_VERSION = 85
LATEST_VERSION = '1.{}'.format(LAST_KNOWN_API_VERSION)
LOG = logging.getLogger(__name__)

View File

@ -922,6 +922,13 @@ class ManageBaremetalNode(ProvisionStateWithWait):
PROVISION_STATE = 'manage'
class UnholdBaremetalNode(ProvisionStateBaremetalNode):
"""Set provision state of baremetal node to 'unhold'"""
log = logging.getLogger(__name__ + ".UnholdBaremetalNode")
PROVISION_STATE = 'unhold'
class PassthruCallBaremetalNode(command.Command):
"""Call a vendor passthru method for a node"""

View File

@ -4525,3 +4525,26 @@ class TestNodeChildrenList(TestBaremetal):
.assert_called_once_with('node_uuid')
self.assertEqual(('Child Nodes',), columns)
self.assertEqual([[node] for node in baremetal_fakes.CHILDREN], data)
class TestUnholdBaremetalProvisionState(TestBaremetal):
def setUp(self):
super(TestUnholdBaremetalProvisionState, self).setUp()
# Get the command object to test
self.cmd = baremetal_node.UnholdBaremetalNode(self.app, None)
def test_unrescue_no_wait(self):
arglist = ['node_uuid']
verifylist = [
('nodes', ['node_uuid']),
('provision_state', 'unhold'),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args)
self.baremetal_mock.node.set_provision_state.assert_called_once_with(
'node_uuid', 'unhold', cleansteps=None, deploysteps=None,
configdrive=None, rescue_password=None)

View File

@ -0,0 +1,5 @@
---
features:
- |
The maximum API version has been updated to ``1.85`` which allows the
``unhold`` provision state verb to be sent to Ironic.

View File

@ -94,6 +94,7 @@ openstack.baremetal.v1 =
baremetal_node_show = ironicclient.osc.v1.baremetal_node:ShowBaremetalNode
baremetal_node_trait_list = ironicclient.osc.v1.baremetal_node:ListTraitsBaremetalNode
baremetal_node_undeploy = ironicclient.osc.v1.baremetal_node:UndeployBaremetalNode
baremetal_node_unhold = ironicclient.osc.v1.baremetal_node:UnholdBaremetalNode
baremetal_node_unrescue = ironicclient.osc.v1.baremetal_node:UnrescueBaremetalNode
baremetal_node_unset = ironicclient.osc.v1.baremetal_node:UnsetBaremetalNode
baremetal_node_validate = ironicclient.osc.v1.baremetal_node:ValidateBaremetalNode