[PATCH] Rework udev_settle timeout handling (#544177)

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

 



1) centralize the setting of the timeout parameter inside the
udev_settle function. I do realize that the time needed for
initially scanning all disks is much larger, then the time for
scanning a single new partition when we are creating partitions.
But since this is a timeout, and udevadm settle will exit as soon
as the scanning is done, I see no reason not to have a single place
to configure the timeout assuming the worst case scenario (the initial
disk scan). This way we won't have these magic values sprinkled all
over the code.

2) Given that in the past we've had bugs filed
about anaconda taking many minutes to scan hardware on big iron machine
and that our initial udev settle call will scan all disks, I think
that udevadm's default timeout of 1 minutes is too low, so this patch
sets the timeout to 5 minutes.
---
 baseudev.py           |   11 ++++++-----
 storage/devices.py    |   18 +++++++++---------
 storage/devicetree.py |    2 +-
 storage/udev.py       |    2 +-
 4 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/baseudev.py b/baseudev.py
index d88d7fc..bda4fd6 100644
--- a/baseudev.py
+++ b/baseudev.py
@@ -61,7 +61,7 @@ def udev_get_device(sysfs_path):
     return dev
 
 def udev_get_devices(deviceClass="block"):
-    udev_settle(timeout=30)
+    udev_settle()
     entries = []
     for path in udev_enumerate_devices(deviceClass):
         entry = udev_get_device(path)
@@ -84,10 +84,11 @@ def udev_parse_uevent_file(dev):
 
     return dev
 
-def udev_settle(timeout=None):
-    argv = ["settle"]
-    if timeout:
-        argv.append("--timeout=%d" % int(timeout))
+def udev_settle():
+    # wait maximal 300 seconds for udev to be done running blkid, lvm,
+    # mdadm etc. This large timeout is needed when running on machines with
+    # lots of disks, or with slow disks
+    argv = ["settle", "--timeout=300"]
 
     iutil.execWithRedirect("udevadm", argv, stderr="/dev/null", searchPath=1)
 
diff --git a/storage/devices.py b/storage/devices.py
index 8db4d7c..22a4735 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -593,7 +593,7 @@ class StorageDevice(Device):
 
         if self.status and self.format.exists:
             self.format.teardown()
-            udev_settle(timeout=10)
+            udev_settle()
 
         if recursive:
             self.teardownParents(recursive=recursive)
@@ -1518,11 +1518,11 @@ class LUKSDevice(DMCryptDevice):
 
         if self.status and self.format.exists:
             self.format.teardown()
-            udev_settle(timeout=10)
+            udev_settle()
 
         if self.slave.format.exists:
             self.slave.format.teardown()
-            udev_settle(timeout=10)
+            udev_settle()
 
         if recursive:
             self.teardownParents(recursive=recursive)
@@ -1530,7 +1530,7 @@ class LUKSDevice(DMCryptDevice):
     def destroy(self):
         log_method_call(self, self.name, status=self.status)
         self.format.teardown()
-        udev_settle(timeout=10)
+        udev_settle()
         self.teardown()
 
     @property
@@ -2133,7 +2133,7 @@ class LVMLogicalVolumeDevice(DMDevice):
 
         if self.status and self.format.exists:
             self.format.teardown()
-            udev_settle(timeout=10)
+            udev_settle()
 
         if self.status:
             lvm.lvdeactivate(self.vg.name, self._name)
@@ -2199,7 +2199,7 @@ class LVMLogicalVolumeDevice(DMDevice):
         if self.format.exists:
             self.format.teardown()
 
-        udev_settle(timeout=10)
+        udev_settle()
         lvm.lvresize(self.vg.name, self._name, self.size)
 
 
@@ -2456,11 +2456,11 @@ class MDRaidArrayDevice(StorageDevice):
         device.addChild()
 
         device.setup()
-        udev_settle(timeout=10)
+        udev_settle()
         try:
             mdraid.mdadd(device.path, len(self.devices) < self.memberDevices)
             # mdadd causes udev events
-            udev_settle(timeout=10)
+            udev_settle()
         except MDRaidError as e:
             log.warning("failed to add member %s to md array %s: %s"
                         % (device.path, self.path, e))
@@ -2567,7 +2567,7 @@ class MDRaidArrayDevice(StorageDevice):
 
         if self.status and self.format.exists:
             self.format.teardown()
-            udev_settle(timeout=10)
+            udev_settle()
 
         # Since BIOS RAID sets (containers in mdraid terminology) never change
         # there is no need to stop them and later restart them. Not stopping
diff --git a/storage/devicetree.py b/storage/devicetree.py
index e4c1025..07aa6d6 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -734,7 +734,7 @@ class DeviceTree(object):
                     self.teardownAll()
                     action.execute(intf=self.intf)
 
-                udev_settle(timeout=10)
+                udev_settle()
                 for device in self._devices:
                     # make sure we catch any renumbering parted does
                     if device.exists and isinstance(device, PartitionDevice):
diff --git a/storage/udev.py b/storage/udev.py
index 5d4c778..3743c9f 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()
     entries = []
     for path in udev_enumerate_block_devices():
         entry = udev_get_block_device(path)
-- 
1.6.5.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux