[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH 08/47] Remove partedUtils.get_max_logical_partitions()
- From: David Cantrell <dcantrell redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH 08/47] Remove partedUtils.get_max_logical_partitions()
- Date: Wed, 11 Feb 2009 14:53:43 -1000
The parted.Disk object now provides a getMaxLogicalPartitions()
method.
---
autopart.py | 4 ++--
partedUtils.py | 26 --------------------------
2 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/autopart.py b/autopart.py
index 3f9f48f..83a66d4 100644
--- a/autopart.py
+++ b/autopart.py
@@ -246,7 +246,7 @@ def fitConstrained(diskset, requests, primOnly=0, newParts = None):
raise PartitioningError, "Cannot create another primary partition for %s." % request.mountpoint
# check to make sure we can still create more logical parts
if (len(partedUtils.get_logical_partitions(disk)) ==
- partedUtils.get_max_logical_partitions(disk)):
+ disk.getMaxLogicalPartitions()):
raise PartitioningError, "Cannot create another logical partition for %s." % request.mountpoint
else:
partType = parted.PARTITION_PRIMARY
@@ -365,7 +365,7 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None):
numPrimary = numPrimary + 1
maxPrimary = disk.max_primary_partition_count
- maxLogical = partedUtils.get_max_logical_partitions(disk)
+ maxLogical = disk.getMaxLogicalPartitions()
for part in free[drive]:
# if this is a free space outside extended partition
diff --git a/partedUtils.py b/partedUtils.py
index 97c766d..2c6f9d5 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -163,17 +163,6 @@ def set_partition_file_system_type(part, fstype):
print("Failed to set partition type to ",fstype.getName())
pass
-def get_max_logical_partitions(disk):
- if not disk.type.check_feature(parted.DISK_TYPE_EXTENDED):
- return 0
- dev = disk.dev.path[5:]
- for key in max_logical_partition_count.keys():
- if dev.startswith(key):
- return max_logical_partition_count[key]
- # FIXME: if we don't know about it, should we pretend it can't have
- # logicals? probably safer to just use something reasonable
- return 11
-
def map_foreign_to_fsname(type):
"""Return the partition type associated with the numeric type."""
if type in allPartitionTypesDict.keys():
@@ -1374,18 +1363,3 @@ allPartitionTypesDict = {
0xfd: "Linux RAID",
0xff: "BBT"
}
-
-max_logical_partition_count = {
- "hd": 59,
- "sd": 11,
- "ataraid/": 11,
- "rd/": 3,
- "cciss/": 11,
- "i2o/": 11,
- "iseries/vd": 3,
- "ida/": 11,
- "sx8/": 11,
- "xvd": 11,
- "vd": 11,
- "mmcblk": 5
-}
--
1.6.1.3
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]