From 5440500624a503b3f91852cd17089aab76afe806 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Mon, 10 Jun 2019 15:19:27 +0200 Subject: [iec] Add basic CentOS support (virtual only) - reclass: iec: CentOS compatibility changes: * drop `proto: static` in favor of letting the linux formula set the appropiate default based on target OS; * replace `proto: manual` with `proto: none` on RHEL systems; * system.file: Avoid using non-existing `shadow` group for system files; * load br_netfilter kernel module to avoid `linux.network` state failures; * disable `at`, `cron` due to incomplete defaults in salt-formula-linux (since we don't use them on iec nodes anyway); - jumpserver/VCP VMs: centos: enable predictable interface names: * CentOS cloud image defaults to old 'eth' naming scheme; * add necessary kernel boot options via linux state; * cleanup auto-generated udev rules for old eth interface names; - salt-formula-linux: network: RHEL: Set bridge for member interfaces * Find the bridge containing the interface being currently configured (if any) and pass it to the `network.managed` Salt call; - deploy.sh: Add new deploy argument `-o` for specifying the operating system to preinstall on jumpserver and/or VCP VMs; * defaults to 'ubuntu1604'; * only iec scenarios will also support 'centos' for now; - user-data: minor tweaks for CentOS compatability: * use `systemctl` instead of `service` utility; * explicitly enable `salt-minion` service, since it defaults to disabled on RHEL systems; * explicitly call `ldconfig` to work around stale cache on RHEL, preventing `salt-minion` from using OpenSSL library; - states: virtual_init: Skip non-existing sysctl options on CentOS: * CentOS currently uses a 3.x kernel which lacks certain sysctl options that were only introduced in 4.x kernels, so skip them; - state: akraino_iec: Add centos support: * move iec repo to `/var/lib/akraino/iec` on both Salt Master and cluster nodes; - scenario defaults: Add CentOS configuration: * OS-dependent configuration split; * CentOS base image, default packages etc.; - AArch64 deploy requirements: Add `xz` dependency * CentOS AArch64 cloud image is archived using xz, install xz tools for decompression; - xdf_data: Make yaml parsing OS agnostic: * rename `apt` to `repo` where appropiate; * OS-dependent configuration parsing; - lib_jump_deploy: CentOS handling changes: * skip filesystem resize of cloud image for CentOS; * add repo handling, package intallation/removal handling for CentOS; * unxz base image if necessary (CentOS AArch64 cloud image); Change-Id: Ic3538bacd53198701ff4ef77db62218eabc662e7 Signed-off-by: Alexandru Avadanii --- mcp/config/states/akraino_iec | 18 +++++++++++++----- mcp/config/states/virtual_init | 6 +++++- 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'mcp/config/states') diff --git a/mcp/config/states/akraino_iec b/mcp/config/states/akraino_iec index 4e30ca582..e61ca9451 100755 --- a/mcp/config/states/akraino_iec +++ b/mcp/config/states/akraino_iec @@ -1,4 +1,5 @@ #!/bin/bash -e +# shellcheck disable=SC1090 ############################################################################## # Copyright (c) 2019 Mirantis Inc., Enea AB and others. # All rights reserved. This program and the accompanying materials @@ -9,18 +10,25 @@ CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x -# shellcheck disable=SC1090 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" +source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/xdf_data.sh" IEC_REPO_URI='https://gerrit.akraino.org/r/iec' -IEC_USER='ubuntu' -# shellcheck disable=SC2016 -IEC_REPO_PATH=$(su - "${IEC_USER}" -c 'echo ${HOME}/iec') +IEC_USER_L='ubuntu' +# shellcheck disable=SC2154 +if [[ "${base_image}" =~ centos ]]; then + IEC_USER='centos' +else + IEC_USER=${IEC_USER_L} +fi +IEC_REPO_PATH=/var/lib/akraino/iec IEC_SCRIPTS_PATH="${IEC_REPO_PATH}/src/foundation/scripts" POD_NETWORK_CIDR='100.100.0.0/16' # Avoid overlapping Fuel's PXE/admin net -[ -e "${IEC_REPO_PATH}" ] || su - "${IEC_USER}" -c \ +# shellcheck disable=SC2174 +mkdir -p -m 777 "$(dirname ${IEC_REPO_PATH})" +[ -e "${IEC_REPO_PATH}" ] || su - "${IEC_USER_L}" -c \ "git clone '${IEC_REPO_URI}' '${IEC_REPO_PATH}'" # shellcheck disable=SC2086 wait_for 3.0 "! salt-cp 'iec*' -C '${IEC_REPO_PATH}/' \ diff --git a/mcp/config/states/virtual_init b/mcp/config/states/virtual_init index 38a141a3e..77f4f5494 100755 --- a/mcp/config/states/virtual_init +++ b/mcp/config/states/virtual_init @@ -31,7 +31,11 @@ wait_for 3.0 "(for n in ${LOCAL_VIRT_NODES}; do salt -C \${n}.* test.ping || exi wait_for 3.0 "salt -C 'E@^(${NODE_MASK}).*' saltutil.sync_all" [[ ! "${NODE_MASK}" =~ mas01 ]] || exit 0 -wait_for 3.0 "salt -C 'E@^(${NODE_MASK}).*' state.sls linux" +if [[ "${base_image}" =~ centos ]]; then + # CentOS uses an older kernel, skip non-existing sysctl options + EXCLUDE_IDS="exclude='[{id: linux_kernel_net.core.netdev_budget_usecs}]'" +fi +wait_for 3.0 "salt -C 'E@^(${NODE_MASK}).*' state.sls linux ${EXCLUDE_IDS}" salt -C "E@^(${NODE_MASK}).*" cmd.run 'reboot' wait_for 90.0 "salt -C 'E@^(${NODE_MASK}).*' test.ping" -- cgit 1.2.3-korg