[PATCH 4/4] Put bios boot partitions on all gpt disk on bios systems. (#738964)

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

 



---
 pyanaconda/storage/partitioning.py |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 537b38f..2f98e1b 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -965,6 +965,40 @@ def doPartitioning(storage, bootloader=None):
     removeNewPartitions(disks, partitions)
     free = getFreeRegions(disks)
 
+    if storage.platform.weight(fstype="biosboot") > 0:
+        # add a request for a bios boot partition on every disk that contains a
+        # gpt disklabel if we're on a bios platform.
+        # XXX we can't just use GRUB2._gpt_disk_has_bios_boot because it can't
+        #     see not-yet-allocated partitions
+        for disk in disks:
+            if getattr(disk.format, "labelType", None) == "gpt":
+                has_bios_boot = False
+                for new in [p for p in partitions if p.req_disks == [disk]]:
+                    if new.format.type == "biosboot":
+                        has_bios_boot = True
+                        break
+
+                if has_bios_boot:
+                    continue
+
+                free_list = disk.format.partedDisk.getFreeSpaceRegions()
+                free_list.sort(key=lambda f: f.length, reverse=True)
+                free = 0
+                if free_list:
+                    free_space = sectorsToSize(free_list[0].length,
+                                               free_list[0].device.sectorSize)
+                    used = sum([p.req_size for p in partitions])
+                    free = free_space - used
+
+                if free <= 0:
+                    log.warning("can't add BIOS Boot partition to full disk %s"
+                                % disk.name)
+
+                part = storage.newPartition(fmt_type="biosboot", parents=[disk],
+                                            size=1)
+                storage.createDevice(part)
+                partitions.append(part)
+
     try:
         allocatePartitions(storage, disks, partitions, free,
                            bootloader=bootloader)
-- 
1.7.6

_______________________________________________
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