[PATCH] (take II) Update format of cdrom devices when looking for repos on media (#566269)

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

 



This is needed when repo location is changed to CD/DVD in repo UI
and the media was inserted after last storage population (e.g.
just during repo UI step).

Second take, using iutil.notify_kernel rather then udev_trigger,
with logging added - as Dave Lehman suggested. It's tested.

---
 image.py              |    1 +
 storage/devicetree.py |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/image.py b/image.py
index e15de12..60f03aa 100644
--- a/image.py
+++ b/image.py
@@ -257,6 +257,7 @@ def scanForMedia(tree, storage):
         if dev.type != "cdrom":
             continue
 
+        storage.devicetree.updateDeviceFormat(dev)
         try:
             dev.format.mount(mountpoint=tree)
         except:
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 386d23f..fd3613d 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -37,6 +37,7 @@ import devicelibs.lvm
 import devicelibs.mpath
 from udev import *
 from .storage_log import log_method_call
+import iutil
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -1780,6 +1781,15 @@ class DeviceTree(object):
         elif device.format.type == "multipath_member":
             self.handleMultipathMemberFormat(info, device)
 
+    def updateDeviceFormat(self, device):
+        log.debug("updating format of device: %s" % device)
+        iutil.notify_kernel("/sys%s" % device.sysfsPath)
+        udev_settle()
+        info = udev_get_device(device.sysfsPath)
+        self.handleUdevDeviceFormat(info, device)
+        if device.format.type:
+            log.debug("got format: %s" % device.format)
+
     def _handleInconsistencies(self):
         def reinitializeVG(vg):
             # First we remove VG data
-- 
1.6.0.6

_______________________________________________
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