summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2022-04-29 14:23:22 +0200
committerIury Gregory Melo Ferreira <imelofer@redhat.com>2022-06-05 18:24:23 +0200
commitc674e567fc3fbf0976b1310763be88ad5a11f7e4 (patch)
treedae379a0062bdb14b7eba48ce86321ca79accc8b
parent88fbdcf0b089b2514a7e5a3b7f581d91868050de (diff)
downloadironic-python-agent-c674e567fc3fbf0976b1310763be88ad5a11f7e4.tar.gz
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 424e649bed3db5d1129b18b7ea4dfba88d552537) (cherry picked from commit bc74df8bfe89f703880f8a545ce939e9b1cd8651)
-rw-r--r--ironic_python_agent/tests/unit/test_utils.py16
-rw-r--r--ironic_python_agent/utils.py1
-rw-r--r--releasenotes/notes/lsblk-all-956c1df808a169bf.yaml5
3 files changed, 10 insertions, 12 deletions
diff --git a/ironic_python_agent/tests/unit/test_utils.py b/ironic_python_agent/tests/unit/test_utils.py
index 96d31688..bb6a6f79 100644
--- a/ironic_python_agent/tests/unit/test_utils.py
+++ b/ironic_python_agent/tests/unit/test_utils.py
@@ -429,9 +429,7 @@ class TestUtils(ironic_agent_base.IronicAgentTest):
mock_outputs.assert_has_calls(calls, any_order=True)
mock_gzip_b64.assert_called_once_with(
file_list=[],
- io_dict={'journal': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
- 'df': mock.ANY, 'iptables': mock.ANY, 'lshw': mock.ANY,
- 'lsblk': mock.ANY, 'mdstat': mock.ANY})
+ io_dict=mock.ANY)
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -456,9 +454,7 @@ class TestUtils(ironic_agent_base.IronicAgentTest):
mock_outputs.assert_has_calls(calls, any_order=True)
mock_gzip_b64.assert_called_once_with(
file_list=[tmp.name],
- io_dict={'journal': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
- 'df': mock.ANY, 'iptables': mock.ANY, 'lshw': mock.ANY,
- 'lsblk': mock.ANY, 'mdstat': mock.ANY})
+ io_dict=mock.ANY)
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -478,9 +474,7 @@ class TestUtils(ironic_agent_base.IronicAgentTest):
mock_outputs.assert_has_calls(calls, any_order=True)
mock_gzip_b64.assert_called_once_with(
file_list=['/var/log'],
- io_dict={'iptables': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
- 'dmesg': mock.ANY, 'df': mock.ANY, 'lshw': mock.ANY,
- 'lsblk': mock.ANY, 'mdstat': mock.ANY})
+ io_dict=mock.ANY)
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -504,9 +498,7 @@ class TestUtils(ironic_agent_base.IronicAgentTest):
mock_outputs.assert_has_calls(calls, any_order=True)
mock_gzip_b64.assert_called_once_with(
file_list=['/var/log', tmp.name],
- io_dict={'iptables': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
- 'dmesg': mock.ANY, 'df': mock.ANY, 'lshw': mock.ANY,
- 'lsblk': mock.ANY, 'mdstat': mock.ANY})
+ io_dict=mock.ANY)
def test_get_ssl_client_options(self):
# defaults
diff --git a/ironic_python_agent/utils.py b/ironic_python_agent/utils.py
index 71e29d16..2d9338a1 100644
--- a/ironic_python_agent/utils.py
+++ b/ironic_python_agent/utils.py
@@ -68,6 +68,7 @@ COLLECT_LOGS_COMMANDS = {
'ip_addr': ['ip', 'addr'],
'lshw': ['lshw', '-quiet', '-json'],
'lsblk': ['lsblk', '--all', '-o%s' % ','.join(LSBLK_COLUMNS)],
+ 'lsblk-full': ['lsblk', '--all', '--bytes', '--output-all', '--pairs'],
'mdstat': ['cat', '/proc/mdstat'],
}
diff --git a/releasenotes/notes/lsblk-all-956c1df808a169bf.yaml b/releasenotes/notes/lsblk-all-956c1df808a169bf.yaml
new file mode 100644
index 00000000..d237f834
--- /dev/null
+++ b/releasenotes/notes/lsblk-all-956c1df808a169bf.yaml
@@ -0,0 +1,5 @@
+---
+other:
+ - |
+ The ramdisk logs now contain an ``lsblk`` output with all pairs in the new
+ ``lsblk-full`` file.