[blivet:master 5/6] Remove allowDirty parameter and dependent code.

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


The only reason to call dirtyDevices() is if allowDirty is False.

But, in the only place (in anaconda) where this method is invoked,
allowDirty is set to True.

Previously in anaconda, there were other places where mountExistingSystem()
was called, and sometimes allowDirty was False. But the last place this
occurred was in pyanaconda/upgrade.py, which was removed in commit
faea8ba2cf225974041c77dbe3977aebac91e880 (2012 Aug). I think that
means that now we can treat that parameter as if it is always True.

This patch requires a corresponding patch in anaconda (to remove use of
allowDirty parameter).

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/__init__.py | 31 +------------------------------
 1 file changed, 1 insertion(+), 30 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 2a137aa..019701b 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -2050,30 +2050,7 @@ class Blivet(object):
 
         self.fsset.setFstabSwaps(devices)
 
-def dirtyDevices(fsset):
-    """ Discover dirty devices.
-
-        :returns: a list of dirty devices
-        :rtype: list
-    """
-    dirtyDevs = []
-    for device in fsset.mountpoints.values():
-        if not hasattr(device.format, "needsFSCheck"):
-            continue
-
-        try:
-            device.setup()
-        except DeviceError:
-            continue
-
-        if device.format.needsFSCheck:
-            log.info("%s contains a dirty %s filesystem", device.path,
-                                                          device.format.type)
-            dirtyDevs.append(device.path)
-
-        return dirtyDevs
-
-def mountExistingSystem(fsset, rootDevice, allowDirty=False, readOnly=None):
+def mountExistingSystem(fsset, rootDevice, readOnly=None):
     """ Mount filesystems specified in rootDevice's /etc/fstab file. """
     rootPath = _sysroot
 
@@ -2094,12 +2071,6 @@ def mountExistingSystem(fsset, rootDevice, allowDirty=False, readOnly=None):
                                 options=readOnly)
 
     fsset.parseFSTab()
-
-    if not allowDirty:
-        dirtyDevs = dirtyDevices(fsset)
-        if dirtyDevs:
-            raise DirtyFSError(dirtyDevs)
-
     fsset.mountFilesystems(rootPath=_sysroot, readOnly=readOnly, skipRoot=True)
 
 
-- 
1.9.3



More information about the anaconda-patches mailing list