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:
Lucas Alvares Gomes 2013-12-11 10:55:35 +00:00
parent 77cb336292
commit 50f0b607aa
2 changed files with 21 additions and 0 deletions
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')