Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lvm: Improve error handling when parsing lines
Turns out that sudo may modify command output. One example seen with EL 7.6 is this /etc/pam.d/system-auth configuration: session required pam_lastlog.so showfailed With this configuration lvm command output includes unexpected "Last login" line: # sudo -n vgs --noheadings --separator "|" --units b Last login: Sat Dec 29 13:56:06 IST 2018 fedora_root|2|4|0|wz--n-|255525388288B|260046848B This breaks vdsm lvm command line parsing, and can break any other command run by sudo in unexpected ways, so we cannot support such configuration. However, the failure was logged in an unhelpful way: File "/usr/lib/python2.7/site-packages/vdsm/storage/lvm.py", line 389, in _reloadvgs pv_name = fields[pvNameIdx] IndexError: list index out of range To make it easier to debug such issues in the field, verify the number of fields when parsing lvm commands output lines, and raise a detailed exception showing the raw offending line. With this patch the error would be logged as: InvalidOutputLine: Invalid pvs command ouptut line: 'Last login: Sat Dec 29 14:42:39 IST 2018' Change-Id: I2acadf84cebaac6aed2f2739f371f2cf5c53d36d Bug-Url: https://bugzilla.redhat.com/1662449 Signed-off-by: Nir Soffer <[email protected]>
- Loading branch information