Re: [PATCH] Handle the case where filesyste is unmountable.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2009-04-07 at 19:52 +0200, Joel Granados wrote:
> On Tue, Apr 07, 2009 at 10:10:13AM -0500, David Lehman wrote:
> > On Tue, 2009-04-07 at 16:58 +0200, Joel Granados Moreno wrote:
> > > ---
> > >  storage/devicetree.py |   35 ++++++++++++++++++++++++++++++++++-
> > >  storage/errors.py     |    3 +++
> > >  storage/formats/fs.py |    4 ++--
> > >  3 files changed, 39 insertions(+), 3 deletions(-)
> > > 
> > 
> > I think this is overkill. Catching the mount failure is certainly good.
> > We can either replace the filesystem format with a DeviceFormat (shown
> > as "Unknown") or just mark it as unmountable. Ignoring the whole disk
> > makes no sense.
> 
> so when user chooses reformat, we reformat as unknown and when user
> chosses ignore we choose to tag it as unmountable?  do I read you
> correctly?

I think prompting at all is overkill.

> 
> 
> > 
> > Dave
> > 
> > > diff --git a/storage/devicetree.py b/storage/devicetree.py
> > > index 8c41c50..1323008 100644
> > > --- a/storage/devicetree.py
> > > +++ b/storage/devicetree.py
> > > @@ -164,6 +164,28 @@ def questionReinitILVM(intf=None, pv_names=None, lv_name=None, vg_name=None):
> > >  
> > >      return retVal
> > >  
> > > +def questionClobberFS(intf=None, name=None):
> > > +    retVal = False
> > > +    if not intf or not name:
> > > +        pass
> > > +    else:
> > > +        rc = intf.messageWindow(_("Warning"),
> > > +                _("Error while processing File System.\n"
> > > +                  "There is inconsistent file system metadata on %s.  You can "
> > > +                  "erase all file system metadata or ignore it, preserving its "
> > > +                  "contents." % name),
> > > +                type="custom",
> > > +                custom_buttons = [ _("_Ignore"),
> > > +                                   _("_Erase Metadata") ],
> > > +                custom_icon="question")
> > > +        if rc == 0:
> > > +            pass
> > > +        else:
> > > +            retVal = True # This means clobber.
> > > +
> > > +    return retVal
> > > +
> > > +
> > >  class DeviceTree(object):
> > >      """ A quasi-tree that represents the devices in the system.
> > >  
> > > @@ -1462,7 +1484,18 @@ class DeviceTree(object):
> > >                  if apple.minSize <= device.size <= apple.maxSize:
> > >                      args[0] = "appleboot"
> > >  
> > > -        device.format = formats.getFormat(*args, **kwargs)
> > > +        try:
> > > +            device.format = formats.getFormat(*args, **kwargs)
> > > +        except FSMountError as e:
> > > +            if questionClobberFS(self.intf, device.name):
> > > +                device.format = formats.getFormat(*[None], **kwargs)
> > > +                device.format.destroy()
> > > +            else:
> > > +                device.format = formats.getFormat(*[None], **kwargs)
> > > +                if isinstance(device, PartitionDevice):
> > > +                    self.protectedPartitions.append(device.name)
> > > +                else:
> > > +                    self.addIgnoredDisk(device.name)
> > >  
> > >          #
> > >          # now do any special handling required for the device's format
> > > diff --git a/storage/errors.py b/storage/errors.py
> > > index a23b572..410779b 100644
> > > --- a/storage/errors.py
> > > +++ b/storage/errors.py
> > > @@ -73,6 +73,9 @@ class FSResizeError(FSError):
> > >  class FSMigrateError(FSError):
> > >      pass
> > >  
> > > +class FSMountError(FSError):
> > > +    pass
> > > +
> > >  class LUKSError(DeviceFormatError):
> > >      pass
> > >  
> > > diff --git a/storage/formats/fs.py b/storage/formats/fs.py
> > > index 0e155eb..105e530 100644
> > > --- a/storage/formats/fs.py
> > > +++ b/storage/formats/fs.py
> > > @@ -481,10 +481,10 @@ class FS(DeviceFormat):
> > >                              options=options,
> > >                              bindMount=isinstance(self, BindFS))
> > >          except Exception as e:
> > > -            raise FSError("mount failed: %s" % e)
> > > +            raise FSMountError("mount failed: %s" % e)
> > >  
> > >          if rc:
> > > -            raise FSError("mount failed: %s" % rc)
> > > +            raise FSMountError("mount failed: %s" % rc)
> > >  
> > >          if flags.selinux:
> > >              ret = isys.resetFileContext(mountpoint)
> > 
> > _______________________________________________
> > Anaconda-devel-list mailing list
> > Anaconda-devel-list@xxxxxxxxxx
> > https://www.redhat.com/mailman/listinfo/anaconda-devel-list
> 

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux