Bugfix Bios Grub Partition Behavior

MaaS 2.3.5 added bios grub partition changes that no
longer cared for the size of the storage device nor
whether it was a boot device.  This patch effectively
restores the original behavior which was also
reintroduced in MaaS 2.4.0.

Change-Id: I8b7b38fe42b005a656e6c5cab615c144b6a90b22
This commit is contained in:
Alan Meadows 2018-10-18 09:28:11 -07:00
parent 52ddfdcf4d
commit cdfb1737da
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,23 @@
--- partition.py 2018-10-18 09:04:40.300721829 -0700
+++ partition2.py 2018-10-18 09:08:27.952565248 -0700
@@ -179,6 +179,8 @@
def get_partition_number(self):
"""Return the partition number in the table."""
+ # Circular imports.
+ from maasserver.models.partitiontable import GPT_REQUIRED_SIZE
# Sort manually instead of with `order_by`, this will prevent django
# from making a query if the partitions are already cached.
partitions_in_table = self.partition_table.partitions.all()
@@ -196,7 +198,10 @@
block_device = self.partition_table.block_device
if (arch == "ppc64el" and block_device.id == boot_disk.id):
return idx + 2
- elif arch == "amd64" and bios_boot_method != "uefi":
+ elif (arch == "amd64" and
+ self.partition_table.block_device.id == boot_disk.id and
+ bios_boot_method != "uefi" and
+ boot_disk.size >= GPT_REQUIRED_SIZE):
return idx + 2
else:
return idx + 1

View File

@ -0,0 +1,22 @@
--- preseed_storage.py 2018-10-18 09:09:24.372519602 -0700
+++ preseed_storage2.py 2018-10-18 09:10:30.112463704 -0700
@@ -22,6 +22,7 @@
from maasserver.models.partition import Partition
from maasserver.models.partitiontable import (
BIOS_GRUB_PARTITION_SIZE,
+ GPT_REQUIRED_SIZE,
INITIAL_PARTITION_OFFSET,
PARTITION_TABLE_EXTRA_SPACE,
PREP_PARTITION_SIZE,
@@ -127,7 +128,10 @@
"""Return True if block device requires the bios_grub partition."""
arch, _ = self.node.split_arch()
bios_boot_method = self.node.get_bios_boot_method()
- return arch == "amd64" and bios_boot_method != "uefi"
+ return (
+ arch == "amd64" and
+ bios_boot_method != "uefi" and
+ block_device.size >= GPT_REQUIRED_SIZE)
def _add_partition_operations(self):
"""Add all the partition operations.

View File

@ -57,9 +57,13 @@ RUN apt-get download maas-region-controller=$MAAS_VERSION && \
COPY 2.3_proxy_port.patch /tmp/2.3_proxy_port.patch COPY 2.3_proxy_port.patch /tmp/2.3_proxy_port.patch
COPY 2.3_route.patch /tmp/2.3_route.patch COPY 2.3_route.patch /tmp/2.3_route.patch
COPY 2.3_kernel_package.patch /tmp/2.3_kernel_package.patch COPY 2.3_kernel_package.patch /tmp/2.3_kernel_package.patch
COPY 2.3_bios_grub_partition.patch /tmp/2.3_bios_grub_partition.patch
COPY 2.3_bios_grub_preseed.patch /tmp/2.3_bios_grub_preseed.patch
RUN cd /usr/lib/python3/dist-packages/maasserver && patch compose_preseed.py < /tmp/2.3_proxy_port.patch RUN cd /usr/lib/python3/dist-packages/maasserver && patch compose_preseed.py < /tmp/2.3_proxy_port.patch
RUN cd /usr/lib/python3/dist-packages/maasserver && patch preseed_network.py < /tmp/2.3_route.patch RUN cd /usr/lib/python3/dist-packages/maasserver && patch preseed_network.py < /tmp/2.3_route.patch
RUN cd /usr/lib/python3/dist-packages/maasserver && patch preseed.py < /tmp/2.3_kernel_package.patch RUN cd /usr/lib/python3/dist-packages/maasserver && patch preseed.py < /tmp/2.3_kernel_package.patch
RUN cd /usr/lib/python3/dist-packages/maasserver/models && patch partition.py < /tmp/2.3_bios_grub_partition.patch
RUN cd /usr/lib/python3/dist-packages/maasserver && patch preseed_storage.py < /tmp/2.3_bios_grub_preseed.patch
COPY journalctl-to-tty.service /etc/systemd/system/journalctl-to-tty.service COPY journalctl-to-tty.service /etc/systemd/system/journalctl-to-tty.service
RUN mkdir -p /etc/systemd/system/basic.target.wants ;\ RUN mkdir -p /etc/systemd/system/basic.target.wants ;\