Merge "Collect lsblk and /proc/mdstat with ramdisk logs"

This commit is contained in:
Zuul 2020-01-10 09:22:29 +00:00 committed by Gerrit Code Review
commit 12b62d6c3a
4 changed files with 16 additions and 2 deletions

View File

@ -305,6 +305,7 @@ def list_all_block_devices(block_type='disk',
"version of block device name is unavailable "
"Cause: %(error)s", {'path': disk_by_path_dir, 'error': e})
# NOTE(dtantsur): keep in sync with utils.LSBLK_COLUMNS
columns = ['KNAME', 'MODEL', 'SIZE', 'ROTA', 'TYPE']
report = utils.execute('lsblk', '-Pbia', '-o{}'.format(','.join(columns)),
check_exit_code=[0])[0]

View File

@ -527,7 +527,8 @@ class TestUtils(testtools.TestCase):
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})
'df': mock.ANY, 'iptables': mock.ANY, 'lshw': mock.ANY,
'lsblk': mock.ANY, 'mdstat': mock.ANY})
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
@mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@ -548,7 +549,8 @@ class TestUtils(testtools.TestCase):
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})
'dmesg': mock.ANY, 'df': mock.ANY, 'lshw': mock.ANY,
'lsblk': mock.ANY, 'mdstat': mock.ANY})
def test_get_ssl_client_options(self):
# defaults

View File

@ -51,12 +51,17 @@ LOG = logging.getLogger(__name__)
AGENT_PARAMS_CACHED = dict()
LSBLK_COLUMNS = ['KNAME', 'MODEL', 'SIZE', 'ROTA', 'TYPE', 'UUID', 'PARTUUID']
COLLECT_LOGS_COMMANDS = {
'ps': ['ps', 'au'],
'df': ['df', '-a'],
'iptables': ['iptables', '-L'],
'ip_addr': ['ip', 'addr'],
'lshw': ['lshw', '-quiet', '-json'],
'lsblk': ['lsblk', '--all', '-o%s' % ','.join(LSBLK_COLUMNS)],
'mdstat': ['cat', '/proc/mdstat'],
}
@ -394,6 +399,7 @@ def collect_system_logs(journald_max_lines=None):
the journald. if None, return everything.
:returns: A tar, gzip base64 encoded string with the logs.
"""
LOG.info('Collecting system logs and debugging information')
def try_get_command_output(io_dict, file_name, command):
try:

View File

@ -0,0 +1,5 @@
---
other:
- |
The output of ``lsblk`` and the contents of ``/proc/mdstat`` are now
collected with the ramdisk logs for debugging.