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

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



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).
---
 image.py              |    1 +
 storage/devicetree.py |    7 +++++++
 2 files changed, 8 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..e091fc1 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1280,6 +1280,7 @@ class DeviceTree(object):
         if device.format.type:
             log.debug("got format: %s" % device.format)
 
+
     def handleUdevDiskLabelFormat(self, info, device):
         log_method_call(self, device=device.name)
         if device.partitioned:
@@ -1780,6 +1781,12 @@ class DeviceTree(object):
         elif device.format.type == "multipath_member":
             self.handleMultipathMemberFormat(info, device)
 
+    def updateDeviceFormat(self, device):
+        udev_trigger(subsystem="block")
+        udev_settle()
+        info = udev_get_device(device.sysfsPath)
+        self.handleUdevDeviceFormat(info, device)
+
     def _handleInconsistencies(self):
         def reinitializeVG(vg):
             # First we remove VG data
-- 
1.6.0.6


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