[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[rhel6-branch] Check fstab entries against fmt.mountType not fmt.type



This is what mountType is there for.

Also move the declaration of mountType up to DeviceFormat so that
SwapSpace inherits it.

Resolves: rhbz#594032
---
 storage/__init__.py         |    4 ++--
 storage/formats/__init__.py |    8 ++++++++
 storage/formats/fs.py       |    8 --------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index 3676365..5640b17 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -1659,9 +1659,9 @@ class FSSet(object):
         # make sure, if we're using a device from the tree, that
         # the device's format we found matches what's in the fstab
         fmt = getFormat(fstype, device=device.path)
-        if fmt.type != device.format.type:
+        if fmt.mountType != device.format.mountType:
             raise StorageError("scanned format (%s) differs from fstab "
-                        "format (%s)" % (device.format.type, fstype))
+                        "format (%s)" % (device.format.mountType, fmt.mountType))
 
         if device.format.mountable:
             device.format.mountpoint = mountpoint
diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
index 9094785..176eb26 100644
--- a/storage/formats/__init__.py
+++ b/storage/formats/__init__.py
@@ -139,6 +139,7 @@ def get_device_format_class(fmt_type):
 class DeviceFormat(object):
     """ Generic device format. """
     _type = None
+    _mountType = None                    # like _type but for passing to mount
     _name = "Unknown"
     _udevTypes = []
     partedFlag = None
@@ -230,6 +231,13 @@ class DeviceFormat(object):
     def type(self):
         return self._type
 
+    @property
+    def mountType(self):
+        if not self._mountType:
+            self._mountType = self._type
+
+        return self._mountType
+
     def probe(self):
         log_method_call(self, device=self.device,
                         type=self.type, status=self.status)
diff --git a/storage/formats/fs.py b/storage/formats/fs.py
index 646194c..89799b6 100644
--- a/storage/formats/fs.py
+++ b/storage/formats/fs.py
@@ -107,7 +107,6 @@ def fsConfigFromFile(config_file):
 class FS(DeviceFormat):
     """ Filesystem class. """
     _type = "Abstract Filesystem Class"  # fs type name
-    _mountType = None                    # like _type but for passing to mount
     _name = None
     _mkfs = ""                           # mkfs utility
     _modules = []                        # kernel modules required for support
@@ -821,13 +820,6 @@ class FS(DeviceFormat):
 
         return _type
 
-    @property
-    def mountType(self):
-        if not self._mountType:
-            self._mountType = self._type
-
-        return self._mountType
-
     # These methods just wrap filesystem-specific methods in more
     # generically named methods so filesystems and formatted devices
     # like swap and LVM physical volumes can have a common API.
-- 
1.7.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]