maas-region: option to always use GPT

MAAS uses MBR for boot disks smaller than 2 TiB. This change provides an
option to force the use of GPT, regardless of boot disk size. The chart
value is: conf.maas.force_gpt=true.

The 2 TiB "threshold" for when GPT is required is simply lowered to 0:
https://github.com/maas/maas/blob/2.3/src/maasserver/models/partitiontable.py#L51-L53

This change could be accomplished with a patch to the maas-region image
directly, but then it would not be configurable, and it may not be
useful for all users. Using sed in the startup script seems like a fair
solution.

Change-Id: I87d3f4b9c97048cdef383cbd15c5a16ac219066b
This commit is contained in:
Phil Sphicas 2020-05-28 06:57:15 +00:00
parent 1f13d56418
commit 97c25a0486
2 changed files with 11 additions and 0 deletions

View File

@ -52,5 +52,10 @@ done
if [[ $sh_set = false ]]; then
exit 1
fi
{{- if .Values.conf.maas.force_gpt }}
# Forcing the use of GPT irrespective of boot disk size
# https://github.com/maas/maas/blob/2.3/src/maasserver/models/partitiontable.py#L51-L53
sed -i '/^GPT_REQUIRED_SIZE =/c\GPT_REQUIRED_SIZE = 0' /usr/lib/python3/dist-packages/maasserver/models/partitiontable.py
{{- end }}
set -e
exec /sbin/init --log-target=console 3>&1

View File

@ -235,6 +235,12 @@ conf:
secret:
namespace: maas
name: maas-api-key
# By default, MAAS will use MBR for boot disks smaller than 2 TiB.
# Set force_gpt: true to always use GPT.
# NOTE: This is not a standard MAAS setting, and enabling it will cause
# modification of a file during maas-region pod startup:
# /usr/lib/python3/dist-packages/maasserver/models/partitiontable.py
force_gpt: false
extra_settings:
# Additional settings available via maas $PROFILE maas set-config
# Marks if the initial intro has been completed: true or false