[PATCH 2/2] Obtain device alignment information from parted. (#529051)

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

 



---
 storage/partitioning.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/storage/partitioning.py b/storage/partitioning.py
index a23efb3..8c6858f 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -583,7 +583,16 @@ def getDiskAlignment(disk):
             disk -- a parted.Disk instance
 
     """
-    return parted.Alignment(offset=0, grainSize=1)
+    device = disk.device
+    try:
+        a = device.optimumAlignment.intersect(disk.partitionAlignment)
+    except ArithmeticError:
+        try:
+            a = device.minimumAlignment.intersect(disk.partitionAlignment)
+        except ArithmeticError:
+            a = disk.partitionAlignment
+
+    return a
 
 def sectorsToSize(sectors, sectorSize):
     """ Convert length in sectors to size in MB.
-- 
1.6.5.2

_______________________________________________
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