summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--autopart.py2
-rw-r--r--partedUtils.py18
-rw-r--r--partitions.py2
3 files changed, 2 insertions, 20 deletions
diff --git a/autopart.py b/autopart.py
index 4600f5c56..7d09d95b7 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 ab473c89f..35175859b 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 53091ac54..44205bc49 100644
--- a/partitions.py
+++ b/partitions.py
@@ -433,7 +433,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():