[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 4/6] Don't scan stopped md devices



mdraid is really braindead, when a device is stopped
it is no longer usefull in anyway (and we should not
probe it) yet it still sticks around, see bug rh523387
---
 storage/udev.py |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/storage/udev.py b/storage/udev.py
index f6347d5..f07b3ca 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -60,6 +60,16 @@ def udev_get_block_devices():
     for path in udev_enumerate_block_devices():
         entry = udev_get_block_device(path)
         if entry:
+            if entry["name"].startswith("md"):
+                # mdraid is really braindead, when a device is stopped
+                # it is no longer usefull in anyway (and we should not
+                # probe it) yet it still sticks around, see bug rh523387
+                state = None
+                state_file = "/sys/%s/md/array_state" % entry["sysfs_path"]
+                if os.access(state_file, os.R_OK):
+                    state = open(state_file).read().strip()
+                if state == "clear":
+                    continue
             entries.append(entry)
     return entries
 
-- 
1.6.4.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]