[rhel6-branch 2/2] sda is less then vda in compareDisks()

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

 



Related: rhbz#621175
---
 storage/__init__.py |   31 +++++++++++++------------------
 1 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index 09dab1f..03c8f07 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -1180,6 +1180,17 @@ class Storage(object):
         return self.fsset.rootDevice
 
     def compareDisks(self, first, second):
+        def name_to_prio(name):
+            # the order is: hd < sd < vd or xvd < something else
+            if name.startswith("hd"):
+                return -1
+            elif name.startswith("sd"):
+                return 0
+            elif (name.startswith("vd") or name.startswith("xvd")):
+                return 1
+            else:
+                return 2
+
         # if exactly one of the devices has a pcidev, prefer it
         if bool(self.eddDict[first].pcidev) ^ bool(self.eddDict[second].pcidev):
             if self.eddDict[first].pcidev:
@@ -1202,24 +1213,8 @@ class Storage(object):
         if self.eddDict[second].biosdev:
             return 1
 
-        if first.startswith("hd"):
-            type1 = 0
-        elif first.startswith("sd"):
-            type1 = 1
-        elif (first.startswith("vd") or first.startswith("xvd")):
-            type1 = -1
-        else:
-            type1 = 2
-
-        if second.startswith("hd"):
-            type2 = 0
-        elif second.startswith("sd"):
-            type2 = 1
-        elif (second.startswith("vd") or second.startswith("xvd")):
-            type2 = -1
-        else:
-            type2 = 2
-
+        type1 = name_to_prio(first)
+        type2 = name_to_prio(second)
         if (type1 < type2):
             return -1
         elif (type1 > type2):
-- 
1.7.3.3

_______________________________________________
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