[PATCH 2/2] Added format.mountvisible flag.
Jan Safranek
jsafrane at redhat.com
Tue Apr 23 14:10:57 UTC 2013
The flag tells, if the mount is visible or it is replaced by another mount.
Typically, on a F19 there is 'rootfs' mounted at '/' during boot, and later
the real device is mounted there too. /proc/mounts then shows:
rootfs / rootfs rw 0 0
/dev/vda2 / ext4 rw,seclabel,relatime,data=ordered 0 0
The first format will have 'mountvisible = False', while the second
'mountvisible = True'.
I've checked with kernel guys, /proc/mount is always sorted properly, later
entries always replace the earlier ones.
This patch is needed for OpenLMI, it should show which mount is really visible
and which is overwriten by later one.
---
blivet/__init__.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 848c839..1a52970 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -1906,7 +1906,13 @@ class Blivet(object):
def getActiveMounts(self):
""" Reflect active mounts in the appropriate devices' formats. """
log.info("collecting information about active mounts")
- for line in open("/proc/mounts").readlines():
+ visible_mountpoints = [] # list of already processed mount points
+
+ # When two filesystems are mounted to the same mount point,
+ # the later entry in /proc/mounts replaces the earlier one, so let's
+ # process the file in reverse order and get the visible mount first
+ # and the replaced later.
+ for line in reversed(open("/proc/mounts").readlines()):
try:
(devspec, mountpoint, fstype, options, rest) = line.split(None,
4)
@@ -1953,6 +1959,9 @@ class Blivet(object):
device.format.mountpoint = mountpoint # for future mounts
device.format._mountpoint = mountpoint # active mountpoint
device.format.mountopts = options
+ device.format.mountvisible = (mountpoint
+ not in visible_mountpoints)
+ visible_mountpoints.append(mountpoint)
def mountExistingSystem(fsset, rootDevice,
allowDirty=None, dirtyCB=None,
More information about the anaconda-patches
mailing list