Add config to skip power off after introspection

This adds configuration option 'processing.power_off'
defaulting to True, which will prevent powering off the
node after introspection

Change-Id: I16eb6b73fd57e84175bbce81c79e432ed8d1d3fa
Closes-Bug: #1488534
This commit is contained in:
Zhenguo Niu 2016-07-19 19:42:50 +08:00
parent 4735ab87f3
commit a97c8cb6a3
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.