Merge "Add config to skip power off after introspection"

This commit is contained in:
Jenkins 2016-07-21 09:35:52 +00:00 committed by Gerrit Code Review
commit 17bf9f5b1f
5 changed files with 20 additions and 1 deletions

View File

@ -803,6 +803,9 @@
# {mac} - PXE booting MAC or "unknown". (string value)
#ramdisk_logs_filename_format = {uuid}_{dt:%Y%m%d-%H%M%S.%f}.tar.gz
# Whether to power off a node after introspection. (boolean value)
#power_off = true
[swift]

View File

@ -137,6 +137,9 @@ PROCESSING_OPTS = [
'{bmc} - node BMC address or "unknown", '
'{dt} - current UTC date and time, '
'{mac} - PXE booting MAC or "unknown".'),
cfg.BoolOpt('power_off',
default=True,
help='Whether to power off a node after introspection.'),
]

View File

@ -281,7 +281,8 @@ def _process_node(node, introspection_data, node_info):
resp['ipmi_username'] = new_username
resp['ipmi_password'] = new_password
else:
utils.executor().submit(_finish, ironic, node_info, introspection_data)
utils.executor().submit(_finish, ironic, node_info, introspection_data,
power_off=CONF.processing.power_off)
return resp

View File

@ -478,6 +478,14 @@ class TestProcessNode(BaseTest):
self.assertTrue(self.cli.node.set_power_state.called)
finished_mock.assert_called_once_with(self.node_info)
@mock.patch.object(node_cache.NodeInfo, 'finished', autospec=True)
def test_no_power_off(self, finished_mock):
CONF.set_override('power_off', False, 'processing')
process._process_node(self.node, self.data, self.node_info)
self.assertFalse(self.cli.node.set_power_state.called)
finished_mock.assert_called_once_with(self.node_info)
@mock.patch.object(process.swift, 'SwiftAPI', autospec=True)
def test_store_data(self, swift_mock):
CONF.set_override('store_data', 'swift', 'processing')

View File

@ -0,0 +1,4 @@
---
features:
- Add configuration option `processing.power_off` defaulting to True,
which allows to leave nodes powered on after introspection.