Re: [PATCH 1/3] Three small fixes to action sorting.

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

 



Ack.

On 04/15/2010 04:05 AM, David Lehman wrote:
   1) Destruction of partitions goes before destruction of partitioned
      devices.
   2) Creation of two partitions on the same disk should be sorted
      by partition number, not name.
   3) Resize of partitioned devices is not supported, so don't clutter
      the sorting function with code to handle it.
---
  storage/devicetree.py |   24 ++++++++----------------
  1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 14239b0..75dde9c 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -514,10 +514,10 @@ class DeviceTree(object):
                          ret = cmp(a2.device.name, a1.device.name)
                  elif isinstance(a1.device, PartitionDevice) and \
                       a2.device.partitioned:
-                    ret = 1
+                    ret = -1
                  elif isinstance(a2.device, PartitionDevice) and \
                       a1.device.partitioned:
-                    ret = -1
+                    ret = 1
                  else:
                      ret = 0
              elif a1.isDestroy():
@@ -555,18 +555,6 @@ class DeviceTree(object):
                  elif isinstance(a1.device, PartitionDevice) and \
                       isinstance(a2.device, PartitionDevice):
                      ret = cmp(a1.device.name, a2.device.name)
-                elif isinstance(a1.device, PartitionDevice) and \
-                     a2.device.partitioned:
-                    if a1.isGrow():
-                        ret = -1
-                    else:
-                        ret = 1
-                elif isinstance(a2.device, PartitionDevice) and \
-                     a1.device.partitioned:
-                    if a2.isGrow():
-                        ret = 1
-                    else:
-                        ret = -1
                  else:
                      ret = 0
              elif a1.isResize():
@@ -622,9 +610,13 @@ class DeviceTree(object):
                      ret = -1
                  elif isinstance(a1.device, PartitionDevice) and \
                       isinstance(a2.device, PartitionDevice):
-                    ret = cmp(a1.device.name, a2.device.name)
+                    if a1.device.disk == a2.device.disk:
+                        ret = cmp(a1.device.partedPartition.number,
+                                  a2.device.partedPartition.number)
+                    else:
+                        ret = cmp(a1.device.name, a2.device.name)
                  else:
-                    ret = cmp(a1.device.name, a2.device.name)
+                    ret = 0
              else:
                  ret = 0


_______________________________________________
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