diff options
Diffstat (limited to 'mcp/scripts')
-rw-r--r-- | mcp/scripts/globals.sh | 5 | ||||
-rw-r--r-- | mcp/scripts/lib.sh | 7 | ||||
-rwxr-xr-x | mcp/scripts/salt.sh | 1 | ||||
-rw-r--r-- | mcp/scripts/virsh_net/net_public.xml.j2 | 10 |
4 files changed, 19 insertions, 4 deletions
diff --git a/mcp/scripts/globals.sh b/mcp/scripts/globals.sh index 8966a0a94..54f015cf6 100644 --- a/mcp/scripts/globals.sh +++ b/mcp/scripts/globals.sh @@ -25,22 +25,27 @@ export SSH_SALT="${SALT_MASTER_USER}@${SALT_MASTER}" ############################################################################## # BEGIN of colored notification wrappers # + +# same as `notify_i` + trailing '\n'; function notify() { local msg=${1}; shift notify_i "${msg}\n" "$@" } +# Inline (no newline added) colored output notification wrapper function notify_i() { tput setaf "${2:-1}" || true echo -en "${1:-"[WARN] Unsupported opt arg: $3\\n"}" tput sgr0 } +# same as `notify` + extra '\n' before and after; function notify_n() { local msg=${1}; shift notify_i "\n${msg}\n\n" "$@" } +# same as `notify` + stderr output + exit; function notify_e() { local msg=${1}; shift notify_i "\n${msg}\n\n" "$@" 1>&2 diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index 02c23f365..5b00c7380 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -1,5 +1,5 @@ #!/bin/bash -e -# shellcheck disable=SC2155,SC1001 +# shellcheck disable=SC2155,SC1001,SC2015 ############################################################################## # Copyright (c) 2017 Mirantis Inc., Enea AB and others. # All rights reserved. This program and the accompanying materials @@ -452,7 +452,7 @@ function wait_for { # shellcheck disable=SC2015 eval "${cmdstr}" && echo "[wait_for] OK: ${cmdstr}" && return 0 || true else - !(eval "${cmdstr}" || echo __fuel_wf_failure__) |& tee /dev/stderr | \ + ! (eval "${cmdstr}" || echo __fuel_wf_failure__) |& tee /dev/stderr | \ grep -Eq '(Not connected|No response|__fuel_wf_failure__)' && \ echo "[wait_for] OK: ${cmdstr}" && return 0 || true fi @@ -498,7 +498,6 @@ function do_templates() { BASE_CONFIG_IDF="${lab_config_uri}/labs/${target_lab}/idf-${target_pod}.yaml" LOCAL_PDF="${image_dir}/$(basename "${BASE_CONFIG_PDF}")" LOCAL_IDF="${image_dir}/$(basename "${BASE_CONFIG_IDF}")" - LOCAL_PDF_RECLASS="${image_dir}/pod_config.yml" # Two-stage expansion, first stage handles pod_config and scenarios only if [ -n "${scenario_dir}" ]; then @@ -511,7 +510,7 @@ function do_templates() { elif ! curl -o "${LOCAL_IDF}" "${BASE_CONFIG_IDF}"; then notify_e "[ERROR] Could not retrieve IDF (Installer Descriptor File)!" elif ! "${PHAROS_GEN_CFG}" -y "${LOCAL_PDF}" \ - -j "${PHAROS_INSTALLER_ADAPTER}" > "${LOCAL_PDF_RECLASS}"; then + -j "${PHAROS_INSTALLER_ADAPTER}" > "${image_dir}/pod_config.yml"; then notify_e "[ERROR] Could not convert PDF+IDF to reclass model input!" fi template_dirs="${scenario_dir}" diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh index 310b78a7a..15168c0cc 100755 --- a/mcp/scripts/salt.sh +++ b/mcp/scripts/salt.sh @@ -22,6 +22,7 @@ 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// /|}" diff --git a/mcp/scripts/virsh_net/net_public.xml.j2 b/mcp/scripts/virsh_net/net_public.xml.j2 index e47f69bb4..37a8d9272 100644 --- a/mcp/scripts/virsh_net/net_public.xml.j2 +++ b/mcp/scripts/virsh_net/net_public.xml.j2 @@ -6,6 +6,11 @@ which accompanies this distribution, and is available at http://www.apache.org/licenses/LICENSE-2.0 --> +{%- for node in conf.nodes %} + {%- if node.node.type == 'virtual' %} + {%- set cluster_has_virtual_nodes = True %} + {%- endif %} +{%- endfor %} {%- if conf.idf.net_config.public is defined %} {%- set public_network = conf.idf.net_config.public.network %} {%- set public_prefix = conf.idf.net_config.public.mask %} @@ -16,6 +21,11 @@ <network> <name>public</name> <bridge name="public"/> +{%- if cluster_has_virtual_nodes %} +{#- Ideally, jumpserver would have a real Linux bridge we will hook to. + In case it doesn't, we use this virsh network as a *mock* public. + The *mock* public should NOT overlap with the real public in any way. #} <forward mode="nat"/> <ip address="{{ public_network | ipaddr_index(1) }}" netmask="{{ public_prefix | netmask }}"/> +{%- endif %} </network> |