Add node name to ironic-conductor ramdisk log filename

Change-Id: Ide28c16806909f1bbf93bf7c72b5cec6f8ddc260
Story: #2008281
Task: #41155
This commit is contained in:
dujinxiu 2020-10-24 11:50:30 +08:00
parent 5e68f79102
commit da4c583ea9
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')
file_name_fields = [node.uuid]
if node.name:
file_name_fields.append(node.name)
if 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')
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(agent_client.AgentClient,
'collect_system_logs', autospec=True)

View File

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