Add set_provision_state to the client libs
The commit https://review.openstack.org/#/c/61160/ exposes in the Ironic API a way to trigger the provisioning of a node. This patch add this functionality on the client libraries (Not exposed on the CLI). Change-Id: I8c0f339f2c76c153ecba961d0ca411d438c21ceb
This commit is contained in:
parent
77cb336292
commit
50f0b607aa
ironicclient
@ -136,6 +136,13 @@ fake_responses = {
|
||||
DRIVER_IFACES,
|
||||
),
|
||||
},
|
||||
'/v1/nodes/%s/states/provision' % NODE1['uuid']:
|
||||
{
|
||||
'PUT': (
|
||||
{},
|
||||
None,
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -246,3 +253,12 @@ class NodeManagerTest(testtools.TestCase):
|
||||
self.assertEqual(DRIVER_IFACES['deploy'], ifaces.deploy)
|
||||
self.assertEqual(DRIVER_IFACES['rescue'], ifaces.rescue)
|
||||
self.assertEqual(DRIVER_IFACES['console'], ifaces.console)
|
||||
|
||||
def test_node_set_provision_state(self):
|
||||
target_state = 'active'
|
||||
self.mgr.set_provision_state(NODE1['uuid'], target_state)
|
||||
body = {'target': target_state}
|
||||
expect = [
|
||||
('PUT', '/v1/nodes/%s/states/provision' % NODE1['uuid'], {}, body),
|
||||
]
|
||||
self.assertEqual(expect, self.api.calls)
|
||||
|
@ -89,3 +89,8 @@ class NodeManager(base.Manager):
|
||||
def validate(self, node_uuid):
|
||||
path = "%s/validate" % node_uuid
|
||||
return self.get(path)
|
||||
|
||||
def set_provision_state(self, node_uuid, state):
|
||||
path = "%s/states/provision" % node_uuid
|
||||
target = {'target': state}
|
||||
return self._update(self._path(path), target, method='PUT')
|
||||
|
Loading…
x
Reference in New Issue
Block a user