Skip to content

Commit 345d459

Browse files
dtantsurelfosardo
authored andcommitted
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 (cherry picked from commit 424e649) (cherry picked from commit bc74df8)
1 parent 3aa5928 commit 345d459

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

ironic_python_agent/tests/unit/test_utils.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,7 @@ def test_collect_system_logs_journald(
442442
mock_outputs.assert_has_calls(calls, any_order=True)
443443
mock_gzip_b64.assert_called_once_with(
444444
file_list=[],
445-
io_dict={'journal': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
446-
'df': mock.ANY, 'iptables': mock.ANY, 'lshw': mock.ANY,
447-
'lsblk': mock.ANY, 'mdstat': mock.ANY})
445+
io_dict=mock.ANY)
448446

449447
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
450448
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -469,9 +467,7 @@ def test_collect_system_logs_journald_with_logfile(
469467
mock_outputs.assert_has_calls(calls, any_order=True)
470468
mock_gzip_b64.assert_called_once_with(
471469
file_list=[tmp.name],
472-
io_dict={'journal': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
473-
'df': mock.ANY, 'iptables': mock.ANY, 'lshw': mock.ANY,
474-
'lsblk': mock.ANY, 'mdstat': mock.ANY})
470+
io_dict=mock.ANY)
475471

476472
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
477473
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -491,9 +487,7 @@ def test_collect_system_logs_non_journald(
491487
mock_outputs.assert_has_calls(calls, any_order=True)
492488
mock_gzip_b64.assert_called_once_with(
493489
file_list=['/var/log'],
494-
io_dict={'iptables': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
495-
'dmesg': mock.ANY, 'df': mock.ANY, 'lshw': mock.ANY,
496-
'lsblk': mock.ANY, 'mdstat': mock.ANY})
490+
io_dict=mock.ANY)
497491

498492
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
499493
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -517,9 +511,7 @@ def test_collect_system_logs_non_journald_with_logfile(
517511
mock_outputs.assert_has_calls(calls, any_order=True)
518512
mock_gzip_b64.assert_called_once_with(
519513
file_list=['/var/log', tmp.name],
520-
io_dict={'iptables': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
521-
'dmesg': mock.ANY, 'df': mock.ANY, 'lshw': mock.ANY,
522-
'lsblk': mock.ANY, 'mdstat': mock.ANY})
514+
io_dict=mock.ANY)
523515

524516
def test_get_ssl_client_options(self):
525517
# defaults

ironic_python_agent/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
'ip_addr': ['ip', 'addr'],
7070
'lshw': ['lshw', '-quiet', '-json'],
7171
'lsblk': ['lsblk', '--all', '-o%s' % ','.join(LSBLK_COLUMNS)],
72+
'lsblk-full': ['lsblk', '--all', '--bytes', '--output-all', '--pairs'],
7273
'mdstat': ['cat', '/proc/mdstat'],
7374
}
7475

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)