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

[master] Increment the time we wait for all the block devices to initialize and empty the udev queue (#533047).



This is because a case with LVM devices on ATA disks was found where it took up
to 35 seconds for udev to settle.
---
 baseudev.py     |   13 ++++++++++++-
 storage/udev.py |    2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/baseudev.py b/baseudev.py
index d88d7fc..fefd315 100644
--- a/baseudev.py
+++ b/baseudev.py
@@ -86,11 +86,22 @@ def udev_parse_uevent_file(dev):
 
 def udev_settle(timeout=None):
     argv = ["settle"]
-    if timeout:
+    if timeout is not None:
         argv.append("--timeout=%d" % int(timeout))
 
     iutil.execWithRedirect("udevadm", argv, stderr="/dev/null", searchPath=1)
 
+def udev_settle_incremental():
+    def run_while_output(cmd, argv):
+        out = iutil.execWithCapture(cmd, argv, stderr="/dev/null")
+        while len(out) > 0:
+            out = iutil.execWithCapture(cmd, argv, stderr="/dev/null")
+
+    timeout = 5;
+    argv = ["settle"]
+    argv.append("--timeout=%d" % int(timeout))
+    run_while_output("udevadm", argv);
+
 def udev_trigger(subsystem=None, action="add"):
     argv = ["trigger", "--action=%s" % action]
     if subsystem:
diff --git a/storage/udev.py b/storage/udev.py
index 5d4c778..39c6a27 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -77,7 +77,7 @@ def udev_resolve_glob(glob):
     return ret
 
 def udev_get_block_devices():
-    udev_settle(timeout=30)
+    udev_settle_incremental()
     entries = []
     for path in udev_enumerate_block_devices():
         entry = udev_get_block_device(path)
-- 
1.6.2.5


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