[PATCH 3/3] Handle already mounted optical devices (#851274)

Jesse Keating jkeating at redhat.com
Mon Aug 27 23:57:40 UTC 2012


This prevents trying to mount the device a second time.  If it's already
mounted, and is a valid source of repodata, use it from the path it's
already mounted on.  Otherwise go ahead and mount the selected optical
drive where we want it.
---
 pyanaconda/packaging/yumpayload.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 0a2d126..19b1a2f 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -492,6 +492,10 @@ reposdir=%s
                 while method.dir.startswith("/"):
                     # riduculous
                     method.dir = method.dir[1:]
+        # Check to see if the device is already mounted, in which case
+        # we don't need to mount it again
+        elif method.method == "cdrom" and get_mount_paths(device.path):
+                return
         else:
             device.format.setup(mountpoint=INSTALL_TREE)
 
@@ -555,20 +559,21 @@ reposdir=%s
         elif method.method == "cdrom" or not method.method:
             # Did dracut leave the DVD mounted for us?
             device = get_mount_device("/run/install/repo")
-            if device:
+            # Only look at the dracut mount if we don't already have a cdrom
+            if device and not self.install_device:
                 self.install_device = storage.devicetree.getDeviceByPath(device)
                 url = "file:///run/install/repo"
                 if not method.method:
                     method.method = "cdrom"
             else:
                 # cdrom or no method specified -- check for media
-                device = opticalInstallMedia(storage.devicetree)
-                if device:
-                    self._setUpMedia(device)
-                    self.install_device = device
-                    url = "file://" + INSTALL_TREE
+                if not self.install_device:
+                    self.install_device = opticalInstallMedia(storage.devicetree)
+                if self.install_device:
                     if not method.method:
                         method.method = "cdrom"
+                    self._setUpMedia(self.install_device)
+                    url = "file://" + INSTALL_TREE
                 elif method.method == "cdrom":
                     raise PayloadSetupError("no usable optical media found")
 
-- 
1.7.11.2



More information about the anaconda-patches mailing list