Add logging to introspection data storage
Adds logging messages for storing the introspection data. Change-Id: I2b77bd630ba07e4bb9f0746e24a17bebf4f8f6d5 Co-Authored-By: Dmitry Tantsur <dtantsur@redhat.com>
This commit is contained in:
parent
4484b1fc17
commit
d7447b3f9e
|
@ -209,6 +209,14 @@ def init():
|
|||
LOG.warning(_LW('Starting unauthenticated, please check'
|
||||
' configuration'))
|
||||
|
||||
if CONF.processing.store_data == 'none':
|
||||
LOG.warning(_LW('Introspection data will not be stored. Change '
|
||||
'"[processing] store_data" option if this is not the '
|
||||
'desired behavior'))
|
||||
elif CONF.processing.store_data == 'swift':
|
||||
LOG.info(_LI('Introspection data will be stored in Swift in the '
|
||||
'container %s'), CONF.swift.container)
|
||||
|
||||
db.init()
|
||||
|
||||
try:
|
||||
|
|
|
@ -148,12 +148,17 @@ def _process_node(ironic, node, introspection_data, node_info):
|
|||
if CONF.processing.store_data == 'swift':
|
||||
swift_object_name = swift.store_introspection_data(introspection_data,
|
||||
node_info.uuid)
|
||||
LOG.info(_LI('Introspection data for node %(node)s was stored in '
|
||||
'Swift in object %(obj)s'),
|
||||
{'node': node_info.uuid, 'obj': swift_object_name})
|
||||
if CONF.processing.store_data_location:
|
||||
node_patches.append({'op': 'add',
|
||||
'path': '/extra/%s' %
|
||||
CONF.processing.store_data_location,
|
||||
'value': swift_object_name})
|
||||
|
||||
else:
|
||||
LOG.debug('Swift support is disabled, introspection data for node %s '
|
||||
'won\'t be stored', node_info.uuid)
|
||||
node = ironic.node.update(node.uuid, node_patches)
|
||||
for mac, patches in port_patches.items():
|
||||
port = node_info.ports(ironic)[mac]
|
||||
|
|
|
@ -308,6 +308,26 @@ class TestInit(test_base.BaseTest):
|
|||
main.init()
|
||||
self.assertFalse(mock_auth.called)
|
||||
|
||||
@mock.patch.object(main.LOG, 'warning')
|
||||
def test_init_with_no_data_storage(self, mock_log, mock_node_cache,
|
||||
mock_get_client, mock_auth,
|
||||
mock_firewall, mock_spawn_n):
|
||||
msg = ('Introspection data will not be stored. Change '
|
||||
'"[processing] store_data" option if this is not the '
|
||||
'desired behavior')
|
||||
main.init()
|
||||
mock_log.assert_called_once_with(msg)
|
||||
|
||||
@mock.patch.object(main.LOG, 'info')
|
||||
def test_init_with_swift_storage(self, mock_log, mock_node_cache,
|
||||
mock_get_client, mock_auth,
|
||||
mock_firewall, mock_spawn_n):
|
||||
CONF.set_override('store_data', 'swift', 'processing')
|
||||
msg = mock.call('Introspection data will be stored in Swift in the '
|
||||
'container %s', CONF.swift.container)
|
||||
main.init()
|
||||
self.assertIn(msg, mock_log.call_args_list)
|
||||
|
||||
def test_init_without_manage_firewall(self, mock_node_cache,
|
||||
mock_get_client, mock_auth,
|
||||
mock_firewall, mock_spawn_n):
|
||||
|
|
Loading…
Reference in New Issue