summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xci/deploy.sh45
-rw-r--r--lib/common-functions.sh16
2 files changed, 55 insertions, 6 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh
index d0b8338b..a2c9c434 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
@@ -944,6 +971,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
@@ -1015,6 +1043,11 @@ parse_cmdline() {
echo "Enable debug output"
shift 1
;;
+ --interactive )
+ interactive="TRUE"
+ echo "Interactive mode enabled"
+ shift 1
+ ;;
*)
display_usage
exit 1
@@ -1034,18 +1067,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
+}