From 7297046bdeb98449f4b224d13548ea97aa411aad Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Tue, 21 Jul 2020 13:26:40 +0200 Subject: [PATCH] Ignore devices marked as hidden in sysfs(#1856974) NVMe multipath devices have a special internal hidden devices that are visible in /sys/block but not directly usable so we should ignore these as well as all devices with the hidden attribute. Reference:https://github.com/storaged-project/blivet/commit/8957eb1f82a37542ea1ae3990b6068b3cf90a3be Conflict:NA --- blivet/populator/populator.py | 3 +++ blivet/udev.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py index 465c272..1d6daa6 100644 --- a/blivet/populator/populator.py +++ b/blivet/populator/populator.py @@ -247,6 +247,9 @@ class PopulatorMixin(object): return log.info("scanning %s (%s)...", name, sysfs_path) + if udev.device_is_hidden(info): + log.info("device %s is marked as hidden in sysfs, ignoring") + return # make sure we note the name of every device we see self._add_name(name) diff --git a/blivet/udev.py b/blivet/udev.py index c85eb3d..8b3fc58 100644 --- a/blivet/udev.py +++ b/blivet/udev.py @@ -999,3 +999,9 @@ def device_is_nvdimm_namespace(info): devname = info.get("DEVNAME", "") ninfo = blockdev.nvdimm_namespace_get_devname(devname) return ninfo is not None + + +def device_is_hidden(info): + sysfs_path = device_get_sysfs_path(info) + hidden = util.get_sysfs_attr(sysfs_path, "hidden") + return bool(hidden) -- 2.27.0