NVMe-oF: Remove misleading exception from logs
When disconnecting a non-replicated volume that uses the newer
connection properties format we'll get some exception trace logs that
could make us think that something went wrong, when in reality this is
ok.
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: DEBUG oslo.privsep.daemon [-] privsep: Exception during request[95eb2bcc-e4eb-4f5b-b823-56fd7aa338c6]: Unexpected error while running command.
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: Command: blkid /dev/nvme0n2 -s TYPE -o value
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: Exit code: 2
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: Stdout: ''
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: Stderr: '' {{(pid=988326) _process_cmd /usr/local/lib/python3.6/site-packages/oslo_privsep/daemon.py:481}}
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: Traceback (most recent call last):
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: File "/usr/local/lib/python3.6/site-packages/oslo_privsep/daemon.py", line 476, in _process_cmd
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: ret = func(*f_args, **f_kwargs)
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: File "/usr/local/lib/python3.6/site-packages/oslo_privsep/priv_context.py", line 274, in _wrap
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: return func(*args, **kwargs)
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: File "/opt/remote_brick/os_brick/privileged/rootwrap.py", line 197, in execute_root
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: return custom_execute(*cmd, shell=False, run_as_root=False, **kwargs)
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: File "/opt/remote_brick/os_brick/privileged/rootwrap.py", line 146, in custom_execute
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: on_completion=on_completion, *cmd, **kwargs)
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: File "/usr/local/lib/python3.6/site-packages/oslo_concurrency/processutils.py", line 441, in execute
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: cmd=sanitized_cmd)
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: oslo_concurrency.processutils.ProcessExecutionError: Unexpected error while running command.
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: Command: blkid /dev/nvme0n2 -s TYPE -o value
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: Exit code: 2
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: Stdout: ''
Mar 09 11:14:42 localhost.localdomain nova-compute[988198]: Stderr: ''
This patch calls the command execution in a way that no longer shows
such exception.
Closes-Bug: #1964389
Change-Id: I1c54e1ff3026cffe49b303f01e43d1b90d0bf3bc
This commit is contained in:
@@ -847,16 +847,13 @@ class NVMeOFConnector(base.BaseLinuxConnector):
|
||||
raise exception.CommandExecutionFailed(e, cmd=nvme_command)
|
||||
|
||||
def _get_fs_type(self, device_path):
|
||||
cmd = ['blkid', device_path, '-s', 'TYPE', '-o', 'value']
|
||||
cmd = ('blkid', device_path, '-s', 'TYPE', '-o', 'value')
|
||||
LOG.debug("[!] cmd = " + str(cmd))
|
||||
fs_type = None
|
||||
|
||||
try:
|
||||
# We don't care about errors, on error lines will be '' so it's ok
|
||||
lines, err = self._execute(
|
||||
*cmd, run_as_root=True, root_helper=self._root_helper)
|
||||
|
||||
*cmd, run_as_root=True, root_helper=self._root_helper,
|
||||
check_exit_code=False)
|
||||
fs_type = lines.split('\n')[0]
|
||||
except putils.ProcessExecutionError:
|
||||
return None
|
||||
|
||||
return fs_type
|
||||
return fs_type or None
|
||||
|
||||
@@ -991,19 +991,15 @@ class NVMeOFConnectorTestCase(test_connector.ConnectorTestCase):
|
||||
result = self.connector.ks_readlink(dest)
|
||||
self.assertEqual('', result)
|
||||
|
||||
@mock.patch.object(executor.Executor, '_execute')
|
||||
@mock.patch.object(executor.Executor, '_execute',
|
||||
return_value=('', 'There was a big error'))
|
||||
def test_get_fs_type_err(self, mock_execute):
|
||||
mock_execute.side_effect = putils.ProcessExecutionError()
|
||||
result = self.connector._get_fs_type(NVME_DEVICE_PATH)
|
||||
self.assertIsNone(result)
|
||||
cmd = ['blkid', NVME_DEVICE_PATH, '-s', 'TYPE', '-o', 'value']
|
||||
args, kwargs = mock_execute.call_args
|
||||
self.assertEqual(args[0], cmd[0])
|
||||
self.assertEqual(args[1], cmd[1])
|
||||
self.assertEqual(args[2], cmd[2])
|
||||
self.assertEqual(args[3], cmd[3])
|
||||
self.assertEqual(args[4], cmd[4])
|
||||
self.assertEqual(args[5], cmd[5])
|
||||
mock_execute.assert_called_once_with(
|
||||
'blkid', NVME_DEVICE_PATH, '-s', 'TYPE', '-o', 'value',
|
||||
run_as_root=True, root_helper=self.connector._root_helper,
|
||||
check_exit_code=False)
|
||||
|
||||
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
|
||||
def test__is_nvme_available(self, mock_nvme_devices):
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
NVMe-oF connector `bug #1964389
|
||||
<https://bugs.launchpad.net/os-brick/+bug/1964389>`_: Fixed showing
|
||||
misleading traceback.
|
||||
Reference in New Issue
Block a user