From 04f7737967a1a9e84c6e17482acd466b46eebc48 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Mon, 20 Jan 2020 12:12:50 +0100 Subject: [PATCH] all: Pin Ubuntu kernel to 5.0.0-37 for Bionic Ubuntu kernel meta packages are all broken on at least one platform architecture, so pin the kernel version to 5.0.0-37, which is known to be stable. Make the kernel version configurable via a new enviroment variable, MCP_KERNEL_VER in globals.sh. If not defined, the ga-18.04 kernel is left unchanged (based on upstream kernel 4.15), except for baremetal nodes providioned by MaaS which currently use the HWE kernel (based on 5.3 in Bionic). Change-Id: I648d09b22f6080efd2bce26b6a06fecc3f6b4599 Signed-off-by: Alexandru Avadanii --- ci/deploy.sh | 2 +- mcp/config/scenario/defaults.yaml.j2 | 10 +++++--- .../0006-curtin-Add-Bionic-support.patch | 30 +++++++++++++++++----- .../cluster/all-mcp-arch-common/infra/maas.yml.j2 | 17 ++++++++++++ .../cluster/all-mcp-arch-common/opnfv/init.yml.j2 | 6 +++++ mcp/scripts/globals.sh | 1 + mcp/scripts/pharos | 2 +- 7 files changed, 55 insertions(+), 13 deletions(-) diff --git a/ci/deploy.sh b/ci/deploy.sh index de631e860..d04c4b23c 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -298,7 +298,7 @@ export MAAS_SSH_KEY="$(cat "$(basename "${SSH_KEY}").pub")" [[ "${DEPLOY_SCENARIO}" =~ -ha$ ]] || MCP_VCP=0 export MCP_REPO_ROOT_PATH MCP_VCP MCP_STORAGE_DIR MCP_DOCKER_TAG MCP_CMP_SS \ MCP_JUMP_ARCH=$(uname -i) MCP_DEPLOY_SCENARIO="${DEPLOY_SCENARIO}" \ - MCP_NO_DEPLOY_ENVIRONMENT MCP_OS + MCP_NO_DEPLOY_ENVIRONMENT MCP_OS MCP_KERNEL_VER do_templates_scenario "${MCP_STORAGE_DIR}" "${TARGET_LAB}" "${TARGET_POD}" \ "${BASE_CONFIG_URI}" "${SCENARIO_DIR}" \ "${SCENARIO_DIR}/${DEPLOY_SCENARIO}.yaml" diff --git a/mcp/config/scenario/defaults.yaml.j2 b/mcp/config/scenario/defaults.yaml.j2 index cd5cb04cd..48fb954cc 100644 --- a/mcp/config/scenario/defaults.yaml.j2 +++ b/mcp/config/scenario/defaults.yaml.j2 @@ -33,8 +33,9 @@ x86_64: - saltstack 500 deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/18.04/amd64/2017.7 bionic main pkg: install: - {%- if '-iec-' not in conf.MCP_DEPLOY_SCENARIO %} - - linux-generic-hwe-18.04 + {%- if '-iec-' not in conf.MCP_DEPLOY_SCENARIO and conf.MCP_KERNEL_VER %} + - linux-image-{{ conf.MCP_KERNEL_VER }}-generic + - linux-headers-{{ conf.MCP_KERNEL_VER }}-generic {%- endif %} - salt-minion - ifupdown @@ -99,8 +100,9 @@ aarch64: - saltstack 500 deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/18.04/amd64/2017.7 bionic main pkg: install: - {%- if '-iec-' not in conf.MCP_DEPLOY_SCENARIO %} - - linux-generic-hwe-18.04 + {%- if '-iec-' not in conf.MCP_DEPLOY_SCENARIO and conf.MCP_KERNEL_VER %} + - linux-image-{{ conf.MCP_KERNEL_VER }}-generic + - linux-headers-{{ conf.MCP_KERNEL_VER }}-generic {%- endif %} - salt-minion - ifupdown diff --git a/mcp/patches/salt-formula-maas/0006-curtin-Add-Bionic-support.patch b/mcp/patches/salt-formula-maas/0006-curtin-Add-Bionic-support.patch index 1f53697ad..a279e019d 100644 --- a/mcp/patches/salt-formula-maas/0006-curtin-Add-Bionic-support.patch +++ b/mcp/patches/salt-formula-maas/0006-curtin-Add-Bionic-support.patch @@ -12,19 +12,19 @@ Subject: [PATCH] curtin: Add Bionic support Signed-off-by: Alexandru Avadanii --- - .../curtin_userdata_amd64_generic_bionic | 80 +++++++++++++++++++ - .../curtin_userdata_arm64_generic_bionic | 65 +++++++++++++++ + .../curtin_userdata_amd64_generic_bionic | 83 +++++++++++++++++++ + .../curtin_userdata_arm64_generic_bionic | 78 +++++++++++++++++ maas/region.sls | 24 ++++++ - 3 files changed, 169 insertions(+) + 3 files changed, 185 insertions(+) create mode 100644 maas/files/curtin_userdata_amd64_generic_bionic create mode 100644 maas/files/curtin_userdata_arm64_generic_bionic diff --git a/maas/files/curtin_userdata_amd64_generic_bionic b/maas/files/curtin_userdata_amd64_generic_bionic new file mode 100644 -index 0000000..0b6fd15 +index 0000000..6b01a58 --- /dev/null +++ b/maas/files/curtin_userdata_amd64_generic_bionic -@@ -0,0 +1,80 @@ +@@ -0,0 +1,83 @@ +{%- from "maas/map.jinja" import cluster with context %} +{%- raw %} +#cloud-config @@ -63,6 +63,9 @@ index 0000000..0b6fd15 + apt_04_install_pkgs_{{ loop.index }}: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{ pkg }}"] + {% endfor %} +{%- endif %} ++{%- if salt['pillar.get']('maas:cluster:curtin_vars:amd64:bionic:kernel_package:enabled')|default(false) %} ++ apt_05_kernel_old_absent: ["curtin", "in-target", "--", "sh", "-c", "dpkg -l '*linux-generic-*[0-9]*' '*linux-image-*[0-9]*' '*linux-headers-*[0-9]*' '*linux-image-extra-*[0-9]*' '*linux-modules-extra-*[0-9]*' 2>/dev/null | grep -E '^ii' | awk '{print $2}' | grep -v '{{ pillar.maas.cluster.curtin_vars.amd64.bionic.kernel_package.value.split('-')[2:-1] | join('-') }}' | xargs dpkg --purge --force-depends"] ++{%- endif %} + salt_01_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "salt-minion", "ifupdown", "cloud-init", "dnsmasq"] + salt_02_hostname_set: ["curtin", "in-target", "--", "echo", "{% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}"] + salt_03_hostname_get: ["curtin", "in-target", "--", "sh", "-c", "echo 'id: {% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}' >> /etc/salt/minion.d/minion.conf"] @@ -107,10 +110,10 @@ index 0000000..0b6fd15 +#} diff --git a/maas/files/curtin_userdata_arm64_generic_bionic b/maas/files/curtin_userdata_arm64_generic_bionic new file mode 100644 -index 0000000..c7cb997 +index 0000000..54c908c --- /dev/null +++ b/maas/files/curtin_userdata_arm64_generic_bionic -@@ -0,0 +1,65 @@ +@@ -0,0 +1,78 @@ +{%- from "maas/map.jinja" import cluster with context %} +{% raw %} +#cloud-config @@ -143,6 +146,14 @@ index 0000000..c7cb997 +{#- NOTE: Re-use amd64 repos on arm64 since most packages are arch independent #} + apt_01_set_repo: ["curtin", "in-target", "--", "sh", "-c", "echo '{{ saltstack_repo }}' >> /etc/apt/sources.list.d/mcp_saltstack.list"] + apt_03_update: ["curtin", "in-target", "--", "apt-get", "update"] ++{%- if salt['pillar.get']('maas:cluster:curtin_vars:arm64:bionic:extra_pkgs:enabled')|default(false) %} ++ {% for pkg in pillar.maas.cluster.curtin_vars.arm64.bionic.extra_pkgs.pkgs -%} ++ apt_04_install_pkgs_{{ loop.index }}: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{ pkg }}"] ++ {% endfor %} ++{%- endif %} ++{%- if salt['pillar.get']('maas:cluster:curtin_vars:arm64:bionic:kernel_package:enabled')|default(false) %} ++ apt_05_kernel_old_absent: ["curtin", "in-target", "--", "sh", "-c", "dpkg -l '*linux-generic-*[0-9]*' '*linux-image-*[0-9]*' '*linux-headers-*[0-9]*' '*linux-image-extra-*[0-9]*' '*linux-modules-extra-*[0-9]*' 2>/dev/null | grep -E '^ii' | awk '{print $2}' | grep -v '{{ pillar.maas.cluster.curtin_vars.arm64.bionic.kernel_package.value.split('-')[2:-1] | join('-') }}' | xargs dpkg --purge --force-depends"] ++{%- endif %} + salt_01_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "salt-minion", "python-futures", "ifupdown", "cloud-init", "dnsmasq"] + salt_02_hostname_set: ["curtin", "in-target", "--", "echo", "{% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}"] + salt_03_hostname_get: ["curtin", "in-target", "--", "sh", "-c", "echo 'id: {% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}' >> /etc/salt/minion.d/minion.conf"] @@ -165,6 +176,11 @@ index 0000000..c7cb997 + salt_26_bionic_networking_enable: ["curtin", "in-target", "--", "systemctl", "enable", "networking.service"] + salt_27_bionic_networking_start: ["curtin", "in-target", "--", "systemctl", "start", "networking.service"] + ++{%- if salt['pillar.get']('maas:cluster:curtin_vars:arm64:bionic:kernel_package:enabled')|default(false) %} ++kernel: ++ package: {{ pillar.maas.cluster.curtin_vars.arm64.bionic.kernel_package.value }} ++{%- endif %} ++ +{% raw %} +{{if third_party_drivers and driver}} + driver_00_key_get: curtin in-target -- sh -c "/bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg" diff --git a/mcp/reclass/classes/cluster/all-mcp-arch-common/infra/maas.yml.j2 b/mcp/reclass/classes/cluster/all-mcp-arch-common/infra/maas.yml.j2 index 57da919de..188269a71 100644 --- a/mcp/reclass/classes/cluster/all-mcp-arch-common/infra/maas.yml.j2 +++ b/mcp/reclass/classes/cluster/all-mcp-arch-common/infra/maas.yml.j2 @@ -113,6 +113,23 @@ parameters: region: host: ${_param:single_address} port: 5240 +{%- if '-iec-' not in conf.MCP_DEPLOY_SCENARIO and conf.MCP_KERNEL_VER %} + curtin_vars: + amd64: + bionic: &curtin_vars_bionic + kernel_package: + enabled: True + value: 'linux-image-{{ conf.MCP_KERNEL_VER }}-generic' + extra_pkgs: + enabled: True + pkgs: + - linux-image-{{ conf.MCP_KERNEL_VER }}-generic + - linux-headers-{{ conf.MCP_KERNEL_VER }}-generic + - linux-modules-extra-{{ conf.MCP_KERNEL_VER }}-generic + arm64: + bionic: + <<: *curtin_vars_bionic +{%- endif %} linux: system: repo: diff --git a/mcp/reclass/classes/cluster/all-mcp-arch-common/opnfv/init.yml.j2 b/mcp/reclass/classes/cluster/all-mcp-arch-common/opnfv/init.yml.j2 index 2e88d9cdc..755d2cb08 100644 --- a/mcp/reclass/classes/cluster/all-mcp-arch-common/opnfv/init.yml.j2 +++ b/mcp/reclass/classes/cluster/all-mcp-arch-common/opnfv/init.yml.j2 @@ -38,3 +38,9 @@ parameters: {%- for server in nm.dns_public %} - {{ server }} {%- endfor %} +{%- if '-iec-' not in conf.MCP_DEPLOY_SCENARIO and conf.MCP_KERNEL_VER %} + system: + kernel: + version: '{{ conf.MCP_KERNEL_VER }}' + headers: True +{%- endif %} diff --git a/mcp/scripts/globals.sh b/mcp/scripts/globals.sh index 29506dc8f..e5d1decc6 100644 --- a/mcp/scripts/globals.sh +++ b/mcp/scripts/globals.sh @@ -13,6 +13,7 @@ export SSH_KEY=${SSH_KEY:-"/var/lib/opnfv/mcp.rsa"} export SALT_MASTER=${INSTALLER_IP:-10.20.0.2} export SALT_MASTER_USER=${SALT_MASTER_USER:-ubuntu} export VIRSH=${VIRSH:-'virsh --connect qemu:///system'} +export MCP_KERNEL_VER=${MCP_KERNEL_VER:-5.0.0-37} # Derived from INSTALLER_IP export MCPCONTROL_NET=${MCPCONTROL_NET:-${SALT_MASTER%.*}.0} diff --git a/mcp/scripts/pharos b/mcp/scripts/pharos index 9b9235ea1..061b5588d 160000 --- a/mcp/scripts/pharos +++ b/mcp/scripts/pharos @@ -1 +1 @@ -Subproject commit 9b9235ea136928b8148c57b1c3f3ddee6f761e66 +Subproject commit 061b5588d40253193eddf76139c361d62e6fbeb4 -- 2.16.6