From 97c25a048689a5e40d97be2cc17e50e8f41d9249 Mon Sep 17 00:00:00 2001 From: Phil Sphicas Date: Thu, 28 May 2020 06:57:15 +0000 Subject: [PATCH] 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 --- charts/maas/templates/bin/_start.sh.tpl | 5 +++++ charts/maas/values.yaml | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/charts/maas/templates/bin/_start.sh.tpl b/charts/maas/templates/bin/_start.sh.tpl index af5b2d0..f5d4bef 100644 --- a/charts/maas/templates/bin/_start.sh.tpl +++ b/charts/maas/templates/bin/_start.sh.tpl @@ -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 diff --git a/charts/maas/values.yaml b/charts/maas/values.yaml index 0087799..63535d1 100644 --- a/charts/maas/values.yaml +++ b/charts/maas/values.yaml @@ -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