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

vojtechtrefny installerbot-noreply at redhat.com
Thu May 14 08:53:01 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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 6eccbc3..ce87d89 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 chroot != "/":
+            self._chrootedMountpoint = chrootedMountpoint
+
     def _postSetup(self, **kwargs):
         options = kwargs.get("options", "")
         chroot = kwargs.get("chroot", "/")
@@ -614,6 +622,7 @@ 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
         rc = util.umount(mountpoint)
         if rc:
@@ -621,6 +630,9 @@ def _teardown(self, **kwargs):
             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/65d1f38a26e756f494cb8439b036511c30aef1d8


More information about the anaconda-patches mailing list