Skip to content

Commit 424e649

Browse files
committed
Collect a full lsblk output in the ramdisk logs
The existing lsblk call is very handy for an overview, but there a lot more useful pairs to collect. Collect them in a machine-readable format to be able to use in debugging and further development. Change-Id: Ib27843524421944ee93de975d275e93276a5597a
1 parent 8111475 commit 424e649

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

ironic_python_agent/tests/unit/test_utils.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,7 @@ def test_collect_system_logs_journald(
429429
mock_outputs.assert_has_calls(calls, any_order=True)
430430
mock_gzip_b64.assert_called_once_with(
431431
file_list=[],
432-
io_dict={'journal': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
433-
'df': mock.ANY, 'iptables': mock.ANY, 'lshw': mock.ANY,
434-
'lsblk': mock.ANY, 'mdstat': mock.ANY,
435-
'mount': mock.ANY, 'parted': mock.ANY})
432+
io_dict=mock.ANY)
436433

437434
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
438435
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -457,10 +454,7 @@ def test_collect_system_logs_journald_with_logfile(
457454
mock_outputs.assert_has_calls(calls, any_order=True)
458455
mock_gzip_b64.assert_called_once_with(
459456
file_list=[tmp.name],
460-
io_dict={'journal': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
461-
'df': mock.ANY, 'iptables': mock.ANY, 'lshw': mock.ANY,
462-
'lsblk': mock.ANY, 'mdstat': mock.ANY,
463-
'mount': mock.ANY, 'parted': mock.ANY})
457+
io_dict=mock.ANY)
464458

465459
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
466460
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -480,10 +474,7 @@ def test_collect_system_logs_non_journald(
480474
mock_outputs.assert_has_calls(calls, any_order=True)
481475
mock_gzip_b64.assert_called_once_with(
482476
file_list=['/var/log'],
483-
io_dict={'iptables': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
484-
'dmesg': mock.ANY, 'df': mock.ANY, 'lshw': mock.ANY,
485-
'lsblk': mock.ANY, 'mdstat': mock.ANY,
486-
'mount': mock.ANY, 'parted': mock.ANY})
477+
io_dict=mock.ANY)
487478

488479
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
489480
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -507,10 +498,7 @@ def test_collect_system_logs_non_journald_with_logfile(
507498
mock_outputs.assert_has_calls(calls, any_order=True)
508499
mock_gzip_b64.assert_called_once_with(
509500
file_list=['/var/log', tmp.name],
510-
io_dict={'iptables': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
511-
'dmesg': mock.ANY, 'df': mock.ANY, 'lshw': mock.ANY,
512-
'lsblk': mock.ANY, 'mdstat': mock.ANY,
513-
'mount': mock.ANY, 'parted': mock.ANY})
501+
io_dict=mock.ANY)
514502

515503
def test_get_ssl_client_options(self):
516504
# defaults

ironic_python_agent/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
'ip_addr': ['ip', 'addr'],
6969
'lshw': ['lshw', '-quiet', '-json'],
7070
'lsblk': ['lsblk', '--all', '-o%s' % ','.join(LSBLK_COLUMNS)],
71+
'lsblk-full': ['lsblk', '--all', '--bytes', '--output-all', '--pairs'],
7172
'mdstat': ['cat', '/proc/mdstat'],
7273
'mount': ['mount'],
7374
'parted': ['parted', '-l'],
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
other:
3+
- |
4+
The ramdisk logs now contain an ``lsblk`` output with all pairs in the new
5+
``lsblk-full`` file.

0 commit comments

Comments
 (0)