[f23-branch 2/2] rpmostreepayload: Also unmount internal mounts during shutdown

cgwalters installerbot-noreply at redhat.com
Tue Oct 27 20:06:58 UTC 2015


From: Colin Walters <walters at verbum.org>

I got a report that using livemedia-creator, the sysroot mount
was hanging around.  We previously on the RHEL7.2 branch in
https://github.com/cgwalters/anaconda/commit/31c0ebc5016724bcb6bdb948f969fea62d01f5ce
added a special method for the payload to clean up mounts,
but it turns out in at least this f23 branch there is already done
in `Payload.unsetup()`.

Use that method to unmount everything we mounted internally during
shutdown.
---
 pyanaconda/packaging/rpmostreepayload.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py
index e97eddb..c697325 100644
--- a/pyanaconda/packaging/rpmostreepayload.py
+++ b/pyanaconda/packaging/rpmostreepayload.py
@@ -50,6 +50,7 @@ def __init__(self, data):
         super(RPMOSTreePayload, self).__init__(data)
         self._remoteOptions = None
         self._sysroot_path = None
+        self._internal_mounts = []
 
     @property
     def handlesBootloaderConfiguration(self):
@@ -239,6 +240,7 @@ def prepareMountTargets(self, storage):
         for (src, dest) in binds:
             self._safeExecWithRedirect("mount",
                                        ["--bind", src, dest if dest else src])
+            self._internal_mounts.append(dest)
             if dest is None:
                 self._safeExecWithRedirect("mount",
                                            ["--bind", "-o", "remount,ro", src, src])
@@ -247,9 +249,10 @@ def prepareMountTargets(self, storage):
         # /mnt/sysimage/.../sysroot, but this caused issues with mount
         # path canonicalization.  Instead, directly mount the physical
         # device at two different paths.
+        dest = iutil.getSysroot() + "/sysroot"
         self._safeExecWithRedirect("mount",
-                                   [storage.rootDevice.format.device,
-                                    iutil.getSysroot() + "/sysroot"])
+                                   [storage.rootDevice.format.device, dest])
+        self._internal_mounts.append(dest)
 
         # Now, ensure that all other potential mount point directories such as
         # (/home) are created.  We run through the full tmpfiles here in order
@@ -264,6 +267,12 @@ def prepareMountTargets(self, storage):
                                        ["--create", "--boot", "--root=" + iutil.getSysroot(),
                                         "--prefix=/var/" + varsubdir])
 
+    def unsetup(self):
+        super(RPMOSTreePayload, self).unsetup()
+
+        for mount in reversed(self._internal_mounts):
+            blivet.util.umount(mount)
+
     def recreateInitrds(self):
         # For rpmostree payloads, we're replicating an initramfs from
         # a compose server, and should never be regenerating them


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/f3f5ecbd3a5c6476d060aaf687e72433c55ddb31


More information about the anaconda-patches mailing list