diff options
Diffstat (limited to 'mcp')
18 files changed, 118 insertions, 209 deletions
diff --git a/mcp/config/scenario/virtual/defaults.yaml b/mcp/config/scenario/defaults-aarch64.yaml index b841e88c9..17fbbfcbe 100644 --- a/mcp/config/scenario/virtual/defaults.yaml +++ b/mcp/config/scenario/defaults-aarch64.yaml @@ -1,6 +1,6 @@ -base_image: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img +base_image: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-arm64-uefi1.img virtual: default: - vcpus: 2 + vcpus: 6 ram: 4096 diff --git a/mcp/config/scenario/baremetal/defaults.yaml b/mcp/config/scenario/defaults-x86_64.yaml index b841e88c9..b841e88c9 100644 --- a/mcp/config/scenario/baremetal/defaults.yaml +++ b/mcp/config/scenario/defaults-x86_64.yaml diff --git a/mcp/config/states/dpdk b/mcp/config/states/dpdk index c1ec07e27..ad435630c 100755 --- a/mcp/config/states/dpdk +++ b/mcp/config/states/dpdk @@ -2,7 +2,7 @@ set -x salt -I 'nova:compute' system.reboot -while true; do salt -I 'nova:compute' test.ping | fgrep -q 'Not connected' || break; done +while true; do salt -I 'nova:compute' test.ping | grep -Fq 'Not connected' || break; done salt -I 'nova:compute' state.sls linux.network # switch to UCA repos since fuel-infra packages have bugs diff --git a/mcp/config/states/maas b/mcp/config/states/maas index 710ec0e82..db0bd3fe6 100755 --- a/mcp/config/states/maas +++ b/mcp/config/states/maas @@ -3,10 +3,12 @@ set -x function wait_for() { local total_attempts=$1; shift - local cmdstr=$@ + local cmdstr=$* local sleep_time=10 echo "[NOTE] Waiting for cmd to return success: ${cmdstr}" + # shellcheck disable=SC2034 for attempt in $(seq "${total_attempts}"); do + # shellcheck disable=SC2015 eval "${cmdstr}" && break || true echo -n '.'; sleep "${sleep_time}" done @@ -17,8 +19,10 @@ function maas_fixup() { local statuscmd="salt 'mas01*' --out yaml state.apply maas.machines.status" wait_for 180 "${statuscmd} | tee /dev/stderr | " \ "grep -Eq '((Deployed|Ready): 5|status:Failed|status:Allocated)'" + # shellcheck disable=SC2155 local statusout=$(eval "${statuscmd}") + # shellcheck disable=SC2155 local fcnodes=$(echo "${statusout}" | \ grep -Po '(?<=system_id:)(.*)(?=,status:Failed commissioning)') for node_system_id in ${fcnodes}; do @@ -30,6 +34,7 @@ function maas_fixup() { return 1 fi + # shellcheck disable=SC2155 local fdnodes=$(echo "${statusout}" | \ grep -Po '(?<=system_id:)(.*)(?=,status:(Failed deployment|Allocated))') for node_system_id in ${fdnodes}; do @@ -106,4 +111,4 @@ wait_for 10 "! salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply linux,ntp | "tee /dev/stderr | fgrep -q 'Not connected'" wait_for 10 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' ssh.set_auth_key ${SUDO_USER} \ - $(awk 'NR==1{print $2}' $(eval echo ~${SUDO_USER}/.ssh/authorized_keys))" + $(awk 'NR==1{print $2}' "$(eval echo "~${SUDO_USER}/.ssh/authorized_keys")")" diff --git a/mcp/patches/patch.sh b/mcp/patches/patch.sh index aac0017b2..6cd65fd10 100755 --- a/mcp/patches/patch.sh +++ b/mcp/patches/patch.sh @@ -2,7 +2,7 @@ if [ -r "$1" ]; then while IFS=': ' read -r p_dest p_file; do - [[ "${p_dest}" =~ "$2" ]] && \ + [[ "${p_dest}" =~ $2 ]] && \ patch -fd "${p_dest}" -p1 < "/root/fuel/mcp/patches/${p_file}" done < "$1" fi diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-common/infra/config.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-common/infra/config.yml new file mode 100644 index 000000000..a5fc3b1d3 --- /dev/null +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-common/infra/config.yml @@ -0,0 +1,64 @@ +classes: +- service.git.client +- system.linux.system.single +- system.linux.system.repo.mcp.salt +- system.salt.master.api +- system.salt.master.pkg +- system.reclass.storage.salt +- system.salt.minion.ca.salt_master +- system.salt.minion.cert.proxy +- system.mysql.client.single +- system.reclass.storage.system.openstack_compute_multi +- system.reclass.storage.system.openstack_gateway_single +parameters: + _param: + openstack_control_node01_hostname: ctl01 + reclass_data_repository: local + salt_master_environment_repository: "https://github.com/tcpcloud" + salt_master_environment_revision: master + reclass_config_master: 192.168.10.100 + single_address: 172.16.10.100 + salt_master_host: 127.0.0.1 + salt_master_base_environment: prd + salt_minion_ca_host: ${linux:network:fqdn} + salt_api_password_hash: "$6$sGnRlxGf$al5jMCetLP.vfI/fTl3Z0N7Za1aeiexL487jAtyRABVfT3NlwZxQGVhO7S1N8OwS/34VHYwZQA8lkXwKMN/GS1" + linux: + network: + interface: + ens4: + enabled: true + type: eth + proto: static + address: ${_param:single_address} + netmask: 255.255.255.0 + salt: + master: + file_recv: true + reclass: + storage: + data_source: + engine: local + node: + openstack_control_node01: + name: ${_param:openstack_control_node01_hostname} + domain: ${_param:cluster_domain} + classes: + - cluster.${_param:cluster_name}.openstack.control + params: + linux_system_codename: xenial + salt_master_host: ${_param:reclass_config_master} + single_address: ${_param:openstack_control_node01_address} + openstack_compute_node01: + params: + single_address: 172.16.10.105 + tenant_address: 10.1.0.105 + external_address: 10.16.0.105 + openstack_compute_node02: + params: + single_address: 172.16.10.106 + tenant_address: 10.1.0.106 + external_address: 10.16.0.106 + openstack_gateway_node01: + params: + tenant_address: 10.1.0.110 + external_address: 10.16.0.110 diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/infra/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-common/infra/init.yml index 9140bd0bc..9140bd0bc 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/infra/init.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-common/infra/init.yml diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/infra/config.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/infra/config.yml index 63e58a24b..c66ba2a9c 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/infra/config.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/infra/config.yml @@ -1,69 +1,14 @@ classes: -- service.git.client -- system.linux.system.single -- system.linux.system.repo.mcp.salt -- system.salt.master.api -- system.salt.master.pkg -- system.reclass.storage.salt -- system.salt.minion.ca.salt_master -- system.salt.minion.cert.proxy -- system.mysql.client.single -- system.reclass.storage.system.openstack_compute_multi -- system.reclass.storage.system.openstack_gateway_single - system.reclass.storage.system.opendaylight_control_single +- cluster.virtual-mcp-ocata-common.infra.config - cluster.virtual-mcp-ocata-odl-router parameters: - _param: - openstack_control_node01_hostname: ctl01 - reclass_data_repository: local - salt_master_environment_repository: "https://github.com/tcpcloud" - salt_master_environment_revision: master - reclass_config_master: 192.168.10.100 - single_address: 172.16.10.100 - salt_master_host: 127.0.0.1 - salt_master_base_environment: prd - salt_minion_ca_host: ${linux:network:fqdn} - salt_api_password_hash: "$6$sGnRlxGf$al5jMCetLP.vfI/fTl3Z0N7Za1aeiexL487jAtyRABVfT3NlwZxQGVhO7S1N8OwS/34VHYwZQA8lkXwKMN/GS1" - linux: - network: - interface: - ens4: - enabled: true - type: eth - proto: static - address: ${_param:single_address} - netmask: 255.255.255.0 reclass: storage: - data_source: - engine: local node: - openstack_control_node01: - name: ${_param:openstack_control_node01_hostname} - domain: ${_param:cluster_domain} - classes: - - cluster.${_param:cluster_name}.openstack.control - params: - linux_system_codename: xenial - salt_master_host: ${_param:reclass_config_master} - single_address: ${_param:openstack_control_node01_address} - openstack_compute_node01: - params: - single_address: 172.16.10.105 - tenant_address: 10.1.0.105 - external_address: 10.16.0.105 - openstack_compute_node02: - params: - single_address: 172.16.10.106 - tenant_address: 10.1.0.106 - external_address: 10.16.0.106 - openstack_gateway_node01: - params: - tenant_address: 10.1.0.110 - external_address: 10.16.0.110 opendaylight_control_node01: classes: - cluster.${_param:cluster_name}.opendaylight.control params: linux_system_codename: xenial - single_address: 172.16.10.111 + single_address: ${_param:opendaylight_service_host} diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/init.yml index 954a7a189..e0311de55 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/init.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/init.yml @@ -1,7 +1,7 @@ classes: - system.linux.system.single - cluster.virtual-mcp-ocata-common.init_options -- cluster.virtual-mcp-ocata-odl-router.infra +- cluster.virtual-mcp-ocata-common.infra - cluster.virtual-mcp-ocata-odl-router.openstack parameters: diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml index 864c71daa..87a42105f 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml @@ -1,66 +1,15 @@ classes: -- service.git.client -- system.linux.system.single -- system.linux.system.repo.mcp.salt -- system.salt.master.api -- system.salt.master.pkg -- system.reclass.storage.salt -- system.salt.minion.ca.salt_master -- system.salt.minion.cert.proxy -- system.mysql.client.single -- system.reclass.storage.system.openstack_compute_multi -- system.reclass.storage.system.openstack_gateway_single +- cluster.virtual-mcp-ocata-common.infra.config - cluster.virtual-mcp-ocata-ovs-dpdk parameters: - _param: - openstack_control_node01_hostname: ctl01 - reclass_data_repository: local - salt_master_environment_repository: "https://github.com/tcpcloud" - salt_master_environment_revision: master - reclass_config_master: 192.168.10.100 - single_address: 172.16.10.100 - salt_master_host: 127.0.0.1 - salt_master_base_environment: prd - salt_minion_ca_host: ${linux:network:fqdn} - salt_api_password_hash: "$6$sGnRlxGf$al5jMCetLP.vfI/fTl3Z0N7Za1aeiexL487jAtyRABVfT3NlwZxQGVhO7S1N8OwS/34VHYwZQA8lkXwKMN/GS1" - linux: - network: - interface: - ens4: - enabled: true - type: eth - proto: static - address: ${_param:single_address} - netmask: 255.255.255.0 reclass: storage: - data_source: - engine: local node: - openstack_control_node01: - name: ${_param:openstack_control_node01_hostname} - domain: ${_param:cluster_domain} - classes: - - cluster.${_param:cluster_name}.openstack.control - params: - linux_system_codename: xenial - salt_master_host: ${_param:reclass_config_master} - single_address: ${_param:openstack_control_node01_address} openstack_compute_node01: params: - single_address: 172.16.10.105 - tenant_address: 10.1.0.105 - external_address: 10.16.0.105 dpdk0_name: ens5 dpdk0_pci: '"0000:00:05.0"' openstack_compute_node02: params: - single_address: 172.16.10.106 - tenant_address: 10.1.0.106 - external_address: 10.16.0.106 dpdk0_name: ens5 dpdk0_pci: '"0000:00:05.0"' - openstack_gateway_node01: - params: - tenant_address: 10.1.0.110 - external_address: 10.16.0.110 diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/init.yml deleted file mode 100644 index 9140bd0bc..000000000 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/init.yml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - linux: - network: - host: - cfg01: - address: ${_param:infra_config_address} - names: - - cfg01 - - cfg01.${_param:cluster_domain} - cfg: - address: ${_param:infra_config_address} - names: - - cfg - - cfg.${_param:cluster_domain} diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/init.yml index 4626fd6c3..77e238057 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/init.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/init.yml @@ -1,7 +1,7 @@ classes: - system.linux.system.single - cluster.virtual-mcp-ocata-common.init_options -- cluster.virtual-mcp-ocata-ovs-dpdk.infra +- cluster.virtual-mcp-ocata-common.infra - cluster.virtual-mcp-ocata-ovs-dpdk.openstack parameters: diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml index 97730b1fd..c366ec502 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml @@ -1,62 +1,3 @@ classes: -- service.git.client -- system.linux.system.single -- system.linux.system.repo.mcp.salt -- system.salt.master.api -- system.salt.master.pkg -- system.reclass.storage.salt -- system.salt.minion.ca.salt_master -- system.salt.minion.cert.proxy -- system.mysql.client.single -- system.reclass.storage.system.openstack_compute_multi -- system.reclass.storage.system.openstack_gateway_single +- cluster.virtual-mcp-ocata-common.infra.config - cluster.virtual-mcp-ocata-ovs -parameters: - _param: - openstack_control_node01_hostname: ctl01 - reclass_data_repository: local - salt_master_environment_repository: "https://github.com/tcpcloud" - salt_master_environment_revision: master - reclass_config_master: 192.168.10.100 - single_address: 172.16.10.100 - salt_master_host: 127.0.0.1 - salt_master_base_environment: prd - salt_minion_ca_host: ${linux:network:fqdn} - salt_api_password_hash: "$6$sGnRlxGf$al5jMCetLP.vfI/fTl3Z0N7Za1aeiexL487jAtyRABVfT3NlwZxQGVhO7S1N8OwS/34VHYwZQA8lkXwKMN/GS1" - linux: - network: - interface: - ens4: - enabled: true - type: eth - proto: static - address: ${_param:single_address} - netmask: 255.255.255.0 - reclass: - storage: - data_source: - engine: local - node: - openstack_control_node01: - name: ${_param:openstack_control_node01_hostname} - domain: ${_param:cluster_domain} - classes: - - cluster.${_param:cluster_name}.openstack.control - params: - linux_system_codename: xenial - salt_master_host: ${_param:reclass_config_master} - single_address: ${_param:openstack_control_node01_address} - openstack_compute_node01: - params: - single_address: 172.16.10.105 - tenant_address: 10.1.0.105 - external_address: 10.16.0.105 - openstack_compute_node02: - params: - single_address: 172.16.10.106 - tenant_address: 10.1.0.106 - external_address: 10.16.0.106 - openstack_gateway_node01: - params: - tenant_address: 10.1.0.110 - external_address: 10.16.0.110 diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/init.yml deleted file mode 100644 index 9140bd0bc..000000000 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/init.yml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - linux: - network: - host: - cfg01: - address: ${_param:infra_config_address} - names: - - cfg01 - - cfg01.${_param:cluster_domain} - cfg: - address: ${_param:infra_config_address} - names: - - cfg - - cfg.${_param:cluster_domain} diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/init.yml index 86c0cf50d..34dca1f5f 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/init.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/init.yml @@ -1,7 +1,7 @@ classes: - system.linux.system.single - cluster.virtual-mcp-ocata-common.init_options -- cluster.virtual-mcp-ocata-ovs.infra +- cluster.virtual-mcp-ocata-common.infra - cluster.virtual-mcp-ocata-ovs.openstack parameters: diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index 94a9bd3c3..e123e5231 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -141,7 +141,7 @@ start_vms() { # start vms for node in "${vnodes[@]}"; do virsh start "${node}" - sleep $[RANDOM%5+1] + sleep $((RANDOM%5+1)) done } diff --git a/mcp/scripts/log.sh b/mcp/scripts/log.sh new file mode 100755 index 000000000..1ae0953af --- /dev/null +++ b/mcp/scripts/log.sh @@ -0,0 +1,35 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2017 Mirantis Inc., Enea AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +# +# Collect /var/log from all cluster nodes via Salt Master +# + +DEPLOY_LOG=$1 +OPNFV_TMP_LOG="opnfv_fuel_logs" + +[ -n "${DEPLOY_LOG}" ] || exit 0 + +# ssh to cfg01 +# shellcheck disable=SC2086,2087 +ssh ${SSH_OPTS} "${SSH_SALT}" bash -s << LOG_COLLECT_END + sudo -i + + echo salt -C '*' cp.push_dir /var/log upload_path='${OPNFV_TMP_LOG}' + salt -C '*' cp.push_dir /var/log upload_path='${OPNFV_TMP_LOG}' + + cd /var/cache/salt/master/minions && \ + find */files/${OPNFV_TMP_LOG}/ | \ + xargs tar czf \$(eval echo \~\${SUDO_USER}/${OPNFV_TMP_LOG}.tar.gz) \ + --transform 's|/files/${OPNFV_TMP_LOG}||' +LOG_COLLECT_END + +# shellcheck disable=SC2086 +scp ${SSH_OPTS} "${SSH_SALT}:${OPNFV_TMP_LOG}.tar.gz" "${DEPLOY_LOG}" +# shellcheck disable=SC2086,2029 +ssh ${SSH_OPTS} "${SSH_SALT}" rm -f "${OPNFV_TMP_LOG}.tar.gz" diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh index 4fa54ab1c..174471e91 100755 --- a/mcp/scripts/salt.sh +++ b/mcp/scripts/salt.sh @@ -11,8 +11,6 @@ # F_GIT_ROOT=$(git rev-parse --show-toplevel) -SALT_MASTER_USER=${SALT_MASTER_USER:-ubuntu} -SSH_SALT="${SALT_MASTER_USER}@${SALT_MASTER}" OPNFV_TMP_DIR="/home/${SALT_MASTER_USER}/fuel" OPNFV_FUEL_DIR="/root/fuel" |