diff options
Diffstat (limited to 'mcp/scripts')
-rw-r--r-- | mcp/scripts/docker-compose/docker-compose.yaml.j2 | 63 | ||||
-rwxr-xr-x | mcp/scripts/docker-compose/files/entrypoint.sh | 90 | ||||
-rw-r--r-- | mcp/scripts/docker-compose/files/hosts | 6 | ||||
-rw-r--r-- | mcp/scripts/docker-compose/files/opnfv_master.conf | 16 | ||||
-rw-r--r-- | mcp/scripts/lib.sh | 60 | ||||
-rw-r--r-- | mcp/scripts/lib_template.sh | 3 | ||||
-rwxr-xr-x | mcp/scripts/salt.sh | 132 | ||||
-rw-r--r-- | mcp/scripts/xdf_data.sh.j2 | 7 |
8 files changed, 233 insertions, 144 deletions
diff --git a/mcp/scripts/docker-compose/docker-compose.yaml.j2 b/mcp/scripts/docker-compose/docker-compose.yaml.j2 new file mode 100644 index 000000000..7099e4fda --- /dev/null +++ b/mcp/scripts/docker-compose/docker-compose.yaml.j2 @@ -0,0 +1,63 @@ +############################################################################## +# Copyright (c) 2018 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 +############################################################################## +{%- import 'net_map.j2' as nm with context %} +{%- import 'net_macros.j2' as ma with context %} +{#- conf.MCPCONTROL_NET & co are mandatory, defaults are set via globals.sh #} +{%- set net_mcpcontrol = [conf.MCPCONTROL_NET, conf.MCPCONTROL_PREFIX] | join("/") %} +version: '2' +services: + opnfv-fuel-salt-master: + container_name: "fuel" + image: "opnfv/fuel:saltmaster-reclass-latest" + networks: + - mcpcontrol + - pxebr + - mgmt + volumes: + - /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro + - {{ conf.MCP_REPO_ROOT_PATH }}:/root/fuel + - {{ conf.MCP_REPO_ROOT_PATH }}/mcp/scripts/docker-compose/files/entrypoint.sh:/entrypoint.sh + - {{ conf.MCP_STORAGE_DIR }}/pod_config.yml:/root/pod_config.yml + - {{ conf.MCP_STORAGE_DIR }}/base_image_opnfv_fuel_vcp.img:/srv/salt/env/prd/salt/files/control/images/base_image_opnfv_fuel_vcp.img + - {{ conf.MCP_STORAGE_DIR }}/nodes:/srv/salt/reclass/nodes + - {{ conf.MCP_STORAGE_DIR }}/pki:/etc/pki + - {{ conf.MCP_STORAGE_DIR }}/salt:/etc/salt + - {{ conf.MCP_STORAGE_DIR }}/hosts:/etc/hosts + hostname: cfg01 + domainname: {{ conf.cluster.domain }} + privileged: true +networks: + mcpcontrol: + driver: macvlan + driver_opts: + parent: veth_mcp1 # Always untagged + ipam: + config: + - subnet: {{ net_mcpcontrol }} + gateway: {{ net_mcpcontrol | ipnet_hostaddr(1) }} + ip_range: {{ [net_mcpcontrol | ipnet_hostaddr(2), conf.MCPCONTROL_PREFIX] | join("/") }} + pxebr: + driver: macvlan + driver_opts: + parent: veth_mcp3 # Always untagged + ipam: + config: + - subnet: {{ nm.net_admin }} + ip_range: {{ [nm.net_admin | ipnet_hostaddr(nm.start_ip[nm.net_admin] + nm.net_admin_hosts.index('opnfv_infra_config_pxe_admin_address') +1), nm.net_admin.split("/")[-1]] | join("/") }} + mgmt: + driver: macvlan + driver_opts: +{%- if conf.idf.fuel.jumphost.get('trunks', {}).get('mgmt', False) %} + parent: {{ ma.interface_str('veth_mcp5', nm.vlan_mgmt) }} +{%- else %} + parent: veth_mcp5 # Untagged by default +{%- endif %} + ipam: + config: + - subnet: {{ nm.net_mgmt }} + ip_range: {{ [nm.net_mgmt | ipnet_hostaddr(2), nm.net_mgmt.split("/")[-1]] | join("/") }} diff --git a/mcp/scripts/docker-compose/files/entrypoint.sh b/mcp/scripts/docker-compose/files/entrypoint.sh new file mode 100755 index 000000000..c7f7f9118 --- /dev/null +++ b/mcp/scripts/docker-compose/files/entrypoint.sh @@ -0,0 +1,90 @@ +#!/bin/bash -e +############################################################################## +# Copyright (c) 2018 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 +############################################################################## + +mkdir -p /etc/salt/{master.d,minion.d,proxy.d} + +if [ ! -z "$SALT_EXT_PILLAR" ]; then + cp -avr "/tmp/${SALT_EXT_PILLAR}.conf" /etc/salt/master.d/ +fi + +if [ ! -f /home/ubuntu/.ssh/authorized_keys ]; then + install -D -o ubuntu /root/fuel/mcp/scripts/mcp.rsa.pub \ + /home/ubuntu/.ssh/authorized_keys +fi + +if ! grep -q localhost /etc/hosts; then + # overwrite hosts only on first container up, to preserve cluster nodes + cp -a /root/fuel/mcp/scripts/docker-compose/files/hosts /etc/hosts +fi + +# salt state does not properly configure file_roots in master.conf, hard set it +cp -a /root/fuel/mcp/scripts/docker-compose/files/opnfv_master.conf \ + /etc/salt/master.d/opnfv_master.conf +echo 'master: localhost' > /etc/salt/minion.d/opnfv_slave.conf + +# NOTE: Most Salt and/or reclass tools have issues traversing Docker mounts +# or detecting them as directories inside the container. +# For now, let's do a lot of copy operations to bypass this. +# Later, we will inject the OPNFV patched reclass model during image build. +rm -rf /srv/salt/reclass/classes/* +cp -ar /root/fuel/mcp/reclass/classes/* /srv/salt/reclass/classes +cp -ar /root/fuel/mcp/reclass/nodes/* /srv/salt/reclass/nodes +# Sensitive data should stay out of /root/fuel, which is exposed via Jenkins WS +cp -a /root/pod_config.yml \ + /srv/salt/reclass/classes/cluster/all-mcp-arch-common/opnfv/pod_config.yml + +# OPNFV formulas +prefix=/srv/salt/formula/salt-formulas +rm -f /root/fuel/mcp/salt-formulas/*/.git +cp -ar /root/fuel/mcp/salt-formulas/* ${prefix}/ +for formula in 'armband' 'opendaylight' 'tacker'; do + ln -sf /root/fuel/mcp/salt-formulas/salt-formula-${formula}/* \ + /srv/salt/env/prd/ +done + +# Re-create classes.service links that we destroyed above +for formula in ${prefix}/*; do + if [ -e "${formula}/metadata/service" ] && [[ ! $formula =~ \. ]]; then + ln -sf "${formula}/metadata/service" \ + "/srv/salt/reclass/classes/service/${formula#${prefix}/salt-formula-}" + fi +done + +# Create links for salt-formula-* packages to mimic git-style salt-formulas +for artifact in /usr/share/salt-formulas/env/_*/*; do + ln -sf "${artifact}" "/srv/salt/env/prd/${artifact#/usr/share/salt-formulas/env/}" +done +for artifact in /usr/share/salt-formulas/env/*; do + if [[ ! ${artifact} =~ ^_ ]]; then + ln -sf "${artifact}" "/srv/salt/env/prd/$(basename ${artifact})" + fi +done +for formula in /usr/share/salt-formulas/reclass/service/*; do + ln -sf "${formula}" "/srv/salt/reclass/classes/service/$(basename ${formula})" +done + +# Tini init system resembles upstart very much, but needs a little adjustment +sed -i -e "s|return 'start/running' in |return 'is running' in |" \ + -e "s|ret = _default_runlevel|return _default_runlevel|" \ + /usr/lib/python2.7/dist-packages/salt/modules/upstart.py + +# Remove broken symlinks in /srv/salt, silences recurring warnings +find -L /srv/salt /srv/salt/env/prd/_* -maxdepth 1 -type l -delete + +# Fix up any permissions after above file shuffling +sudo chown root:root -R /srv/salt + +service ssh start +service salt-minion start + +if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then + exec /usr/bin/salt-master --log-file-level=quiet --log-level=info "$@" +else + exec "$@" +fi diff --git a/mcp/scripts/docker-compose/files/hosts b/mcp/scripts/docker-compose/files/hosts new file mode 100644 index 000000000..473184145 --- /dev/null +++ b/mcp/scripts/docker-compose/files/hosts @@ -0,0 +1,6 @@ +127.0.0.1 localhost +::1 localhost ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters diff --git a/mcp/scripts/docker-compose/files/opnfv_master.conf b/mcp/scripts/docker-compose/files/opnfv_master.conf new file mode 100644 index 000000000..7066f04bf --- /dev/null +++ b/mcp/scripts/docker-compose/files/opnfv_master.conf @@ -0,0 +1,16 @@ +file_roots: + base: + - /srv/salt/env/prd + prd: + - /srv/salt/env/prd + dev: + - /srv/salt/env/dev + - /srv/salt/env/prd + +user: root +file_recv: True + +open_mode: True + +peer: + .*: ['x509.sign_remote_certificate'] diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index 016af2bcb..cc88f9b54 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -376,9 +376,9 @@ function jumpserver_check_requirements { } function create_networks { - local vnode_networks=("$@") + local all_vnode_networks=("mcpcontrol" "$@") # create required networks, including constant "mcpcontrol" - for net in "mcpcontrol" "${vnode_networks[@]}"; do + for net in "${all_vnode_networks[@]}"; do if virsh net-info "${net}" >/dev/null 2>&1; then virsh net-destroy "${net}" || true virsh net-undefine "${net}" @@ -391,6 +391,14 @@ function create_networks { virsh net-start "${net}" fi done + # create veth pairs for relevant networks (mcpcontrol, pxebr, mgmt) + for i in $(seq 0 2 4); do + sudo ip link del "veth_mcp$i" || true + sudo ip link add "veth_mcp$i" type veth peer name "veth_mcp$((i+1))" + sudo ip link set "veth_mcp$i" up mtu 9000 + sudo ip link set "veth_mcp$((i+1))" up mtu 9000 + sudo brctl addif "${all_vnode_networks[$((i/2))]}" "veth_mcp$i" + done } function create_vms { @@ -446,10 +454,7 @@ function create_vms { function update_mcpcontrol_network { # set static ip address for salt master node, MaaS node - local cmac=$(virsh domiflist cfg01 2>&1| awk '/mcpcontrol/ {print $5; exit}') local amac=$(virsh domiflist mas01 2>&1| awk '/mcpcontrol/ {print $5; exit}') - virsh net-update "mcpcontrol" add ip-dhcp-host \ - "<host mac='${cmac}' name='cfg01' ip='${SALT_MASTER}'/>" --live --config [ -z "${amac}" ] || virsh net-update "mcpcontrol" add ip-dhcp-host \ "<host mac='${amac}' name='mas01' ip='${MAAS_IP}'/>" --live --config } @@ -481,6 +486,26 @@ function start_vms { done } +function prepare_containers { + local image_dir=$1 + [ -n "${image_dir}" ] || exit 1 + [ -n "${MCP_REPO_ROOT_PATH}" ] || exit 1 + docker-compose --version > /dev/null 2>&1 || COMPOSE_PREFIX="${image_dir}/" + + "${COMPOSE_PREFIX}docker-compose" -f docker-compose/docker-compose.yaml down + sudo rm -rf "${image_dir}/"{salt,hosts,pki} "${image_dir}/nodes/"* + mkdir -p "${image_dir}/salt/"{master.d,minion.d} + touch "${image_dir}/hosts" +} + +function start_containers { + local image_dir=$1 + [ -n "${image_dir}" ] || exit 1 + docker-compose --version > /dev/null 2>&1 || COMPOSE_PREFIX="${image_dir}/" + "${COMPOSE_PREFIX}docker-compose" -f docker-compose/docker-compose.yaml pull + "${COMPOSE_PREFIX}docker-compose" -f docker-compose/docker-compose.yaml up -d +} + function check_connection { local total_attempts=60 local sleep_time=5 @@ -550,8 +575,10 @@ function wait_for { function do_udev_cfg { local _conf='/etc/udev/rules.d/99-opnfv-fuel-vnet-mtu.rules' # http://linuxaleph.blogspot.com/2013/01/how-to-network-jumbo-frames-to-kvm-guest.html - echo 'SUBSYSTEM=="net", ACTION=="add|change", KERNEL=="vnet*", ATTR{mtu}="9000"' |& sudo tee "${_conf}" - sudo udevadm control --reload || true + echo 'SUBSYSTEM=="net", ACTION=="add|change", KERNEL=="vnet*", RUN+="/bin/sh -c '"'/bin/sleep 1; /sbin/ip link set %k mtu 9000'\"" |& sudo tee "${_conf}" + echo 'SUBSYSTEM=="net", ACTION=="add|change", KERNEL=="*-nic", RUN+="/bin/sh -c '"'/bin/sleep 1; /sbin/ip link set %k mtu 9000'\"" |& sudo tee -a "${_conf}" + sudo udevadm control --reload + sudo udevadm trigger } function do_sysctl_cfg { @@ -574,12 +601,29 @@ function get_nova_compute_pillar_data { } function docker_install { + local image_dir=$1 # Mininum effort attempt at installing Docker if missing - if ! which docker; then + if ! docker --version; then curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh rm get-docker.sh # On RHEL distros, the Docker service should be explicitly started sudo systemctl start docker + else + DOCKER_VER=$(docker version --format '{{.Server.Version}}') + if [ "${DOCKER_VER%%.*}" -lt 2 ]; then + notify_e "[ERROR] Docker version ${DOCKER_VER} is too old, please upgrade it." + fi + fi + # Distro-provided docker-compose might be simply broken (Ubuntu 16.04, CentOS 7) + if ! docker-compose --version > /dev/null 2>&1; then + COMPOSE_BIN="${image_dir}/docker-compose" + COMPOSE_VERSION='1.22.0' + notify_n "[WARN] Using docker-compose ${COMPOSE_VERSION} in ${COMPOSE_BIN}" 3 + if [ ! -e "${COMPOSE_BIN}" ]; then + COMPOSE_URL="https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}" + sudo curl -L "${COMPOSE_URL}/docker-compose-$(uname -s)-$(uname -m)" -o "${COMPOSE_BIN}" + sudo chmod +x "${COMPOSE_BIN}" + fi fi } diff --git a/mcp/scripts/lib_template.sh b/mcp/scripts/lib_template.sh index 4b5b0563d..0cfc02fdf 100644 --- a/mcp/scripts/lib_template.sh +++ b/mcp/scripts/lib_template.sh @@ -79,7 +79,8 @@ function do_templates_cluster { awk '/^---$/{f=1;next;}f' "${_yaml}" >> "${LOCAL_PDF}" done # shellcheck disable=SC2046 - j2args=$(find "${RECLASS_CLUSTER_DIR}" "$(readlink -f virsh_net)" $(readlink -f ./*j2) \ + j2args=$(find "${RECLASS_CLUSTER_DIR}" "$(readlink -f virsh_net)" \ + "$(readlink -f docker-compose)" $(readlink -f ./*j2) \ -name '*.j2' -exec echo -j {} \;) # shellcheck disable=SC2086 if ! "${PHAROS_GEN_CFG}" -y "${LOCAL_PDF}" ${j2args} -b -v \ diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh deleted file mode 100755 index 46ef6ffbf..000000000 --- a/mcp/scripts/salt.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -e -############################################################################## -# 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 -############################################################################## -# -# Deploy Salt Master -# - -CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x -F_GIT_ROOT=$(git rev-parse --show-toplevel) -F_GIT_DIR=$(cd "${F_GIT_ROOT}/mcp" && git rev-parse --git-dir) -F_GIT_SUBD=${F_GIT_ROOT#${F_GIT_DIR%%/.git*}} -OPNFV_TMP_DIR="/home/${SALT_MASTER_USER}/opnfv" -OPNFV_GIT_DIR="/root/opnfv" -OPNFV_FUEL_DIR="/root/fuel" # Should be in sync with patch.sh, scripts patches -OPNFV_RDIR="reclass/classes/cluster/all-mcp-arch-common" -OPNFV_VCP_IMG="mcp/scripts/base_image_opnfv_fuel_vcp.img" -OPNFV_VCP_DIR="/srv/salt/env/prd/salt/files/control/images" -LOCAL_GIT_DIR="${F_GIT_ROOT%${F_GIT_SUBD}}" -LOCAL_PDF_RECLASS=$1; shift -# shellcheck disable=SC2116,SC2086 -LOCAL_VIRT_NODES=$(echo ${*//cfg01/}) # unquoted to filter space -NODE_MASK="${LOCAL_VIRT_NODES// /|}" - -# push to cfg01 current git repo first (including submodules), at ~ubuntu/opnfv -# later we move it to ~root/opnfv (and ln as ~root/fuel); delete the temp clone -remote_tmp="${SSH_SALT}:$(basename "${OPNFV_TMP_DIR}")" -STORAGE_DIR=$(dirname "${LOCAL_PDF_RECLASS}") -REL_STORAGE_DIR_PATH=${STORAGE_DIR#${LOCAL_GIT_DIR}} -if [[ "${REL_STORAGE_DIR_PATH}" == "${STORAGE_DIR}" ]] -then - REL_STORAGE_DIR_PATH="" -fi -rsync -Erl --delete -e "ssh ${SSH_OPTS}" \ - --exclude={.gitignore,"$REL_STORAGE_DIR_PATH"} \ - "${LOCAL_GIT_DIR}/" "${remote_tmp}/" -if [ -n "${LOCAL_PDF_RECLASS}" ] && [ -f "${LOCAL_PDF_RECLASS}" ]; then - rsync -e "ssh ${SSH_OPTS}" "${LOCAL_PDF_RECLASS}" \ - "${remote_tmp}${F_GIT_SUBD}/mcp/${OPNFV_RDIR}/opnfv/" -fi -local_vcp_img=$(dirname "${LOCAL_PDF_RECLASS}")/$(basename "${OPNFV_VCP_IMG}") -if [ -e "${local_vcp_img}" ]; then - rsync -L -e "ssh ${SSH_OPTS}" "${local_vcp_img}" \ - "${remote_tmp}${F_GIT_SUBD}/${OPNFV_VCP_IMG}" -fi - -# ssh to cfg01 -# shellcheck disable=SC2086,2087 -ssh ${SSH_OPTS} "${SSH_SALT}" bash -s -e << SALT_INSTALL_END - sudo -i - set -e - export TERM=${TERM} - export CI_DEBUG=${CI_DEBUG}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x - - echo -n 'Checking out cloud-init has finished running ...' - while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo -n '.'; sleep 1; done - echo ' done' - - mkdir -p /srv/salt /usr/share/salt-formulas/reclass - rm -rf ${OPNFV_GIT_DIR} ${OPNFV_FUEL_DIR} - mv ${OPNFV_TMP_DIR} ${OPNFV_GIT_DIR} && chown -R root.root ${OPNFV_GIT_DIR} - find ${OPNFV_GIT_DIR} -name '.git' -type f | while read f_git; do - sed -i 's@${LOCAL_GIT_DIR}@${OPNFV_GIT_DIR}@g' \$f_git - done - ln -sf ${OPNFV_GIT_DIR}${F_GIT_SUBD} ${OPNFV_FUEL_DIR} - ln -sf ${OPNFV_FUEL_DIR}/mcp/reclass /srv/salt - ln -sf ${OPNFV_FUEL_DIR}/mcp/deploy/scripts /srv/salt - ln -sf ${OPNFV_FUEL_DIR}/mcp/scripts/mcp.rsa $(dirname "${OPNFV_FUEL_DIR}") - - cp -r ${OPNFV_FUEL_DIR}/mcp/metadata/service /usr/share/salt-formulas/reclass - cd /srv/salt/reclass/classes/service && \ - ln -sf /usr/share/salt-formulas/reclass/service/opendaylight - - # Armband APT-MK nightly/extra repo for forked & extended reclass - wget -qO - https://linux.enea.com/apt-mk/public.gpg | apt-key add - - echo 'deb http://linux.enea.com/apt-mk/xenial nightly extra' > \ - '/etc/apt/sources.list.d/armband_mcp_extra.list' - apt-get update - - cd /srv/salt/scripts - export DEBIAN_FRONTEND=noninteractive - echo 'Dpkg::Use-Pty "0";' > /etc/apt/apt.conf.d/90silence-dpkg - OLD_DOMAIN=\$(grep -sPzo "id: cfg01\.\K(\S*)" /etc/salt/minion.d/minion.conf) || true - BOOTSTRAP_SALTSTACK_OPTS=" -r -dX stable 2017.7 " \ - MASTER_HOSTNAME=cfg01.${CLUSTER_DOMAIN} DISTRIB_REVISION=nightly \ - EXTRA_FORMULAS="nfs panko gnocchi oslo-templates" \ - ./salt-master-init.sh - salt-key -Ay - - cp -r ${OPNFV_FUEL_DIR}/mcp/salt-formulas/* /usr/share/salt-formulas/env - cd ${OPNFV_FUEL_DIR}/mcp/patches && ./patch.sh patches.list formulas - cd ${OPNFV_FUEL_DIR}/mcp/patches && ./patch.sh patches.list reclass - - source ${OPNFV_FUEL_DIR}/mcp/scripts/lib.sh - wait_for 3.0 "salt-call state.apply salt" - - # In case scenario changed (and implicitly domain name), re-register minions - if [ -n "\${OLD_DOMAIN}" ] && [ "\${OLD_DOMAIN}" != "${CLUSTER_DOMAIN}" ]; then - salt "*.\${OLD_DOMAIN}" cmd.run "grep \${OLD_DOMAIN} -sRl /etc/salt | \ - xargs --no-run-if-empty sed -i 's/\${OLD_DOMAIN}/${CLUSTER_DOMAIN}/g'; \ - service salt-minion restart" || true - salt-key -yd "*.\${OLD_DOMAIN}" - salt-key -Ay - fi - - # Init specific to VMs on FN (all for virtual, cfg|mas for baremetal) - wait_for 3.0 'salt -C "cfg01*" state.apply linux' - if [[ "${LOCAL_VIRT_NODES}" =~ mas ]]; then - wait_for 3.0 'salt -C "mas*" test.ping' - else - wait_for 3.0 '(for n in ${LOCAL_VIRT_NODES}; do salt -C \${n}.* test.ping || exit; done)' - fi - wait_for 3.0 'salt -C "E@^(${NODE_MASK}|cfg01).*" saltutil.sync_all' - wait_for 3.0 'salt -C "E@^(${NODE_MASK}|cfg01).*" state.apply salt' - - wait_for 3.0 'salt -C "E@^(${NODE_MASK}).*" state.sls linux.system,linux.storage' - wait_for 2.0 'salt -C "E@^(${NODE_MASK}).*" state.sls linux.network' - salt -C "E@^(${NODE_MASK}).*" system.reboot - wait_for 90.0 'salt -C "E@^(${NODE_MASK}).*" test.ping' - wait_for 3.0 'salt -C "E@^(${NODE_MASK}).*" pkg.upgrade refresh=False dist_upgrade=True' - - wait_for 3.0 'salt -C "E@^(${NODE_MASK}|cfg01).*" state.sls ntp' - - if [ -f "${OPNFV_FUEL_DIR}/${OPNFV_VCP_IMG}" ]; then - mkdir -p "${OPNFV_VCP_DIR}" - mv "${OPNFV_FUEL_DIR}/${OPNFV_VCP_IMG}" "${OPNFV_VCP_DIR}/" - fi -SALT_INSTALL_END diff --git a/mcp/scripts/xdf_data.sh.j2 b/mcp/scripts/xdf_data.sh.j2 index c0629fec4..ee5fffab7 100644 --- a/mcp/scripts/xdf_data.sh.j2 +++ b/mcp/scripts/xdf_data.sh.j2 @@ -14,6 +14,7 @@ {%- import 'net_map.j2' as nm with context -%} {%- set arch = conf[conf.MCP_JUMP_ARCH] -%} {%- set V = conf.virtual -%} +{%- do V.nodes.update(arch.default.virtual.nodes) -%} {%- set section_map = { 'infra': -1, 'control': nm.ctl01.idx, @@ -33,7 +34,7 @@ {%- macro serialize_vnodes() -%} {%- set arr = [] -%} {%- for section in section_map -%} - {%- for n in V.nodes[section] -%} + {%- for n in V.nodes[section] or [] -%} {%- if section_map[section] < 0 or conf.nodes[section_map[section] + loop.index0].node.type == 'virtual' -%} {%- if n not in V -%}{%- do V.update({n: {}}) -%}{%- endif -%} {%- do arr.append(pack([n, V[n].ram or arch.default.ram, @@ -48,7 +49,7 @@ {%- macro filter_nodes(type, output_as_query = False, sections = section_map) -%} {%- set arr = [] -%} {%- for section in sections -%} - {%- for n in V.nodes[section] -%} + {%- for n in V.nodes[section] or [] -%} {%- if ( (section_map[section] < 0 and type == 'virtual') or (section_map[section] >= 0 and conf.nodes[section_map[section] + loop.index0].node.type in type) ) -%} @@ -87,7 +88,7 @@ OPNFV_BRIDGES=( ) export CLUSTER_DOMAIN={{ conf.cluster.domain }} -cluster_states={{ bash_arr(conf.cluster.states) }} +cluster_states={{ bash_arr(arch.default.cluster.states + conf.cluster.states) }} virtual_nodes={{ filter_nodes('virtual') }} control_nodes_query={{ filter_nodes(['baremetal', 'virtual'], True, ['control']) }} base_image={{ arch.base_image }} |