Re: [PATCH 1/3] Sort Storage.devices using isys.compareDrives for consistency.

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

 



Hi,

On 12/22/2009 05:12 PM, David Lehman wrote:
On Mon, 2009-12-21 at 17:11 +0100, Hans de Goede wrote:
Hi,

On 12/22/2009 02:26 AM, David Lehman wrote:
---
   storage/__init__.py |    2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index 2dbbfb8..bc63e43 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -370,7 +370,7 @@ class Storage(object):
       def devices(self):
           """ A list of all the devices in the device tree. """
           devices = self.devicetree.devices
-        devices.sort(key=lambda d: d.path)
+        devices.sort(key=lambda d: d.path, cmp=isys.compareDrives)
           return devices

       @property

Note that isys.compareDrives only works for
disks, and if something is not recognized it automatically gets
a lower prio then recognized thinks

So if the bios order is sdb, sda, and you pass in:

[ "sda", "sda1", "sdb", "sdb1" ]

You will end up with:

[ "sdb", "sda", "sda1", "sdb1" ]

IOW I'm not sure about this one.

We already use compareDrives to sort Storage.disks. Why we don't use it
to sort Storage.partitioned is beyond me.

Comparing by path is worse. It puts the mapper/ devices first, which is
just wrong.

Granted, I don't have any weird BIOS ordering, but I tried compareDrives
and got something like ['sda', 'sdb', 'sda1', 'sda2', 'sdb1', 'sr0',
'VolGroup', 'VolGroup-lv_root', 'VolGroup-lv_swap'], which makes sense
to me.

So, for disks and for partitioned we should be using compareDrives.

Ack

For
devices, I could live with either alpha-by-name or compareDrives.


I don't have much of a preference for either sorting. So go ahead and
do whatever you think is best.

Regards,

Hans

_______________________________________________
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