[PATCHv2] Comment out the fstab lines with unknown filesystem rather then ignoring them

Vratislav Podzimek vpodzime at redhat.com
Thu Jul 12 12:49:46 UTC 2012


When doing upgrade, there is no need to ignore the fstab lines with filesystem
Anaconda does not support. We can leave the lines as they are and just comment
them out to prevent mounting problems during the next boot.

Resolves: rhbz#754213
---
 fsset.py   |   23 +++++++++++++++++++++++
 upgrade.py |    3 +--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/fsset.py b/fsset.py
index 9636003..85f6623 100644
--- a/fsset.py
+++ b/fsset.py
@@ -30,6 +30,7 @@ import partedUtils
 import raid
 import lvm
 import types
+import copy
 from flags import flags
 
 import bootyutil
@@ -1316,6 +1317,7 @@ class FileSystemSet:
         self.reset()
         self.volumesCreated = 0
         self.anaconda = anaconda
+        self.unknownFSlines = list()
 
     def isActive(self):
         return self.mountcount != 0
@@ -1431,8 +1433,21 @@ class FileSystemSet:
         new = FileSystemSet(self.anaconda)
         for entry in self.entries:
             new.add (entry)
+        new.unknownFSlines = copy.copy(self.unknownFSlines)
         return new
 
+    def extend (self, fsset):
+        """
+        Extends the entry set and the list of unknownFSlines with values
+        from a given fsset.
+
+        """
+
+        for entry in fsset.entries:
+            self.add(entry)
+
+        self.unknownFSlines.extend(fsset.unknownFSlines)
+
     def fstab (self):
         format = "%-23s %-23s %-7s %-15s %d %d\n"
         fstab = ""
@@ -1460,6 +1475,11 @@ class FileSystemSet:
                                           entry.fsystem.getName(),
                                           options, entry.fsck,
                                           entry.order)
+
+        # append commented out lines with unknown (not supported) filesystems
+        for line in self.unknownFSlines:
+            fstab += "#" + line
+
         return fstab
 
     def mtab (self):
@@ -2969,6 +2989,9 @@ def readFstab (anaconda):
             break
         # "none" is valid as an fs type for bind mounts (#151458)
         if fsystem is None and (string.find(fields[3], "bind") == -1):
+            # add the line to the list of lines that will be commented out in
+            # the new fstab
+            fsset.unknownFSlines.append(line)
             continue
         
         label = None
diff --git a/upgrade.py b/upgrade.py
index 5beb8a2..f3e243c 100644
--- a/upgrade.py
+++ b/upgrade.py
@@ -198,8 +198,7 @@ def mountRootPartition(anaconda, rootInfo, oldfsset, allowDirty = 0,
 
     oldfsset.reset()
     newfsset = readFstab(anaconda)
-    for entry in newfsset.entries:
-        oldfsset.add(entry)
+    oldfsset.extend(newfsset)
 
     isys.umount(anaconda.rootPath)
 
-- 
1.7.4.4



More information about the anaconda-patches mailing list