[master 3/4] Check to see if mountpoint is already mounted

bcl installerbot-noreply at redhat.com
Tue Apr 7 20:40:00 UTC 2015


From: "Brian C. Lane" <bcl at redhat.com>

Instead of using self.status which checks to see if anything is mounted,
not the specific mountpoint requested. Make sure to check the chrooted
mountpoint, otherwise nothing will get mounted.
---
 blivet/formats/fs.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index e1b5bba..cc5e118 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -642,9 +642,6 @@ def mount(self, options="", chroot="/", mountpoint=None):
         if not mountpoint:
             raise FSError("no mountpoint given")
 
-        if self.status:
-            return
-
         if not isinstance(self, NoDevFS) and not os.path.exists(self.device):
             raise FSError("device %s does not exist" % self.device)
 
@@ -655,6 +652,11 @@ def mount(self, options="", chroot="/", mountpoint=None):
         #mountpoint = os.path.join(chroot, mountpoint)
         chrootedMountpoint = os.path.normpath("%s/%s" % (chroot, mountpoint))
 
+        # Is something is already mounted at this path?
+        if mountsCache.isMountpoint(chrootedMountpoint):
+            log.debug("BCL: %s is already mounted, not remounting it. %s", chrootedMountpoint, self.device)
+            return
+
         # passed in options override default options
         if not options or not isinstance(options, str):
             options = self.options


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


More information about the anaconda-patches mailing list