[blivet:master 6/6] Remove needsFSCheck() and what only it depends on.

mulhern amulhern at redhat.com
Wed Dec 17 14:33:48 UTC 2014


If needsFSCheck() is no longer invoked via mountExistingSystem() it is no
longer invoked anywhere. It is a bit of a dubious method because it depends
on values of self.dirty and self.errors which are set as a side-effect of
calling Ext2FS._getMinSize(). For the value of needsFSCheck() to
be meaningful, therefore, _getMinSize() must have been called and it must
have been called recently enough that the dirty and errors information is
not stale. It would be better to eliminate code which has an implicit
dependency on this timing behavior when it appears that the method and
supporting code has become unnecessary, anyway.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/fs.py            | 21 ---------------------
 tests/formats_test/fstesting.py |  1 -
 2 files changed, 22 deletions(-)

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 07a383a..a234724 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -741,10 +741,6 @@ class FS(DeviceFormat):
         self.notifyKernel()
 
     @property
-    def needsFSCheck(self):
-        return False
-
-    @property
     def mkfsProg(self):
         """ Program used to create filesystems of this type. """
         return self._mkfs
@@ -946,11 +942,6 @@ class Ext2FS(FS):
     _fsProfileSpecifier = "-T"
     partedSystem = fileSystemType["ext2"]
 
-    def __init__(self, **kwargs):
-        self.dirty = False
-        self.errors = False
-        super(Ext2FS, self).__init__(**kwargs)
-
     def _fsckFailed(self, rc):
         for errorCode in self._fsckErrors.keys():
             if rc & errorCode:
@@ -985,10 +976,6 @@ class Ext2FS(FS):
                 if line.startswith("Block size:"):
                     blockSize = int(line.split(" ")[-1])
 
-                if line.startswith("Filesystem state:"):
-                    self.dirty = "not clean" in line
-                    self.errors = "with errors" in line
-
             if blockSize is None:
                 raise FSError("failed to get block size for %s filesystem "
                               "on %s" % (self.mountType, self.device))
@@ -1036,10 +1023,6 @@ class Ext2FS(FS):
         return self._minInstanceSize
 
     @property
-    def needsFSCheck(self):
-        return self.dirty or self.errors
-
-    @property
     def resizeArgs(self):
         argv = ["-p", self.device, "%dM" % (self.targetSize.convertTo("MiB"))]
         return argv
@@ -1060,10 +1043,6 @@ class Ext3FS(Ext2FS):
     # things they should know the implications of their chosen block size.
     _maxSize = Size("16 TiB")
 
-    @property
-    def needsFSCheck(self):
-        return self.errors
-
 register_device_format(Ext3FS)
 
 
diff --git a/tests/formats_test/fstesting.py b/tests/formats_test/fstesting.py
index c276ede..491e8b2 100644
--- a/tests/formats_test/fstesting.py
+++ b/tests/formats_test/fstesting.py
@@ -197,7 +197,6 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
             self._test_sizes(an_fs)
 
         # and no errors should occur when checking
-        self.assertFalse(an_fs.needsFSCheck)
         self.assertIsNone(an_fs.doCheck())
 
     def testNoExplicitTargetSize(self):
-- 
1.9.3



More information about the anaconda-patches mailing list