summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-03-26 13:46:48 -0400
committerChris Lumens <clumens@redhat.com>2009-03-30 17:27:08 -0400
commit9f0fdbf1078d114e98c4a4ecf84122bd7d6f9b34 (patch)
treec2c89002450b1ab93faf661090ef728e5b604048 /storage
parent50f9ed37efd22ba5ee351b1a2135296fdcffcff5 (diff)
downloadanaconda-9f0fdbf1078d114e98c4a4ecf84122bd7d6f9b34.tar.gz
anaconda-9f0fdbf1078d114e98c4a4ecf84122bd7d6f9b34.tar.xz
anaconda-9f0fdbf1078d114e98c4a4ecf84122bd7d6f9b34.zip
Add a weight property to the PartitionDevice class.
This property modifies the sort order we use later in partitionCompare to make sure the strange boot partitions get sorted before /boot, without having to look at bootable flags.
Diffstat (limited to 'storage')
-rw-r--r--storage/devices.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/storage/devices.py b/storage/devices.py
index bc665c888..e862dbb92 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -835,7 +835,7 @@ class PartitionDevice(StorageDevice):
size=None, grow=False, maxsize=None,
major=None, minor=None, bootable=None,
sysfsPath='', parents=None, exists=None,
- partType=None, primary=False):
+ partType=None, primary=False, weight=0):
""" Create a PartitionDevice instance.
Arguments:
@@ -862,6 +862,7 @@ class PartitionDevice(StorageDevice):
size -- the device's size (in MB)
bootable -- whether the partition is bootable
parents -- a list of potential containing disks
+ weight -- an initial sorting weight to assign
"""
self.req_disks = []
self.req_partType = None
@@ -871,6 +872,7 @@ class PartitionDevice(StorageDevice):
self.req_size = 0
self.req_base_size = 0
self.req_max_size = 0
+ self.req_base_weight = 0
self._bootable = False
@@ -925,6 +927,8 @@ class PartitionDevice(StorageDevice):
# req_base_size will always remain constant
self.req_base_size = self._size
+ self.req_base_weight = weight
+
def __str__(self):
s = StorageDevice.__str__(self)
s += (" grow = %(grow)s max size = %(maxsize)s bootable = %(bootable)s\n"
@@ -1019,6 +1023,15 @@ class PartitionDevice(StorageDevice):
partedPartition = property(lambda d: d._getPartedPartition(),
lambda d,p: d._setPartedPartition(p))
+ def _getWeight(self):
+ return self.req_base_weight
+
+ def _setWeight(self, weight):
+ self.req_base_weight = weight
+
+ weight = property(lambda d: d._getWeight(),
+ lambda d,w: d._setWeight(w))
+
def updateSysfsPath(self):
""" Update this device's sysfs path. """
log_method_call(self, self.name, status=self.status)