Browse Source

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
Alan Meadows 6 months ago
parent
commit
cdfb1737da

+ 23
- 0
images/maas-region-controller/2.3_bios_grub_partition.patch View File

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

+ 22
- 0
images/maas-region-controller/2.3_bios_grub_preseed.patch View File

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

+ 4
- 0
images/maas-region-controller/Dockerfile View File

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

Loading…
Cancel
Save