[PATCHv2] Comment out the fstab lines with unknown filesystem rather then ignoring them
Vratislav Podzimek
vpodzime at redhat.com
Fri Jul 13 08:38:26 UTC 2012
On Thu, 2012-07-12 at 10:11 -0400, Martin Gracik wrote:
>
> ----- Original Message -----
> > 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)
>
> Aren't the members of self.unknownFSlines list just strings? Is the copy.copy necessary? Wouldn't plain self.unknownFSlines[:] be enough?
copy.copy() seemed better readable to me. In the discussion on IRC
Martin suggested the one more way to do the copy:
new.unknownFSlines = list(self.unknownFSlines)
that would work also for tuples and generators. Any preferences? I will
change this to one of the methods not needing the import before pushing.
Does this patch otherwise look good?
>
> > 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
> >
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://fedorahosted.org/mailman/listinfo/anaconda-patches
> >
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/anaconda-patches
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list