[PATCH] Fix partition request sorting based on number of allowed disks. (#540869)

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

 



Handle the special case of an empty list as if it were an infinitely
long list of disks.
---
 storage/partitioning.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/storage/partitioning.py b/storage/partitioning.py
index 97abf83..33210ec 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -419,7 +419,13 @@ def partitionCompare(part1, part2):
     ret -= cmp(part1.req_bootable, part2.req_bootable) * 1000
 
     # more specific disk specs to the front of the list
-    ret += cmp(len(part1.req_disks), len(part2.req_disks)) * 500
+    # req_disks being empty is equivalent to it being an infinitely long list
+    if part1.req_disks and not part2.req_disks:
+        ret -= 500
+    elif not part1.req_disks and part2.req_disks:
+        ret += 500
+    else:
+        ret += cmp(len(part1.req_disks), len(part2.req_disks)) * 500
 
     # primary-only to the front of the list
     ret -= cmp(part1.req_primary, part2.req_primary) * 200
-- 
1.6.2.5

_______________________________________________
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