[PATCH 16/47] Remove partedUtils.getMaxAvailPartSizeMB()

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

 



This function is now provided as a method on parted.Partition
objects.
---
 autopart.py    |    2 +-
 partedUtils.py |   18 ------------------
 partitions.py  |    2 +-
 3 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/autopart.py b/autopart.py
index 9ad1c4e..02923b9 100644
--- a/autopart.py
+++ b/autopart.py
@@ -1026,7 +1026,7 @@ def processPartitioning(diskset, requests, newParts):
             # we need to keep track of the max size of preexisting partitions
             # FIXME: we should also get the max size for LVs at some point
             part = partedUtils.get_partition_by_name(diskset.disks, request.device)
-            request.maxResizeSize = partedUtils.getMaxAvailPartSizeMB(part)
+            request.maxResizeSize = part.getMaxAvailableSize(unit="MB")
 
 ##     print("disk layout after everything is done")
 ##     print(diskset.diskState())
diff --git a/partedUtils.py b/partedUtils.py
index e28b3d9..0639dff 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -48,24 +48,6 @@ log = logging.getLogger("anaconda")
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
 
-def getMaxAvailPartSizeMB(part):
-    """Return the maximum size this partition can grow to by looking
-    at contiguous freespace partitions."""
-
-    disk = part.disk
-    maxlen = part.geom.length
-
-    # let's look at the next partition(s) and if they're freespace,
-    # they can add to our maximum size.
-    np = disk.next_partition(part)
-    while np:
-        if np.type & parted.PARTITION_FREESPACE:
-            maxlen += np.geom.length
-        else:
-            break
-        np = disk.next_partition(np)
-    return math.floor(maxlen * part.geom.dev.sector_size / 1024.0 / 1024.0)
-
 def get_partition_by_name(disks, partname):
     """Return the parted part object associated with partname.  
 
diff --git a/partitions.py b/partitions.py
index 2c371c8..b8b2ca2 100644
--- a/partitions.py
+++ b/partitions.py
@@ -430,7 +430,7 @@ class Partitions:
                                                              format = format)
                 spec.device = fsset.PartedPartitionDevice(part).getDevice()
                 spec.encryption = luksDev
-                spec.maxResizeSize = partedUtils.getMaxAvailPartSizeMB(part)
+                spec.maxResizeSize = part.getMaxAvailableSize(unit="MB")
 
                 # set label if makes sense
                 if ptype and ptype.isMountable():
-- 
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