98 lines
3.0 KiB
Django/Jinja
98 lines
3.0 KiB
Django/Jinja
#!/bin/bash
|
|
|
|
set -eux
|
|
|
|
### --start_docs
|
|
## Deploying the overcloud
|
|
## =======================
|
|
|
|
## Prepare Your Environment
|
|
## ------------------------
|
|
|
|
## * Source in the undercloud credentials.
|
|
## ::
|
|
|
|
source {{ working_dir }}/stackrc
|
|
|
|
{% if hypervisor_wait|bool %}
|
|
### --stop_docs
|
|
# Wait until there are hypervisors available.
|
|
while true; do
|
|
count=$(openstack hypervisor stats show -c count -f value)
|
|
if [ $count -gt 0 ]; then
|
|
break
|
|
fi
|
|
done
|
|
{% endif %}
|
|
|
|
### --start_docs
|
|
|
|
{% if release in ['mitaka', 'liberty'] and set_overcloud_workers|bool %}
|
|
## * Include configuration necessary for the ping test here if requested via the
|
|
## ansible `test_ping` variable.
|
|
## ::
|
|
|
|
DEPLOY_ENV_YAML=/tmp/deploy_env.yaml
|
|
|
|
## * Set most service workers to 1 to minimise memory usage on
|
|
## the deployed overcloud when using the pingtest. We use this
|
|
## test over tempest when we are memory constrained, ie the HA jobs.
|
|
## ::
|
|
|
|
cat > $DEPLOY_ENV_YAML << EOENV
|
|
parameter_defaults:
|
|
controllerExtraConfig:
|
|
# In releases before Mitaka, HeatWorkers doesn't modify
|
|
# num_engine_workers, so handle via heat::config
|
|
heat::config::heat_config:
|
|
DEFAULT/num_engine_workers:
|
|
value: 1
|
|
heat::api_cloudwatch::enabled: false
|
|
heat::api_cfn::enabled: false
|
|
HeatWorkers: 1
|
|
CeilometerWorkers: 1
|
|
CinderWorkers: 1
|
|
GlanceWorkers: 1
|
|
KeystoneWorkers: 1
|
|
NeutronWorkers: 1
|
|
NovaWorkers: 1
|
|
SwiftWorkers: 1
|
|
EOENV
|
|
{% endif %}
|
|
|
|
## * Deploy the overcloud!
|
|
## ::
|
|
openstack overcloud deploy \
|
|
--templates {{overcloud_templates_path}} \
|
|
{{ deploy_args }} \
|
|
${DEPLOY_ENV_YAML:+-e $DEPLOY_ENV_YAML} "$@" && status_code=0 || status_code=$?
|
|
|
|
### --stop_docs
|
|
# We don't always get a useful error code from the openstack deploy command,
|
|
# so check `heat stack-list` for a CREATE_FAILED status.
|
|
if heat stack-list | grep -q 'CREATE_FAILED'; then
|
|
{%if release not in ['mitaka', 'liberty'] %}
|
|
# get the failures list
|
|
openstack stack failures list overcloud > failed_deployment_list.log || true
|
|
{% endif %}
|
|
|
|
# get any puppet related errors
|
|
for failed in $(heat resource-list \
|
|
--nested-depth 5 overcloud | grep FAILED |
|
|
grep 'StructuredDeployment ' | cut -d '|' -f3)
|
|
do
|
|
echo "heat deployment-show out put for deployment: $failed" >> failed_deployments.log
|
|
echo "######################################################" >> failed_deployments.log
|
|
heat deployment-show $failed >> failed_deployments.log
|
|
echo "######################################################" >> failed_deployments.log
|
|
echo "puppet standard error for deployment: $failed" >> failed_deployments.log
|
|
echo "######################################################" >> failed_deployments.log
|
|
# the sed part removes color codes from the text
|
|
heat deployment-show $failed |
|
|
jq -r .output_values.deploy_stderr |
|
|
sed -r "s:\x1B\[[0-9;]*[mK]::g" >> failed_deployments.log
|
|
echo "######################################################" >> failed_deployments.log
|
|
# We need to exit with 1 because of the above || true
|
|
done
|
|
fi
|
|
exit $status_code |