Return serialized node to the ramdisk

Implements: blueprint returning-to-ramdisk
Change-Id: I5536b2697416569aa3f7a5b969cfc5ef539db602
This commit is contained in:
Dmitry Tantsur 2014-12-04 14:47:09 +01:00
parent 9b1a164cfa
commit f43fecf394
3 changed files with 13 additions and 4 deletions

View File

@ -201,7 +201,12 @@ Change Log
v1.0.0
~~~~~~
* ``/v1/continue`` is now sync and errors are returned.
* ``/v1/continue`` is now sync:
* Errors are properly returned to the caller
* This call now returns value in form of ``{'node': <node dict>}`` on
success
* Option ``power_off_after_discovery`` controls whether to force power off
after the successful discovery, and is ``False`` by default.
* Discovery now times out by default.

View File

@ -80,7 +80,8 @@ def process(node_info):
raise utils.DiscoveryFailed('Node %s is not on discovery' % uuid,
code=403)
_process_node(ironic, node, node_info, valid_macs)
updated = _process_node(ironic, node, node_info, valid_macs)
return {'node': updated.to_dict()}
def _process_node(ironic, node, node_info, valid_macs):
@ -132,7 +133,7 @@ def _process_node(ironic, node, node_info, valid_macs):
patch = [{'op': 'add', 'path': '/extra/newly_discovered', 'value': 'true'},
{'op': 'remove', 'path': '/extra/on_discovery'}]
ironic.node.update(node.uuid, patch)
return ironic.node.update(node.uuid, patch)
def discover(uuids):

View File

@ -99,8 +99,11 @@ class TestProcess(BaseTest):
cli.node.get.return_value = self.node
post_mock.return_value = (['fake patch', 'fake patch 2'],
{'11:22:33:44:55:66': ['port patch']})
self.node.to_dict.return_value = self.data
cli.node.update.side_effect = [None, self.node]
discoverd.process(self.data)
res = discoverd.process(self.data)
self.assertEqual({'node': self.data}, res)
pop_mock.assert_called_once_with(bmc_address='1.2.3.4',
mac=ANY)