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

[PATCH] Don't let device names affect action order in general case.



Some complex action sets were being sorted incorrectly because of
the name comparisons. Names should only matter if both devices are
partitions on the same disk.
---
 storage/devicetree.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 9b059b6..288e12d 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -531,7 +531,7 @@ class DeviceTree(object):
                      not isinstance(a1.device, DiskDevice):
                     ret = -1
                 else:
-                    ret = cmp(a2.device.name, a1.device.name)
+                    ret = 0
             elif a1.isDestroy():
                 ret = -1
             elif a2.isDestroy():
@@ -580,7 +580,7 @@ class DeviceTree(object):
                     else:
                         ret = -1
                 else:
-                    ret = cmp(a1.device.name, a2.device.name)
+                    ret = 0
             elif a1.isResize():
                 ret = -1
             elif a2.isResize():
@@ -594,7 +594,7 @@ class DeviceTree(object):
                     elif a2.isFormat():
                         ret = -1
                     else:
-                        ret = cmp(a1.device.name, a2.device.name)
+                        ret = 0
                 elif a1.device.dependsOn(a2.device):
                     ret = 1
                 elif a2.device.dependsOn(a1.device):
@@ -610,7 +610,7 @@ class DeviceTree(object):
                      not isinstance(a1.device, DiskDevice):
                     ret = 1
                 else:
-                    ret = cmp(a1.device.name, a2.device.name)
+                    ret = 0
             elif a1.isCreate():
                 ret = -1
             elif a2.isCreate():
@@ -628,7 +628,7 @@ class DeviceTree(object):
                 else:
                     ret = cmp(a1.device.name, a2.device.name)
             else:
-                ret = cmp(a1.device.name, a2.device.name)
+                ret = 0
 
             log.debug("cmp: %d -- %s | %s" % (ret, a1, a2))
             return ret
-- 
1.6.0.6


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