summaryrefslogtreecommitdiffstats
path: root/storage/devicetree.py
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2010-04-14 20:38:46 -0500
committerDavid Lehman <dlehman@redhat.com>2010-04-15 10:44:04 -0500
commit2d800b9e470d0a93d9cc923a457bfb25c336cee9 (patch)
treeeba4128e7255450005be00f9615d08f7f8bd927b /storage/devicetree.py
parent9296f5b3c5d7c2ef5ff608267158b14f5c645ab8 (diff)
downloadanaconda-2d800b9e470d0a93d9cc923a457bfb25c336cee9.tar.gz
anaconda-2d800b9e470d0a93d9cc923a457bfb25c336cee9.tar.xz
anaconda-2d800b9e470d0a93d9cc923a457bfb25c336cee9.zip
Three small fixes to action sorting.
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.
Diffstat (limited to 'storage/devicetree.py')
-rw-r--r--storage/devicetree.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 14239b0b6..75dde9c58 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