Merge "Add node name to ironic-conductor ramdisk log filename"

This commit is contained in:
Zuul 2020-11-03 15:57:31 +00:00 committed by Gerrit Code Review
commit 08bf8dee65
3 changed files with 15 additions and 0 deletions

View File

@ -272,6 +272,9 @@ def get_ramdisk_logs_file_name(node, label=None):
""" """
timestamp = timeutils.utcnow().strftime('%Y-%m-%d-%H-%M-%S') timestamp = timeutils.utcnow().strftime('%Y-%m-%d-%H-%M-%S')
file_name_fields = [node.uuid] file_name_fields = [node.uuid]
if node.name:
file_name_fields.append(node.name)
if node.instance_uuid: if node.instance_uuid:
file_name_fields.append(node.instance_uuid) file_name_fields.append(node.instance_uuid)

View File

@ -245,6 +245,14 @@ class UtilsRamdiskLogsTestCase(tests_base.TestCase):
+ instance_uuid + '_2000-01-01-00-00-00.tar.gz') + instance_uuid + '_2000-01-01-00-00-00.tar.gz')
self.assertEqual(expected_name, name) self.assertEqual(expected_name, name)
# with name
node_name = 'foo'
node3 = obj_utils.get_test_node(self.context, name=node_name)
name = driver_utils.get_ramdisk_logs_file_name(node3)
expected_name = ('1be26c0b-03f2-4d2e-ae87-c02d7f33c123_'
+ node_name + '_2000-01-01-00-00-00.tar.gz')
self.assertJsonEqual(expected_name, name)
@mock.patch.object(driver_utils, 'store_ramdisk_logs', autospec=True) @mock.patch.object(driver_utils, 'store_ramdisk_logs', autospec=True)
@mock.patch.object(agent_client.AgentClient, @mock.patch.object(agent_client.AgentClient,
'collect_system_logs', autospec=True) 'collect_system_logs', autospec=True)

View File

@ -0,0 +1,4 @@
---
features:
- |
The ramdisk log filename will contain the node name when it exists.