all: Pin Ubuntu kernel to 5.0.0-37 for Bionic 78/69578/2
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 20 Jan 2020 11:12:50 +0000 (12:12 +0100)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Tue, 28 Jan 2020 13:10:18 +0000 (13:10 +0000)
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 <Alexandru.Avadanii@enea.com>
(cherry picked from commit 04f7737967a1a9e84c6e17482acd466b46eebc48)

ci/deploy.sh
mcp/config/scenario/defaults.yaml.j2
mcp/patches/salt-formula-maas/0006-curtin-Add-Bionic-support.patch
mcp/reclass/classes/cluster/all-mcp-arch-common/infra/maas.yml.j2
mcp/reclass/classes/cluster/all-mcp-arch-common/opnfv/init.yml.j2
mcp/scripts/globals.sh
mcp/scripts/pharos

index de631e8..d04c4b2 100755 (executable)
@@ -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"
index cd5cb04..48fb954 100644 (file)
@@ -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
index 1f53697..a279e01 100644 (file)
@@ -12,19 +12,19 @@ Subject: [PATCH] curtin: Add Bionic support
 
 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
 ---
- .../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"
index 57da919..188269a 100644 (file)
@@ -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:
index 2e88d9c..755d2cb 100644 (file)
@@ -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 %}
index 29506dc..e5d1dec 100644 (file)
@@ -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}
index 9b9235e..061b558 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 9b9235ea136928b8148c57b1c3f3ddee6f761e66
+Subproject commit 061b5588d40253193eddf76139c361d62e6fbeb4