[PATCH 11/47] Remove partedUtils.get_logical_partitions()

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

 



Now provided by parted.Disk.getLogicalPartitions()
---
 autopart.py    |    6 +++---
 partedUtils.py |    6 ------
 partitions.py  |    2 +-
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/autopart.py b/autopart.py
index 6f2e720..c169f1e 100644
--- a/autopart.py
+++ b/autopart.py
@@ -245,7 +245,7 @@ def fitConstrained(diskset, requests, primOnly=0, newParts = None):
                     if request.primary: # they've required a primary and we can't do it
                         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)) ==
+                    if (len(disk.getLogicalPartitions()) ==
                         disk.getMaxLogicalPartitions()):
                         raise PartitioningError, "Cannot create another logical partition for %s." % request.mountpoint
                 else:
@@ -358,7 +358,7 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None):
 ##               print("Trying drive", drive)
                 disk = diskset.disks[drive]
                 numPrimary = len(partedUtils.get_primary_partitions(disk))
-                numLogical = len(partedUtils.get_logical_partitions(disk))
+                numLogical = len(disk.getLogicalPartitions())
 
                 # if there is an extended partition add it in
 		if disk.extended_partition:
@@ -1222,7 +1222,7 @@ def doClearPartAction(anaconda, partitions, diskset):
         disk = diskset.disks[drive]
         ext = disk.extended_partition
         # if the extended is empty, blow it away
-        if ext and len(partedUtils.get_logical_partitions(disk)) == 0:
+        if ext and len(disk.getLogicalPartitions()) == 0:
             delete = partRequests.DeleteSpec(drive, ext.geom.start,
                                              ext.geom.end)
             old = partitions.getRequestByDeviceName(ext.getDeviceNodeName())
diff --git a/partedUtils.py b/partedUtils.py
index cd8a08d..a201c31 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -159,12 +159,6 @@ def filter_partitions(disk, func):
 
     return rc
 
-def get_logical_partitions(disk):
-    """Return a list of logical PedPartition objects on disk."""
-    func = lambda part: (part.is_active()
-                         and part.type & parted.PARTITION_LOGICAL)
-    return filter_partitions(disk, func)
-
 def get_primary_partitions(disk):
     """Return a list of primary PedPartition objects on disk."""
     func = lambda part: part.type == parted.PARTITION_PRIMARY
diff --git a/partitions.py b/partitions.py
index 5f4ace9..94479a8 100644
--- a/partitions.py
+++ b/partitions.py
@@ -1693,7 +1693,7 @@ class Partitions:
 
     def deleteAllLogicalPartitions(self, part):
         """Add delete specs for all logical partitions in part."""
-        for partition in partedUtils.get_logical_partitions(part.disk):
+        for partition in part.disk.getLogicalPartitions():
             partName = partition.getDeviceNodeName()
             request = self.getRequestByDeviceName(partName)
             self.removeRequest(request)
-- 
1.6.1.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux