On Thu, Apr 16, 2009 at 11:00:13AM -0500, David Lehman wrote: > On Thu, 2009-04-16 at 17:45 +0200, Joel Granados Moreno wrote: > > I have seen instances where Udev says that there is a valid format on > > top of a device that has partitions. This is due to left over metadata > > from other installs. In these cases we will prefer the partitions. > > --- > > storage/devicetree.py | 12 ++++++++++++ > > storage/formats/__init__.py | 4 ++++ > > 2 files changed, 16 insertions(+), 0 deletions(-) > > > > diff --git a/storage/devicetree.py b/storage/devicetree.py > > index 2963726..319c5af 100644 > > --- a/storage/devicetree.py > > +++ b/storage/devicetree.py > > @@ -1568,6 +1568,18 @@ class DeviceTree(object): > > for leaf in self.leaves: > > leafInconsistencies(leaf) > > > > + # Automatically handle the cases where we find a format on a > > + # disk with partitions. I trust that the partitions list > > + # avoids the ignored devices. > > + for part in self.getDevicesByInstance(PartitionDevice): > > + if part.parents[0].format.type is not None: > > + format = formats.getFormat(None) > > > If you instead move this down below the next line ("disk = > part.parents[0]") and then do > > format = formats.getFormat(None, > device=disk.path, > exists=True) > > you will not need the patch to storage/formats/__init__.py and we can > avoid changing the behavior of a base class for one special/corner case. Great!, will do, thx for the review. > > Dave > > > > + disk = part.parents[0] > > + log.warning("Automatically corrected fomrat error on %s. " > > + "Changed from %s to %s." % > > + (disk.name, disk.format, format)) > > + disk.format = format > > + > > def populate(self): > > """ Locate all storage devices. """ > > # each iteration scans any devices that have appeared since the > > diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py > > index e68684c..ac70afa 100644 > > --- a/storage/formats/__init__.py > > +++ b/storage/formats/__init__.py > > @@ -269,6 +269,10 @@ class DeviceFormat(object): > > log_method_call(self, device=self.device, > > type=self.type, status=self.status) > > > > + # No action when the interface has not been implemented > > + if self.__class__.__name__== "DeviceFormat": > > + return > > + > > if not self.exists: > > raise FormatSetupError("format has not been created") > > > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list -- Joel Andres Granados Brno, Czech Republic, Red Hat. _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list