[master 1/1] In FS._postSetup() check the mountpoint options that were actually used.

mulkieran installerbot-noreply at redhat.com
Thu Apr 16 13:38:47 UTC 2015


From: mulhern <amulhern at redhat.com>

Should have gone in with commit 10bc41e6f73796298a3a78faaf69dd363429ea53.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/fs.py | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 6274cf3..ad48d6e 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -644,6 +644,24 @@ def _preSetup(self, **kwargs):
         chrootedMountpoint = os.path.normpath("%s/%s" % (chroot, mountpoint))
         return self.systemMountpoint != chrootedMountpoint
 
+    def _setupMountOptions(self, options):
+        """ The options actually used to mount the filesystem.
+
+            These are not necessarily the same as either the default options
+            or the options argument.
+
+            :param str options: the mount options passed to setup() method.
+            :returns: the mount options used by setup
+            :rtype: str
+        """
+        if not options or not isinstance(options, str):
+            options = self.options
+
+        if isinstance(self, BindFS):
+            options = "bind," + options
+
+        return options
+
     def _setup(self, **kwargs):
         """ Mount this filesystem.
 
@@ -653,7 +671,7 @@ def _setup(self, **kwargs):
             :keyword mountpoint: mountpoint (overrides self.mountpoint)
             :raises: FSError
         """
-        options = kwargs.get("options", "")
+        options = self._setupMountOptions(kwargs.get("options", ""))
         chroot = kwargs.get("chroot", "/")
         mountpoint = kwargs.get("mountpoint") or self.mountpoint
 
@@ -664,13 +682,6 @@ def _setup(self, **kwargs):
         #mountpoint = os.path.join(chroot, mountpoint)
         chrootedMountpoint = os.path.normpath("%s/%s" % (chroot, mountpoint))
 
-        # passed in options override default options
-        if not options or not isinstance(options, str):
-            options = self.options
-
-        if isinstance(self, BindFS):
-            options = "bind," + options
-
         try:
             rc = util.mount(self.device, chrootedMountpoint,
                             fstype=self.mountType,
@@ -682,7 +693,7 @@ def _setup(self, **kwargs):
             raise FSError("mount failed: %s" % rc)
 
     def _postSetup(self, **kwargs):
-        options = kwargs.get("options", "")
+        options = self._setupMountOptions(kwargs.get("options", ""))
         chroot = kwargs.get("chroot", "/")
         mountpoint = kwargs.get("mountpoint") or self.mountpoint
 


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


More information about the anaconda-patches mailing list