aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xci/deploy.sh51
-rwxr-xr-xmcp/config/states/dpdk4
-rwxr-xr-xmcp/config/states/maas4
-rwxr-xr-xmcp/config/states/networks4
-rwxr-xr-xmcp/config/states/neutron_compute4
-rwxr-xr-xmcp/config/states/opendaylight4
-rwxr-xr-xmcp/config/states/openstack4
-rwxr-xr-xmcp/config/states/openstack_ha6
-rwxr-xr-xmcp/config/states/virtual_control_plane6
-rwxr-xr-xmcp/patches/patch.sh10
-rwxr-xr-xmcp/scripts/create-config-drive.sh4
-rw-r--r--mcp/scripts/globals.sh3
-rw-r--r--mcp/scripts/lib.sh5
-rwxr-xr-xmcp/scripts/log.sh8
-rwxr-xr-xmcp/scripts/salt.sh12
15 files changed, 86 insertions, 43 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh
index 926d52bdb..908909d20 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -ex
+#!/bin/bash -e
# shellcheck disable=SC2034,SC2154,SC1090,SC1091
##############################################################################
# Copyright (c) 2017 Ericsson AB, Mirantis Inc., Enea AB and others.
@@ -13,8 +13,13 @@
# BEGIN of Exit handlers
#
do_exit () {
+ local RC=$?
clean
- echo "Exiting ..."
+ if [ ${RC} -eq 0 ]; then
+ notify "\n[OK] MCP: Openstack installation finished succesfully!\n\n" 2
+ else
+ notify "\n[ERROR] MCP: Openstack installation threw a fatal error!\n\n"
+ fi
}
#
# End of Exit handlers
@@ -32,14 +37,16 @@ $(notify "$(basename "$0"): Deploy the Fuel@OPNFV MCP stack" 3)
$(notify "USAGE:" 2)
$(basename "$0") -b base-uri -l lab-name -p pod-name -s deploy-scenario \\
[-B PXE Bridge [-B Mgmt Bridge [-B Internal Bridge [-B Public Bridge]]]] \\
- [-S storage-dir] [-L /path/to/log/file.tar.gz] [-f] [-F] [-e] [-d]
+ [-S storage-dir] [-L /path/to/log/file.tar.gz] \\
+ [-f [-f]] [-F] [-e] [-d] [-D]
$(notify "OPTIONS:" 2)
-b Base-uri for the stack-configuration structure
-B Bridge(s): 1st usage = PXE, 2nd = Mgmt, 3rd = Internal, 4th = Public
-d Dry-run
+ -D Debug logging
-e Do not launch environment deployment
- -f Deploy on existing Salt master
+ -f Deploy on existing Salt master (use twice to also skip config sync)
-F Do only create a Salt master
-h Print this message and exit
-l Lab-name
@@ -73,8 +80,12 @@ $(notify "Input parameters to the build script are:" 2)
while "mcpcontrol" is used to provision the infrastructure VMs only.
The default is 'pxebr'.
-d Dry-run - Produce deploy config files, but do not execute deploy
+-D Debug logging - Enable extra logging in sh deploy scripts (set -x)
-e Do not launch environment deployment
--f Deploy on existing Salt master
+-f Deploy on existing Salt master. It will skip infrastructure VM creation,
+ but it will still sync reclass configuration from current repo to Salt
+ Master node. If specified twice (e.g. -f -f), config sync will also be
+ skipped.
-F Do only create a Salt master
-h Print this message and exit
-L Deployment log path and name, eg. -L /home/jenkins/job.log.tar.gz
@@ -124,6 +135,7 @@ clean() {
##############################################################################
# BEGIN of variables to customize
#
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
REPO_ROOT_PATH=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/..")
DEPLOY_DIR=$(cd "${REPO_ROOT_PATH}/mcp/scripts"; pwd)
STORAGE_DIR=$(cd "${REPO_ROOT_PATH}/mcp/deploy/images"; pwd)
@@ -150,7 +162,7 @@ source "${DEPLOY_DIR}/globals.sh"
#
set +x
OPNFV_BRIDGE_IDX=0
-while getopts "b:B:dfFl:L:p:s:S:he" OPTION
+while getopts "b:B:dDfFl:L:p:s:S:he" OPTION
do
case $OPTION in
b)
@@ -169,15 +181,18 @@ do
if [ -n "${bridge}" ]; then
OPNFV_BRIDGES[${OPNFV_BRIDGE_IDX}]="${bridge}"
fi
- OPNFV_BRIDGE_IDX=$((OPNFV_BRIDGE_IDX + 1))
+ ((OPNFV_BRIDGE_IDX+=1))
done
IFS=${OIFS}
;;
d)
DRY_RUN=1
;;
+ D)
+ CI_DEBUG=1
+ ;;
f)
- USE_EXISTING_INFRA=1
+ ((USE_EXISTING_INFRA+=1))
;;
F)
INFRA_CREATION_ONLY=1
@@ -234,7 +249,7 @@ if [ -z "${TARGET_LAB}" ] || [ -z "${TARGET_POD}" ] || \
exit 1
fi
-set -x
+[[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
# Enable the automatic exit trap
trap do_exit SIGINT SIGTERM EXIT
@@ -289,8 +304,8 @@ fi
# Check scenario file existence
SCENARIO_DIR="../config/scenario"
if [ ! -f "${SCENARIO_DIR}/${DEPLOY_TYPE}/${DEPLOY_SCENARIO}.yaml" ]; then
- notify "[WARN] ${DEPLOY_SCENARIO}.yaml not found! \
- Setting simplest scenario (os-nosdn-nofeature-noha)\n" 3
+ notify "[WARN] ${DEPLOY_SCENARIO}.yaml not found!\n" 3
+ notify "[WARN] Setting simplest scenario (os-nosdn-nofeature-noha)\n" 3
DEPLOY_SCENARIO='os-nosdn-nofeature-noha'
if [ ! -f "${SCENARIO_DIR}/${DEPLOY_TYPE}/${DEPLOY_SCENARIO}.yaml" ]; then
notify "[ERROR] Scenario definition file is missing!\n" 1>&2
@@ -310,7 +325,7 @@ source lib.sh
eval "$(parse_yaml "${SCENARIO_DIR}/defaults-$(uname -i).yaml")"
eval "$(parse_yaml "${SCENARIO_DIR}/${DEPLOY_TYPE}/${DEPLOY_SCENARIO}.yaml")"
eval "$(parse_yaml "${LOCAL_PDF_RECLASS}")"
-set -x
+[[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
export CLUSTER_DOMAIN=${cluster_domain}
@@ -358,7 +373,7 @@ notify "[NOTE] Using bridges: ${OPNFV_BRIDGES[*]}\n" 2
if [ ${DRY_RUN} -eq 1 ]; then
notify "[NOTE] Dry run, skipping all deployment tasks\n" 2 1>&2
exit 0
-elif [ ${USE_EXISTING_INFRA} -eq 1 ]; then
+elif [ ${USE_EXISTING_INFRA} -gt 0 ]; then
notify "[NOTE] Use existing infra\n" 2 1>&2
check_connection
else
@@ -370,7 +385,9 @@ else
update_mcpcontrol_network
start_vms virtual_nodes
check_connection
- ./salt.sh "${LOCAL_PDF_RECLASS}"
+fi
+if [ ${USE_EXISTING_INFRA} -lt 2 ]; then
+ wait_for 5 "./salt.sh ${LOCAL_PDF_RECLASS}"
fi
# Openstack cluster setup
@@ -381,8 +398,8 @@ else
for state in "${cluster_states[@]}"; do
notify "[STATE] Applying state: ${state}\n" 2
# shellcheck disable=SC2086,2029
- ssh ${SSH_OPTS} "${SSH_SALT}" \
- sudo "/root/fuel/mcp/config/states/${state} || true"
+ wait_for 5 "ssh ${SSH_OPTS} ${SSH_SALT} \
+ sudo /root/fuel/mcp/config/states/${state}"
done
fi
@@ -390,8 +407,6 @@ fi
popd > /dev/null
-notify "\n[DONE] MCP: Openstack installation finished succesfully!\n\n" 2
-
#
# END of main
##############################################################################
diff --git a/mcp/config/states/dpdk b/mcp/config/states/dpdk
index 9ae103d90..eb00d7279 100755
--- a/mcp/config/states/dpdk
+++ b/mcp/config/states/dpdk
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
# shellcheck disable=SC1090
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
diff --git a/mcp/config/states/maas b/mcp/config/states/maas
index 685dbc9bd..d6ef5a607 100755
--- a/mcp/config/states/maas
+++ b/mcp/config/states/maas
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
# shellcheck disable=SC1090
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
diff --git a/mcp/config/states/networks b/mcp/config/states/networks
index 361e675a8..d4735adb3 100755
--- a/mcp/config/states/networks
+++ b/mcp/config/states/networks
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
# Determine public network based on external IPs from compute node
# NOTE: mask currently hardcoded to /24
PUBLIC_NET=$(salt --out yaml 'cmp*' pillar.get _param:external_address | \
diff --git a/mcp/config/states/neutron_compute b/mcp/config/states/neutron_compute
index 2a2a2ef78..70a2db607 100755
--- a/mcp/config/states/neutron_compute
+++ b/mcp/config/states/neutron_compute
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
salt -I 'neutron:compute' state.sls neutron
salt -I 'neutron:compute' file.append /etc/sudoers.d/neutron_sudoers \
args='neutron ALL = (root) NOPASSWD: /usr/bin/neutron-rootwrap-daemon /etc/neutron/rootwrap.conf'
diff --git a/mcp/config/states/opendaylight b/mcp/config/states/opendaylight
index 7b63483d8..34a2c3bd8 100755
--- a/mcp/config/states/opendaylight
+++ b/mcp/config/states/opendaylight
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
salt -I 'opendaylight:server' state.sls opendaylight
salt -I 'opendaylight:client' state.sls opendaylight.client
salt -I 'opendaylight:client' cmd.run 'neutron-odl-ovs-hostconfig --noovs_dpdk'
diff --git a/mcp/config/states/openstack b/mcp/config/states/openstack
index 968310334..19cd41703 100755
--- a/mcp/config/states/openstack
+++ b/mcp/config/states/openstack
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
salt -I 'nfs:server' file.mkdir /srv/nova/instances
salt -I 'nfs:server' state.sls nfs
salt -I 'nfs:client' state.sls nfs
diff --git a/mcp/config/states/openstack_ha b/mcp/config/states/openstack_ha
index 230288f4f..2e55fc890 100755
--- a/mcp/config/states/openstack_ha
+++ b/mcp/config/states/openstack_ha
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
# shellcheck disable=SC1090
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
@@ -37,7 +39,6 @@ salt -I 'keystone:client' state.sls keystone.client
salt -I 'keystone:server' cmd.run ". /root/keystonercv3; openstack service list"
salt -I 'glance:server' state.sls glance -b 1
-salt -I 'glusterfs:client' state.sls glusterfs.client
salt -I 'keystone:server' state.sls keystone.server
salt -I 'nova:controller' state.sls nova -b 1
@@ -50,6 +51,7 @@ salt -I 'neutron:server' state.sls neutron -b 1
salt -I 'neutron:gateway' state.sls neutron.gateway
salt -I 'nova:compute' state.sls nova
+salt -I 'glusterfs:client' state.sls glusterfs.client
salt -I 'mongodb:server' state.sls mongodb
wait_for 90 "salt -C 'I@mongodb:server and *01*' cmd.run 'mongo localhost:27017/admin'"
diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
index 58ae33506..a0e3a31d0 100755
--- a/mcp/config/states/virtual_control_plane
+++ b/mcp/config/states/virtual_control_plane
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
# shellcheck disable=SC1090
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
@@ -18,7 +20,7 @@ wait_for 90 "! salt 'kvm*' test.ping | tee /dev/stderr | grep -Fq 'Not connected
salt -C '* and not cfg01* and not mas01*' state.apply linux,ntp
-salt -C 'kvm*' state.sls libvirt
+wait_for 5 "salt -C 'kvm*' state.sls libvirt"
salt -C '* and not cfg01* and not mas01*' state.apply salt
salt -C 'kvm*' saltutil.sync_all
diff --git a/mcp/patches/patch.sh b/mcp/patches/patch.sh
index 6c6d646b3..ca5c14111 100755
--- a/mcp/patches/patch.sh
+++ b/mcp/patches/patch.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -ex
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -7,10 +7,14 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
if [ -r "$1" ]; then
while IFS=': ' read -r p_dest p_file; do
- if [[ "${p_dest}" =~ $2 ]]; then
- patch -fd "${p_dest}" -p1 < "/root/fuel/mcp/patches/${p_file}"
+ if [[ ! "${p_dest}" =~ '^#' ]] && [[ "${p_dest}" =~ $2 ]] && \
+ ! patch --dry-run -Rd "${p_dest}" -r - -s -p1 < \
+ "/root/fuel/mcp/patches/${p_file}" > /dev/null; then
+ patch -fd "${p_dest}" -p1 < "/root/fuel/mcp/patches/${p_file}"
fi
done < "$1"
fi
diff --git a/mcp/scripts/create-config-drive.sh b/mcp/scripts/create-config-drive.sh
index 51e38c60d..4b22b27ae 100755
--- a/mcp/scripts/create-config-drive.sh
+++ b/mcp/scripts/create-config-drive.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc. and others.
# All rights reserved. This program and the accompanying materials
@@ -12,6 +12,8 @@
# (using the -k/--ssh-key option) and a user-data blog (using the
# -u/--user-data option).
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+
usage () {
echo "usage: ${0##*/}: [--ssh-key <pubkey>] [--vendor-data <file>] [--user-data <file>] [--hostname <hostname>] <imagename>"
}
diff --git a/mcp/scripts/globals.sh b/mcp/scripts/globals.sh
index 6dabe65fe..ce4f9ffe9 100644
--- a/mcp/scripts/globals.sh
+++ b/mcp/scripts/globals.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -ex
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Ericsson AB, Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -8,6 +8,7 @@
##############################################################################
# Global variables
+export CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
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}
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
index 7449a2172..da129a7da 100644
--- a/mcp/scripts/lib.sh
+++ b/mcp/scripts/lib.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -198,7 +198,8 @@ function wait_for {
# shellcheck disable=SC2034
for attempt in $(seq "${total_attempts}"); do
# shellcheck disable=SC2015
- eval "${cmdstr}" && break || true
+ eval "${cmdstr}" && return 0 || true
echo -n '.'; sleep "${sleep_time}"
done
+ return 1
}
diff --git a/mcp/scripts/log.sh b/mcp/scripts/log.sh
index 8c4bf3ef5..8bfd0d553 100755
--- a/mcp/scripts/log.sh
+++ b/mcp/scripts/log.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -10,12 +10,14 @@
# Collect /var/log from all cluster nodes via Salt Master
#
+# shellcheck disable=SC1090
+[ -n "${SSH_OPTS}" ] || source "$(dirname "${BASH_SOURCE[0]}")/globals.sh"
+
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
DEPLOY_LOG=$1
OPNFV_TMP_LOG="opnfv_fuel_logs"
[ -n "${DEPLOY_LOG}" ] || exit 0
-# shellcheck disable=SC1090
-[ -n "${SSH_OPTS}" ] || source "$(dirname "${BASH_SOURCE[0]}")/globals.sh"
# ssh to cfg01
# shellcheck disable=SC2086,2087
diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh
index df0ef70fb..3bb17f0cd 100755
--- a/mcp/scripts/salt.sh
+++ b/mcp/scripts/salt.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
# Deploy Salt Master
#
+CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
F_GIT_ROOT=$(git rev-parse --show-toplevel)
OPNFV_TMP_DIR="/home/${SALT_MASTER_USER}/fuel"
OPNFV_FUEL_DIR="/root/fuel"
@@ -37,14 +38,15 @@ ssh ${SSH_OPTS} "${SSH_SALT}" bash -s -e << SALT_INSTALL_END
echo ' done'
mkdir -p /srv/salt /usr/share/salt-formulas/reclass
+ rm -rf ${OPNFV_FUEL_DIR}
mv ${OPNFV_TMP_DIR} ${OPNFV_FUEL_DIR} && chown -R root.root ${OPNFV_FUEL_DIR}
- ln -s ${OPNFV_FUEL_DIR}/mcp/reclass /srv/salt/reclass
- ln -s ${OPNFV_FUEL_DIR}/mcp/deploy/scripts /srv/salt/scripts
- cd /srv/salt/${OPNFV_RDIR} && ln -s "\$(uname -i)" arch
+ ln -sf ${OPNFV_FUEL_DIR}/mcp/reclass /srv/salt
+ ln -sf ${OPNFV_FUEL_DIR}/mcp/deploy/scripts /srv/salt
+ cd /srv/salt/${OPNFV_RDIR} && rm -f arch && ln -sf "\$(uname -i)" arch
cp -r ${OPNFV_FUEL_DIR}/mcp/metadata/service /usr/share/salt-formulas/reclass
cd /srv/salt/reclass/classes/service && \
- ln -s /usr/share/salt-formulas/reclass/service/opendaylight
+ ln -sf /usr/share/salt-formulas/reclass/service/opendaylight
cd ${OPNFV_FUEL_DIR}/mcp/patches && ./patch.sh patches.list reclass
cd /srv/salt/scripts