diff options
-rw-r--r-- | sos/plugins/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 598cc127..7bb8d2e8 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -852,6 +852,25 @@ class Plugin(object): self._log_debug("collecting journal: %s" % journal_cmd) self._add_cmd_output(journal_cmd, None, None, timeout) + def add_udev_info(self, device, attrs=False): + """Collect udevadm info output for a given device + + :param device: A string or list of strings of device names or sysfs + paths. E.G. either '/sys/class/scsi_host/host0' or + '/dev/sda' is valid. + :param attrs: If True, run udevadm with the --attribute-walk option. + """ + udev_cmd = 'udevadm info' + if attrs: + udev_cmd += ' -a' + + if isinstance(device, six.string_types): + device = [device] + + for dev in device: + self._log_debug("collecting udev info for: %s" % dev) + self._add_cmd_output('%s %s' % (udev_cmd, dev)) + def _expand_copy_spec(self, copyspec): return glob.glob(copyspec) |