summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2013-01-08 18:18:04 -0600
committerDavid Lehman <dlehman@redhat.com>2013-01-28 13:13:16 -0600
commit70d89aef92622c08932e5fe3da78f81e5bd36658 (patch)
tree987a64f15eeef082484824e9f54f354cc02a5379
parent8ff0096056856e05dc12eb0dab97bb5f5b4fea0a (diff)
downloadanaconda-70d89aef92622c08932e5fe3da78f81e5bd36658.tar.gz
anaconda-70d89aef92622c08932e5fe3da78f81e5bd36658.tar.xz
anaconda-70d89aef92622c08932e5fe3da78f81e5bd36658.zip
Use dumpe2fs output to determine dirty fs.
This will allow us to remove isys.ext3IsDirty and instead just get another piece of information from an e2fsprogs utility that we run anyway.
-rw-r--r--pyanaconda/storage/__init__.py4
-rw-r--r--pyanaconda/storage/formats/fs.py20
2 files changed, 18 insertions, 6 deletions
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 3dde12de0..54e9844b0 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -2371,7 +2371,7 @@ def mountExistingSystem(fsset, rootDevice,
# check for dirty filesystems
dirtyDevs = []
for device in fsset.mountpoints.values():
- if not hasattr(device.format, "isDirty"):
+ if not hasattr(device.format, "needsFSCheck"):
continue
try:
@@ -2380,7 +2380,7 @@ def mountExistingSystem(fsset, rootDevice,
# we'll catch this in the main loop
continue
- if device.format.isDirty:
+ if device.format.needsFSCheck:
log.info("%s contains a dirty %s filesystem" % (device.path,
device.format.type))
dirtyDevs.append(device.path)
diff --git a/pyanaconda/storage/formats/fs.py b/pyanaconda/storage/formats/fs.py
index e1b13155d..b977a1850 100644
--- a/pyanaconda/storage/formats/fs.py
+++ b/pyanaconda/storage/formats/fs.py
@@ -644,7 +644,7 @@ class FS(DeviceFormat):
raise NotImplementedError("FS does not implement writeRandomUUID")
@property
- def isDirty(self):
+ def needsFSCheck(self):
return False
@property
@@ -816,6 +816,11 @@ class Ext2FS(FS):
_fsProfileSpecifier = "-T"
partedSystem = fileSystemType["ext2"]
+ def __init__(self, *args, **kwargs):
+ self.dirty = False
+ self.errors = False
+ super(Ext2FS, self).__init__(*args, **kwargs)
+
def _fsckFailed(self, rc):
for errorCode in self._fsckErrors.keys():
if rc & errorCode:
@@ -869,7 +874,10 @@ class Ext2FS(FS):
for line in buf.splitlines():
if line.startswith("Block size:"):
blockSize = int(line.split(" ")[-1])
- break
+
+ 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 "
@@ -909,8 +917,8 @@ class Ext2FS(FS):
return self._minInstanceSize
@property
- def isDirty(self):
- return isys.ext2IsDirty(self.device)
+ def needsFSCheck(self):
+ return self.dirty or self.errors
@property
def resizeArgs(self):
@@ -933,6 +941,10 @@ class Ext3FS(Ext2FS):
# things they should know the implications of their chosen block size.
_maxSize = 16 * 1024 * 1024
+ @property
+ def needsFSCheck(self):
+ return self.errors
+
register_device_format(Ext3FS)