aboutsummaryrefslogtreecommitdiffstats
path: root/extraconfig/tasks/pacemaker_resource_restart.sh
diff options
context:
space:
mode:
authorJiri Stransky <jistr@redhat.com>2016-08-22 11:29:17 +0200
committerJiri Stransky <jistr@redhat.com>2016-08-31 15:53:08 +0200
commit1590edbeca31caa7c5368f636f3869dd192c19c3 (patch)
treeef96a614c0f086bc91b6316c1db105c0cbd93c8b /extraconfig/tasks/pacemaker_resource_restart.sh
parentf9000048e5d120e5a47eaad44318f8b884b5ba7d (diff)
Restart only services that need it
With new pacemaker architecture, Puppet handles restarts of most of the services. There are several still managed by pacemaker which need special restart handling utilizing pacemaker and its resource agents. The counterpart in puppet-tripleo requests restarts for individual pacemaker-managed services by writing out "restart flag" files, and the pacemaker_resource_restart.sh script then performs the restarts. Change-Id: Ia4e6a9f88181f1981993f046cf415dbbcdc9570e Closes-Bug: #1614967 Closes-Bug: #1587015 Depends-On: I6369ab0c82dbf3c8f21043f8aa9ab810744ddc12
Diffstat (limited to 'extraconfig/tasks/pacemaker_resource_restart.sh')
-rwxr-xr-xextraconfig/tasks/pacemaker_resource_restart.sh24
1 files changed, 16 insertions, 8 deletions
diff --git a/extraconfig/tasks/pacemaker_resource_restart.sh b/extraconfig/tasks/pacemaker_resource_restart.sh
index 1637cee2..fd1fd0dc 100755
--- a/extraconfig/tasks/pacemaker_resource_restart.sh
+++ b/extraconfig/tasks/pacemaker_resource_restart.sh
@@ -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