diff options
author | Tim Rozet <trozet@redhat.com> | 2016-08-27 11:35:48 -0400 |
---|---|---|
committer | Tim Rozet <trozet@redhat.com> | 2016-08-27 11:35:48 -0400 |
commit | 38a4ac1614905066b24071c682170736e4779e79 (patch) | |
tree | ae51dcdfe4aaf86b127f0c8fba6f5257755f137e | |
parent | f52438b36ea567ae6d9564de72ee6b5054396ae1 (diff) |
Fixes control/compute node detection
Previous behavior was detecting the total number of nodes in the
inventory file and defining number of compute nodes as total nodes,
minus 1 or 3 control nodes (depending on HA flag). This patch changes
the behavior to look explicitly for number of compute/control
nodes in the inventory file.
JIRA: APEX-244
Change-Id: I0191bb88e7dc5bebb5f7bfed39661f8047dbd476
Signed-off-by: Tim Rozet <trozet@redhat.com>
-rwxr-xr-x | lib/overcloud-deploy-functions.sh | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/overcloud-deploy-functions.sh b/lib/overcloud-deploy-functions.sh index ab8086b5..1127f049 100755 --- a/lib/overcloud-deploy-functions.sh +++ b/lib/overcloud-deploy-functions.sh @@ -11,6 +11,9 @@ ##preping it for deployment and launch the deploy ##params: none function overcloud_deploy { + local num_compute_nodes + local num_control_nodes + if [[ "${#deploy_options_array[@]}" -eq 0 || "${deploy_options_array['sdn_controller']}" == 'opendaylight' ]]; then if [ "${deploy_options_array['sdn_l3']}" == 'True' ]; then DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_l3.yaml" @@ -179,24 +182,33 @@ EOI # 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" "grep -c memory /home/stack/instackenv.json") + # get number of nodes available in inventory + num_control_nodes=$(ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "grep -c profile:control /home/stack/instackenv.json") + num_compute_nodes=$(ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "grep -c profile:compute /home/stack/instackenv.json") # check if HA is enabled if [[ "$ha_enabled" == "True" ]]; then - DEPLOY_OPTIONS+=" --control-scale 3" - compute_nodes=$((total_nodes - 3)) + if [ "$num_control_nodes" -lt 3 ]; then + echo -e "${red}ERROR: Number of control nodes in inventory is less than 3 and HA is enabled: ${num_control_nodes}. Check your inventory file.${reset}" + exit 1 + else + DEPLOY_OPTIONS+=" --control-scale ${num_control_nodes}" DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml" + echo -e "${blue}INFO: Number of control nodes set for deployment: ${num_control_nodes}${reset}" + fi else - compute_nodes=$((total_nodes - 1)) + if [ "$num_control_nodes" -lt 1 ]; then + echo -e "${red}ERROR: Number of control nodes in inventory is less than 1: ${num_control_nodes}. Check your inventory file.${reset}" + exit 1 + fi fi - if [ "$compute_nodes" -le 0 ]; then - echo -e "${red}ERROR: Invalid number of compute nodes: ${compute_nodes}. Check your inventory file.${reset}" + if [ "$num_compute_nodes" -le 0 ]; then + echo -e "${red}ERROR: Invalid number of compute nodes: ${num_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}" + echo -e "${blue}INFO: Number of compute nodes set for deployment: ${num_compute_nodes}${reset}" + DEPLOY_OPTIONS+=" --compute-scale ${num_compute_nodes}" fi if [[ "$net_isolation_enabled" == "TRUE" ]]; then |