Merge "Restart only services that need it"

This commit is contained in:
Jenkins 2016-09-01 18:00:03 +00:00 committed by Gerrit Code Review
commit 3a5d28c473
1 changed files with 16 additions and 8 deletions

View File

@ -7,15 +7,23 @@ pacemaker_status=$(systemctl is-active pacemaker)
# Run if pacemaker is running, we're the bootstrap node,
# and we're updating the deployment (not creating).
if [ "$pacemaker_status" = "active" -a \
"$(hiera bootstrap_nodeid)" = "$(facter hostname)" -a \
"$(hiera stack_action)" = "UPDATE" ]; then
"$(hiera bootstrap_nodeid)" = "$(facter hostname)" ]; then
PCMK_RESOURCES="haproxy-clone redis-master rabbitmq-clone galera-master openstack-cinder-volume openstack-cinder-backup"
# Ten minutes of timeout to restart each resource, given there are no constraints should be enough
TIMEOUT=600
for resource in $PCMK_RESOURCES; do
if pcs status | grep $resource; then
pcs resource restart --wait=$TIMEOUT $resource
fi
SERVICES_TO_RESTART="$(ls /var/lib/tripleo/pacemaker-restarts)"
PCS_STATUS_OUTPUT="$(pcs status)"
for service in $SERVICES_TO_RESTART; do
if ! echo "$PCS_STATUS_OUTPUT" | grep $service; then
echo "Service $service not found as a pacemaker resource, cannot restart it."
exit 1
fi
done
for service in $SERVICES_TO_RESTART; do
echo "Restarting $service..."
pcs resource restart --wait=$TIMEOUT $service
rm -f /var/lib/tripleo/pacemaker-restarts/$service
done
fi