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

[PATCH 3/4] Sort singlePV=True requests so they come first.



As another way to ensure the singlePV asVol requests get full pick of
what PV they want to destroy, make sure they come before the regular
asVol requests.

(Code from Dave Lehman <dlehman redhat com>)

Related: rhbz#618376
---
 storage/devicetree.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index f74d9d2..5c213ff 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -610,6 +610,13 @@ class DeviceTree(object):
                                   a2.device.partedPartition.number)
                     else:
                         ret = cmp(a1.device.name, a2.device.name)
+                elif isinstance(a1.device, LVMLogicalVolumeDevice) and \
+                     isinstance(a2.device, LVMLogicalVolumeDevice) and \
+                     a1.device.vg == a2.device.vg:
+                    if a1.device.singlePV and not a2.device.singlePV:
+                        ret = -1
+                    elif not a1.device.singlePV and a2.device.singlePV:
+                        ret = 1
                 elif isinstance(a1.device, PartitionDevice) and \
                      a2.device.partitioned:
                     ret = 1
-- 
1.7.3.5


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