diff options
author | Tim Rozet <trozet@redhat.com> | 2016-01-29 02:33:42 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-01-29 02:33:43 +0000 |
commit | fac6dbae17673165dcb035b5e3e921ce0fcd7391 (patch) | |
tree | 87420d83852a1fe6ebb39c5f0727c9e54f79e5e7 | |
parent | b315e999c780903e9ff59a5ffca0de339a436487 (diff) | |
parent | 2b761537334f56608db4a1ebc1d8abb0553cdbb2 (diff) |
Merge "Various fixes and improvements"
-rwxr-xr-x | ci/deploy.sh | 45 | ||||
-rw-r--r-- | lib/common-functions.sh | 16 |
2 files changed, 55 insertions, 6 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh index 5b11d689..df528f50 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -30,7 +30,8 @@ else fi vm_index=4 -ha_enabled="TRUE" +#ha_enabled="TRUE" +interactive="FALSE" ping_site="8.8.8.8" ntp_server="pool.ntp.org" net_isolation_enabled="TRUE" @@ -811,10 +812,24 @@ function undercloud_prep_overcloud_deploy { # make sure ceph is installed DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" + # scale compute nodes according to inventory + total_nodes=$(ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cat /home/stack/instackenv.json | grep -c memory") + # check if HA is enabled if [[ "$ha_enabled" == "TRUE" ]]; then - DEPLOY_OPTIONS+=" --control-scale 3 --compute-scale 2" + DEPLOY_OPTIONS+=" --control-scale 3" + compute_nodes=$((total_nodes - 3)) DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml" + else + compute_nodes=$((total_nodes - 1)) + fi + + if [ "$compute_nodes" -le 0 ]; then + echo -e "${red}ERROR: Invalid number of compute nodes: ${compute_nodes}. Check your inventory file.${reset}" + exit 1 + else + echo -e "${blue}INFO: Number of compute nodes set for deployment: ${compute_nodes}${reset}" + DEPLOY_OPTIONS+=" --compute-scale ${compute_nodes}" fi if [[ "$net_isolation_enabled" == "TRUE" ]]; then @@ -865,6 +880,18 @@ sleep 60 #wait for Hypervisor stats to check-in to nova cat > deploy_command << EOF openstack overcloud deploy --templates $DEPLOY_OPTIONS --timeout 90 EOF +EOI + + if [ "$interactive" == "TRUE" ]; then + if ! prompt_user "Overcloud Deployment"; then + echo -e "${blue}INFO: User requests exit${reset}" + exit 0 + fi + fi + + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI +source stackrc +set -o errexit openstack overcloud deploy --templates $DEPLOY_OPTIONS --timeout 90 EOI @@ -945,6 +972,7 @@ display_usage() { echo -e " --flat : disable Network Isolation and use a single flat network for the underlay network.\n" echo -e " --no-post-config : disable Post Install configuration." echo -e " --debug : enable debug output." + echo -e " --interactive : enable interactive deployment mode which requires user to confirm steps of deployment." } ##translates the command line parameters into variables @@ -1016,6 +1044,11 @@ parse_cmdline() { echo "Enable debug output" shift 1 ;; + --interactive ) + interactive="TRUE" + echo "Interactive mode enabled" + shift 1 + ;; *) display_usage exit 1 @@ -1035,18 +1068,18 @@ parse_cmdline() { exit 1 fi - if [[ ! -z "$DEPLOY_SETTINGS_FILE" && ! -f "$DEPLOY_SETTINGS_FILE" ]]; then - echo -e "${red}ERROR: ${DEPLOY_SETTINGS_FILE} does not exist! Exiting...${reset}" + if [[ -z "$DEPLOY_SETTINGS_FILE" || ! -f "$DEPLOY_SETTINGS_FILE" ]]; then + echo -e "${red}ERROR: Deploy Settings: ${DEPLOY_SETTINGS_FILE} does not exist! Exiting...${reset}" exit 1 fi if [[ ! -z "$NETSETS" && ! -f "$NETSETS" ]]; then - echo -e "${red}ERROR: ${NETSETS} does not exist! Exiting...${reset}" + echo -e "${red}ERROR: Network Settings: ${NETSETS} does not exist! Exiting...${reset}" exit 1 fi if [[ ! -z "$INVENTORY_FILE" && ! -f "$INVENTORY_FILE" ]]; then - echo -e "{$red}ERROR: ${DEPLOY_SETTINGS_FILE} does not exist! Exiting...${reset}" + echo -e "{$red}ERROR: Inventory File: ${INVENTORY_FILE} does not exist! Exiting...${reset}" exit 1 fi diff --git a/lib/common-functions.sh b/lib/common-functions.sh index 7435411e..0b1eb7d2 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -544,3 +544,19 @@ iptables -A FORWARD -s ${external_cidr} -m state --state ESTABLISHED,RELATED -j service iptables save EOI } + +# Interactive prompt handler +# params: step stage, ex. deploy, undercloud install, etc +function prompt_user { + while [ 1 ]; do + echo -n "Would you like to proceed with ${1}? (y/n) " + read response + if [ "$response" == 'y' ]; then + return 0 + elif [ "$response" == 'n' ]; then + return 1 + else + continue + fi + done +} |