adding support to append grub cmdline params

The aim of this PS is to add support for appending grub cmdline
params per node image type. For example for worker node we may
need to apply hugepages and cpu pinning params.

Change-Id: Ieb6104100325cf888046d31da0327b01eaa280ac
This commit is contained in:
Pallav Gupta 2021-03-18 13:29:07 -07:00
parent 7f03302e89
commit e932a714f7
8 changed files with 28 additions and 10 deletions

View File

@ -118,8 +118,9 @@ else
export user_data=$(QCOW_BUNDLE)/$$subdir/user_data
export network_config=$(QCOW_BUNDLE)/$$subdir/network_data.json
# QCOW configs
export osconfig_params=$(QCOW_BUNDLE)/$$subdir/osconfig-*-vars.yaml
export qcow_params=$(QCOW_BUNDLE)/$$subdir/qcow-*-vars.yaml
qcow_type=$$(echo $$subdir | sed -e "s/^qcow-//")
export osconfig_params="$(QCOW_BUNDLE)/$$subdir/osconfig-$$qcow_type-vars.yaml"
export qcow_params="$(QCOW_BUNDLE)/$$subdir/qcow-$$qcow_type-vars.yaml"
# Shared configs
export img_name=$$(cat $(QCOW_BUNDLE)/$$subdir/img_name)
sudo -E tools/cut_image.sh $(IMAGE_TYPE) $(QCOW_BUNDLE) $(IMAGE) "$(PROXY)" "$(NO_PROXY)"

View File

@ -1,4 +1,7 @@
# Settings here will be applied to /boot/grub/grub.cfg when grub is installed
- name: "Append any user-defined grub cmdline linux default"
set_fact:
grub_cmdline_linux_default: "{% if grub_cmdline_linux_default_append is defined %}{{ grub.GRUB_CMDLINE_LINUX_DEFAULT + grub_cmdline_linux_default_append }}{% else %}{{ grub.GRUB_CMDLINE_LINUX_DEFAULT }}{% endif %}"
- name: "Grub | Grub config"
template:
src: grub.j2

View File

@ -18,7 +18,7 @@
when: run_context == default_run_context
- name: "configure grub"
include_tasks: grub.yaml
when: run_context == default_run_context
when: run_context == default_run_context or run_context == qcow_run_context
- name: "configure kdump-tools"
include_tasks: kdump-tools.yaml
when: run_context == default_run_context

View File

@ -9,7 +9,7 @@ GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT={{ grub.GRUB_TIMEOUT }}
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
{% set ns = namespace (content = '') %}
{% for arg in grub.GRUB_CMDLINE_LINUX_DEFAULT %}
{% for arg in grub_cmdline_linux_default %}
{% set ns.content = ns.content + ' ' + arg.name + '=' + arg.value %}
{% endfor %}
GRUB_CMDLINE_LINUX_DEFAULT="{{ ns.content }}"

View File

@ -1,5 +1,4 @@
# Custom user-defined overrides to the `osconfig` playbook can be placed here.
#
# You would only use this if you needed to apply some settings uniques to this
# type of image (control-plane or data-plane). Ex: kernel boot params specific
# to workers vs non-worker nodes.
# You would only use this if you needed to apply some settings uniques to
# control-plane image. Ex: kernel boot params specific to non-worker nodes.

View File

@ -1 +0,0 @@
../qcow-control-plane/osconfig-control-plane-vars.yaml

View File

@ -0,0 +1,18 @@
# Custom user-defined overrides to the `osconfig` playbook can be placed here.
#
# You would only use this if you needed to apply some settings uniques to
# data-plane image. Ex: hugepages and cpu pinning configuration
# grub_cmdline_linux_default_append:
# - name: hugepagesz
# value: "1G"
# - name: hugepages
# value: "100"
# - name: default_hugepagesz
# value: "1G"
# - name: isolcpus
# value: "4-43,48-87"
# - name: rcu_nocbs
# value: "4-43,48-87"
# - name: transparent_hugepage
# value: "never"

View File

@ -25,8 +25,6 @@ workdir="$(realpath ${host_mount_directory})"
# Overrides
: ${user_data:=$workdir/user_data}
: ${network_config:=$workdir/network_data.json}
: ${osconfig_params:=$workdir/qcow-control-plane/osconfig-control-plane-vars.yaml}
: ${qcow_params:=$workdir/qcow-control-plane/qcow-control-plane-vars.yaml}
if [ -n "$proxy" ]; then
export http_proxy=$proxy