[master 1/1] Workaround for chrooted mountpoints (#1217578)

vojtechtrefny installerbot-noreply at redhat.com
Wed May 13 15:19:02 UTC 2015


From: Vojtech Trefny <vtrefny at redhat.com>

This is workaround for rawhide atomic builds. These are currently
failing because of mounts cache reporting wrong mountpoints. The
problem is mostly with chrooted mounts and bind mounts of 'nodev'
devices.

Signed-off-by: Vojtech Trefny <vtrefny at redhat.com>
---
 blivet/formats/fs.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 6eccbc3..ac7a793 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -138,6 +138,8 @@ def __init__(self, **kwargs):
 
         self._targetSize = self._size
 
+        self._chrootedMountpoint = None
+
         if self.supported:
             self.loadModule()
 
@@ -496,6 +498,9 @@ def systemMountpoint(self):
         if not self.exists:
             return None
 
+        if self._chrootedMountpoint:
+            return self._chrootedMountpoint
+
         # It is possible to have multiple mountpoints, return the last one
         try:
             return mountsCache.getMountpoints(self.device,
@@ -572,6 +577,9 @@ def _setup(self, **kwargs):
         chrootedMountpoint = os.path.normpath("%s/%s" % (chroot, mountpoint))
         self._mount.doTask(chrootedMountpoint, options=options)
 
+        if chrootedMountpoint != mountpoint:
+            self._chrootedMountpoint = chrootedMountpoint
+
     def _postSetup(self, **kwargs):
         options = kwargs.get("options", "")
         chroot = kwargs.get("chroot", "/")
@@ -614,13 +622,16 @@ def _teardown(self, **kwargs):
             by the system. Override this behavior by passing a specific mountpoint. FSError
             will be raised in either case if the path doesn't exist.
         """
-        mountpoint = kwargs.get("mountpoint") or self.systemMountpoint
+        mountpoint = kwargs.get("mountpoint") or self._chrootedMountpoint or self.systemMountpoint
         rc = util.umount(mountpoint)
         if rc:
             # try and catch whatever is causing the umount problem
             util.run_program(["lsof", mountpoint])
             raise FSError("umount failed")
 
+        if mountpoint == self._chrootedMountpoint:
+            self._chrootedMountpoint = None
+
     def readLabel(self):
         """Read this filesystem's label.
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/811579c8a5cb883ffd4827012b7d9c6c9a30f019


More information about the anaconda-patches mailing list