lvmLog.debug( "Trying partition %s" % (printFreespaceitem(part),))
- partSize = partedUtils.getPartSizeMB(part)
+ partSize = part.getSize(unit="MB")
# figure out what the request size will be given the
# geometry (#130885)
requestSectors = long((request.requestSize * 1024L * 1024L) / part.disk.dev.sector_size) - 1
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 5bf359e..4b43751 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -146,7 +146,7 @@ class DiskStripeSlice:
rc = "Free
"
else:
rc = "%s
" % (get_partition_name(self.partition),)
- rc = rc + "%Ld MB" % (getPartSizeMB(self.partition),)
+ rc = rc + "%Ld MB" % (self.partition.getSize(unit="MB"),)
return rc
def getDeviceName(self):
@@ -835,7 +835,7 @@ class PartitionWindow(InstallWindow):
part = disk.next_partition(part)
continue
# ignore the tiny < 1 MB partitions (#119479)
- if getPartSizeMB(part) <= 1.0:
+ if part.getSize(unit="MB") <= 1.0:
if not part.is_active() or not part.get_flag(parted.PARTITION_BOOT):
part = disk.next_partition(part)
continue
@@ -945,7 +945,7 @@ class PartitionWindow(InstallWindow):
part.geom.start))
self.tree[iter]['End'] = str(end_sector_to_cyl(disk.dev,
part.geom.end))
- size = getPartSizeMB(part)
+ size = part.getSize(unit="MB")
if size < 1.0:
sizestr = "< 1"
else:
diff --git a/partRequests.py b/partRequests.py
index 891afdf..fc108f2 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -521,7 +521,7 @@ class PartitionSpec(RequestSpec):
if not part:
# XXX kickstart might still call this before allocating the partitions
raise RuntimeError, "Checking the size of a partition which hasn't been allocated yet"
- return partedUtils.getPartSizeMB(part)
+ return part.getSize(unit="MB")
def doSizeSanityCheck(self):
"""Sanity check that the size of the partition is sane."""
diff --git a/partedUtils.py b/partedUtils.py
index ad14a78..cd32c18 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -70,11 +70,6 @@ def getPartSize(partition):
"""Return the size of partition in sectors."""
return partition.geom.length
-def getPartSizeMB(partition):
- """Return the size of partition in megabytes."""
- return (partition.geom.length * partition.geom.dev.sector_size
- / 1024.0 / 1024.0)
-
def getMaxAvailPartSizeMB(part):
"""Return the maximum size this partition can grow to by looking
at contiguous freespace partitions."""
@@ -149,7 +144,7 @@ def get_partition_file_system_type(part):
elif part.fs_type == None:
return None
elif (part.get_flag(parted.PARTITION_BOOT) == 1 and
- getPartSizeMB(part) <= 1 and part.fs_type.name == "hfs"):
+ part.getSize(unit="MB") <= 1 and part.fs_type.name == "hfs"):
ptype = fsset.fileSystemTypeGet("Apple Bootstrap")
elif part.fs_type.name == "linux-swap":
ptype = fsset.fileSystemTypeGet("swap")
diff --git a/partitions.py b/partitions.py
index b98a374..97c3271 100644
--- a/partitions.py
+++ b/partitions.py
@@ -419,7 +419,7 @@ class Partitions:
if not used:
rc.append((partname, size, 0))
@@ -929,7 +929,7 @@ class Partitions:
if size is None:
# if we get here, there's no PV data in the partition,
# so clamp the partition's size to 64M
- size = partedUtils.getPartSizeMB(part)
+ size = part.getSize(unit="MB")
size = lvm.clampPVSize(size, 65536)
if used == 0:
diff --git a/textw/partition_text.py b/textw/partition_text.py
index 9598168..0d9b162 100644
--- a/textw/partition_text.py
+++ b/textw/partition_text.py
@@ -145,7 +145,7 @@ class PartitionWindow:
part = disk.next_partition(part)
continue
# ignore the tiny < 1 MB partitions (#119479)
- if getPartSizeMB(part) <= 1.0:
+ if part.getSize(unit="MB") <= 1.0:
if not part.is_active() or not part.get_flag(parted.PARTITION_BOOT):
part = disk.next_partition(part)
continue
--
1.6.1.3
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list