FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Desktop

 
 
LinkBack Thread Tools
 
Old 01-14-2011, 06:52 PM
David Lehman
 
Default Check fstab entries against fmt.mountType not fmt.type

On Fri, 2011-01-14 at 14:20 -0500, Peter Jones wrote:
> This is what mountType is there for.
>
> Also move the declaration of mountType up to DeviceFormat so that
> SwapSpace inherits it.

I hate that swap devices go in /etc/fstab.

Please don't add anything about mount into DeviceFormat. There are two
options I can see:

1. Just define mountType in swapspace. I don't like this idea since swap
doesn't get mounted.

2. Use getattr(format, "mountType", format.type). This is the way to go
IMO.

Dave

>
> Resolves: rhbz#594032
> ---
> storage/__init__.py | 4 ++--
> storage/formats/__init__.py | 8 ++++++++
> storage/formats/fs.py | 8 --------
> 3 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/storage/__init__.py b/storage/__init__.py
> index 3676365..5640b17 100644
> --- a/storage/__init__.py
> +++ b/storage/__init__.py
> @@ -1659,9 +1659,9 @@ class FSSet(object):
> # make sure, if we're using a device from the tree, that
> # the device's format we found matches what's in the fstab
> fmt = getFormat(fstype, device=device.path)
> - if fmt.type != device.format.type:
> + if fmt.mountType != device.format.mountType:
> raise StorageError("scanned format (%s) differs from fstab "
> - "format (%s)" % (device.format.type, fstype))
> + "format (%s)" % (device.format.mountType, fmt.mountType))
>
> if device.format.mountable:
> device.format.mountpoint = mountpoint
> diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
> index 9094785..176eb26 100644
> --- a/storage/formats/__init__.py
> +++ b/storage/formats/__init__.py
> @@ -139,6 +139,7 @@ def get_device_format_class(fmt_type):
> class DeviceFormat(object):
> """ Generic device format. """
> _type = None
> + _mountType = None # like _type but for passing to mount
> _name = "Unknown"
> _udevTypes = []
> partedFlag = None
> @@ -230,6 +231,13 @@ class DeviceFormat(object):
> def type(self):
> return self._type
>
> + @property
> + def mountType(self):
> + if not self._mountType:
> + self._mountType = self._type
> +
> + return self._mountType
> +
> def probe(self):
> log_method_call(self, device=self.device,
> type=self.type, status=self.status)
> diff --git a/storage/formats/fs.py b/storage/formats/fs.py
> index 646194c..89799b6 100644
> --- a/storage/formats/fs.py
> +++ b/storage/formats/fs.py
> @@ -107,7 +107,6 @@ def fsConfigFromFile(config_file):
> class FS(DeviceFormat):
> """ Filesystem class. """
> _type = "Abstract Filesystem Class" # fs type name
> - _mountType = None # like _type but for passing to mount
> _name = None
> _mkfs = "" # mkfs utility
> _modules = [] # kernel modules required for support
> @@ -821,13 +820,6 @@ class FS(DeviceFormat):
>
> return _type
>
> - @property
> - def mountType(self):
> - if not self._mountType:
> - self._mountType = self._type
> -
> - return self._mountType
> -
> # These methods just wrap filesystem-specific methods in more
> # generically named methods so filesystems and formatted devices
> # like swap and LVM physical volumes can have a common API.


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

Thread Tools




All times are GMT. The time now is 08:32 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org