[PATCH] Fix a bug when switching back to an HDISO install source (#879612).
Chris Lumens
clumens at redhat.com
Tue Dec 4 21:33:54 UTC 2012
Basically, _setupDevice gets confused when there's a symlink involved in the
path and /proc/mounts does not match what we expect. Thus, just make sure
we resolve symlinks to their real path before feeding them to get_mount_device.
Also, don't print some mount-related log messages if they'd say something like
"None is already mounted".
---
pyanaconda/packaging/__init__.py | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index e9a5da1..f724088 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -132,7 +132,9 @@ def get_mount_device(mountpoint):
log.debug("found backing file %s for loop device %s" % (mount_device,
loop_name))
- log.debug("%s is mounted on %s" % (mount_device, mountpoint))
+ if mount_device:
+ log.debug("%s is mounted on %s" % (mount_device, mountpoint))
+
return mount_device
class Payload(object):
@@ -465,14 +467,21 @@ class Payload(object):
""" Prepare an install CD/DVD for use as a package source. """
log.info("setting up device %s and mounting on %s" % (device.name,
mountpoint))
- if os.path.ismount(mountpoint):
- mdev = get_mount_device(mountpoint)
- log.warning("%s is already mounted on %s" % (mdev, mountpoint))
+ # Is there a symlink involved? If so, let's get the actual path.
+ # This is to catch /run/install/isodir vs. /mnt/install/isodir, for
+ # instance.
+ realMountpoint = os.path.realpath(mountpoint)
+
+ if os.path.ismount(realMountpoint):
+ mdev = get_mount_device(realMountpoint)
+ if mdev:
+ log.warning("%s is already mounted on %s" % (mdev, mountpoint))
+
if mdev == device.path:
return
else:
try:
- isys.umount(mountpoint, removeDir=False)
+ isys.umount(realMountpoint, removeDir=False)
except Exception as e:
log.error(str(e))
log.info("umount failed -- mounting on top of it")
--
1.7.11.2
More information about the anaconda-patches
mailing list