From 4a4c8a1c761567f4a4bc85f25a640bd209639fc3 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Thu, 26 Jan 2017 15:17:19 -0500 Subject: [PATCH] Use bootstrap subnodes environment in CI Use the bootstrap subnode environment in CI that was added in I6be94604a46382e6288df1b36b9de8fab58696cc instead of bootstrapping the subnodes manually first. Even when using the environment, we need to do a minimal bootstrap to do some cleanup from the infra spawned nodes and initially install the agent packages. Change-Id: I90619e8027b43dd2f2efc5a9d3cc7de80a906fb5 --- scripts/bootstrap-overcloud-full-minimal.sh | 37 +++++++++++++++++++++ scripts/common_functions.sh | 2 +- scripts/quickstart/multinode-settings.yml | 1 + scripts/tripleo.sh | 9 ++++- toci_gate_test.sh | 9 +++-- 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100755 scripts/bootstrap-overcloud-full-minimal.sh diff --git a/scripts/bootstrap-overcloud-full-minimal.sh b/scripts/bootstrap-overcloud-full-minimal.sh new file mode 100755 index 000000000..4c240a8ce --- /dev/null +++ b/scripts/bootstrap-overcloud-full-minimal.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -eux + +export STABLE_RELEASE=${STABLE_RELEASE:-""} + +# Source deploy.env if it exists. It should exist if we are running under +# tripleo-ci +export TRIPLEO_ROOT=${TRIPLEO_ROOT:-"/opt/stack/new"} +if [ -f "$TRIPLEO_ROOT/tripleo-ci/deploy.env" ]; then + source $TRIPLEO_ROOT/tripleo-ci/deploy.env +fi + +# Ensure epel-release is not installed +sudo yum erase -y epel-release || : + +# Copied from toci_gate_test.sh...need to apply this fix on subnodes as well +# TODO(pabelanger): Why is python-requests installed from pip? +sudo rm -rf /usr/lib/python2.7/site-packages/requests +# Reinstall python-requests if it was already installed, otherwise it will be +# installed later when other packages are installed. +if rpm -q python-requests; then + sudo yum reinstall -y python-requests +fi + +# Clear out any puppet modules on the node placed their by infra configuration +sudo rm -rf /etc/puppet/modules/* + +# This will remove any puppet configuration done my infra setup +sudo yum -y remove puppet facter hiera + +# Update everything +sudo yum -y update + +# git is needed since oooq multinode jobs does a git clone +# See https://bugs.launchpad.net/tripleo-quickstart/+bug/1667043 +sudo yum -y install git python-heat-agent* diff --git a/scripts/common_functions.sh b/scripts/common_functions.sh index 81c82ab84..4e34a3a13 100755 --- a/scripts/common_functions.sh +++ b/scripts/common_functions.sh @@ -334,7 +334,7 @@ function layer_ci_repo { function echo_vars_to_deploy_env { CALLER=$(caller) echo "# Written via echo_vars_to_deploy_env from $CALLER" >> $TRIPLEO_ROOT/tripleo-ci/deploy.env - for VAR in CENTOS_MIRROR http_proxy INTROSPECT MY_IP no_proxy NODECOUNT OVERCLOUD_DEPLOY_ARGS OVERCLOUD_UPDATE_ARGS PACEMAKER SSH_OPTIONS STABLE_RELEASE TRIPLEO_ROOT TRIPLEO_SH_ARGS NETISO_V4 NETISO_V6 TOCI_JOBTYPE UNDERCLOUD_SSL UNDERCLOUD_HEAT_CONVERGENCE RUN_TEMPEST_TESTS RUN_PING_TEST JOB_NAME OVB UNDERCLOUD_IDEMPOTENT MULTINODE CONTROLLER_HOSTS COMPUTE_HOSTS SUBNODES_SSH_KEY TEST_OVERCLOUD_DELETE OVERCLOUD OSINFRA UNDERCLOUD_SANITY_CHECK OVERCLOUD_PINGTEST_ARGS FEATURE_BRANCH OVERCLOUD_ROLES UPGRADE_RELEASE OVERCLOUD_MAJOR_UPGRADE MAJOR_UPGRADE UNDERCLOUD_MAJOR_UPGRADE CA_SERVER UNDERCLOUD_TELEMETRY UNDERCLOUD_UI UNDERCLOUD_VALIDATIONS PREDICTABLE_PLACEMENT OPSTOOLS_REPO_ENABLED UPGRADE_ENV UNDERCLOUD_CONTAINERS; do + for VAR in CENTOS_MIRROR http_proxy INTROSPECT MY_IP no_proxy NODECOUNT OVERCLOUD_DEPLOY_ARGS OVERCLOUD_UPDATE_ARGS PACEMAKER SSH_OPTIONS STABLE_RELEASE TRIPLEO_ROOT TRIPLEO_SH_ARGS NETISO_V4 NETISO_V6 TOCI_JOBTYPE UNDERCLOUD_SSL UNDERCLOUD_HEAT_CONVERGENCE RUN_TEMPEST_TESTS RUN_PING_TEST JOB_NAME OVB UNDERCLOUD_IDEMPOTENT MULTINODE CONTROLLER_HOSTS COMPUTE_HOSTS SUBNODES_SSH_KEY TEST_OVERCLOUD_DELETE OVERCLOUD OSINFRA UNDERCLOUD_SANITY_CHECK OVERCLOUD_PINGTEST_ARGS FEATURE_BRANCH OVERCLOUD_ROLES UPGRADE_RELEASE OVERCLOUD_MAJOR_UPGRADE MAJOR_UPGRADE UNDERCLOUD_MAJOR_UPGRADE CA_SERVER UNDERCLOUD_TELEMETRY UNDERCLOUD_UI UNDERCLOUD_VALIDATIONS PREDICTABLE_PLACEMENT OPSTOOLS_REPO_ENABLED UPGRADE_ENV UNDERCLOUD_CONTAINERS BOOTSTRAP_SUBNODES_MINIMAL; do echo "export $VAR=\"${!VAR}\"" >> $TRIPLEO_ROOT/tripleo-ci/deploy.env done for role in $OVERCLOUD_ROLES; do diff --git a/scripts/quickstart/multinode-settings.yml b/scripts/quickstart/multinode-settings.yml index 1257252db..8c3b12930 100644 --- a/scripts/quickstart/multinode-settings.yml +++ b/scripts/quickstart/multinode-settings.yml @@ -7,6 +7,7 @@ gating_repo_enabled: true tripleo_root: "{{ lookup('env','TRIPLEO_ROOT') }}" extra_args: > -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-environment.yaml + -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-bootstrap-environment-centos.yaml -e ${TRIPLEO_ROOT}/tripleo-ci/test-environments/worker-config.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/debug.yaml --compute-scale 0 diff --git a/scripts/tripleo.sh b/scripts/tripleo.sh index 3566d55a7..df592aaa8 100755 --- a/scripts/tripleo.sh +++ b/scripts/tripleo.sh @@ -1387,13 +1387,20 @@ function bootstrap_subnodes { bootstrap_subnodes_repos + local bootstrap_script + if [ "$BOOTSTRAP_SUBNODES_MINIMAL" = "1" ]; then + bootstrap_script=bootstrap-overcloud-full-minimal.sh + else + bootstrap_script=bootstrap-overcloud-full.sh + fi + for ip in $sub_nodes; do log "Bootstrapping $ip" # Run overcloud full bootstrap script log "Running bootstrap-overcloud-full.sh on $ip" ssh $SSH_OPTIONS -t -i /etc/nodepool/id_rsa $ip \ TRIPLEO_ROOT=$TRIPLEO_ROOT \ - $TRIPLEO_ROOT/tripleo-ci/scripts/bootstrap-overcloud-full.sh + $TRIPLEO_ROOT/tripleo-ci/scripts/$bootstrap_script done log "Bootstrap subnodes - DONE". diff --git a/toci_gate_test.sh b/toci_gate_test.sh index 97107c90a..64323f9a1 100755 --- a/toci_gate_test.sh +++ b/toci_gate_test.sh @@ -101,6 +101,7 @@ export UNDERCLOUD_CONTAINERS=0 export PREDICTABLE_PLACEMENT=0 export OPSTOOLS_REPO_ENABLED=0 export POSTCI=1 +export BOOTSTRAP_SUBNODES_MINIMAL=1 if [[ $TOCI_JOBTYPE =~ upgrades ]]; then # We deploy a master Undercloud and an Overcloud with the @@ -200,6 +201,9 @@ for JOB_TYPE_PART in $(sed 's/-/ /g' <<< "${TOCI_JOBTYPE:-}") ; do fi if [[ $TOCI_JOBTYPE =~ 'multinode-upgrades' ]] ; then OVERCLOUD_MAJOR_UPGRADE=1 + # We still bootstrap subnodes manually for multinode-upgrades + # because we are deploying Newton initially. + BOOTSTRAP_SUBNODES_MINIMAL=0 UNDERCLOUD_SSL=0 export UNDERCLOUD_SANITY_CHECK=0 if [[ $TOCI_JOBTYPE == 'multinode-upgrades' ]] ; then @@ -266,6 +270,7 @@ for JOB_TYPE_PART in $(sed 's/-/ /g' <<< "${TOCI_JOBTYPE:-}") ; do INTROSPECT=0 SUBNODES_SSH_KEY=/etc/nodepool/id_rsa OVERCLOUD_DEPLOY_ARGS="--libvirt-type=qemu -t $OVERCLOUD_DEPLOY_TIMEOUT" + BOOTSTRAP_SUBNODES_MINIMAL=1 if [[ "$TOCI_JOBTYPE" =~ "3nodes" ]]; then NODECOUNT=2 @@ -273,11 +278,11 @@ for JOB_TYPE_PART in $(sed 's/-/ /g' <<< "${TOCI_JOBTYPE:-}") ; do OVERCLOUD_ROLES="ControllerApi Controller" export ControllerApi_hosts=$(sed -n 1,1p /etc/nodepool/sub_nodes) export Controller_hosts=$(sed -n 2,2p /etc/nodepool/sub_nodes) - OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-environment.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/multinode-3nodes.yaml --compute-scale 0 --overcloud-ssh-user $OVERCLOUD_SSH_USER --validation-errors-nonfatal -r /usr/share/openstack-tripleo-heat-templates/ci/environments/multinode-3nodes.yaml" + OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-environment.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-bootstrap-environment-centos.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/multinode-3nodes.yaml --compute-scale 0 --overcloud-ssh-user $OVERCLOUD_SSH_USER --validation-errors-nonfatal -r /usr/share/openstack-tripleo-heat-templates/ci/environments/multinode-3nodes.yaml" else NODECOUNT=1 CONTROLLER_HOSTS=$(sed -n 1,1p /etc/nodepool/sub_nodes) - OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-environment.yaml -e $MULTINODE_ENV_PATH --compute-scale 0 --overcloud-ssh-user $OVERCLOUD_SSH_USER --validation-errors-nonfatal" + OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-environment.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-bootstrap-environment-centos.yaml -e $MULTINODE_ENV_PATH --compute-scale 0 --overcloud-ssh-user $OVERCLOUD_SSH_USER --validation-errors-nonfatal" fi ;; undercloud)