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. --- 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 -- 1.6.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
Three small fixes to action sorting.
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@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
Three small fixes to action sorting.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Ack. If this is for rhel6-branch, please include a rhbz line in the commit. On Wed, 14 Apr 2010, 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 - -- David Cantrell <dcantrell@redhat.com> Red Hat / Honolulu, HI -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkvHIPIACgkQ5hsjjIy1Vkn4LQCgjsiEGFP2R9 afRCyxNFQamy76 9MgAoOdTUBVL52lNgeNPD5lb1SM+df6d =QEYV -----END PGP SIGNATURE----- _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
| All times are GMT. The time now is 06:16 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.