2017-09-27 08:08:40 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
RETRIES="{{ handler_health_mgr_check_retries }}"
|
|
|
|
DELAY="{{ handler_health_mgr_check_delay }}"
|
|
|
|
MGR_NAME="{{ ansible_hostname }}"
|
|
|
|
SOCKET=/var/run/ceph/{{ cluster }}-mgr.${MGR_NAME}.asok
|
2017-09-28 00:22:15 +08:00
|
|
|
{% if containerized_deployment %}
|
|
|
|
DOCKER_EXEC="docker exec ceph-mgr-{{ ansible_hostname }}"
|
|
|
|
{% endif %}
|
2017-09-27 08:08:40 +08:00
|
|
|
|
2018-06-20 13:01:06 +08:00
|
|
|
systemctl reset-failed ceph-mgr@${MGR_NAME}
|
2017-09-27 08:08:40 +08:00
|
|
|
# First, restart the daemon
|
|
|
|
systemctl restart ceph-mgr@${MGR_NAME}
|
|
|
|
|
|
|
|
COUNT=10
|
|
|
|
# Wait and ensure the socket exists after restarting the daemds
|
|
|
|
while [ $RETRIES -ne 0 ]; do
|
2017-09-28 00:22:15 +08:00
|
|
|
$DOCKER_EXEC test -S $SOCKET && exit 0
|
2017-09-27 08:08:40 +08:00
|
|
|
sleep $DELAY
|
|
|
|
let RETRIES=RETRIES-1
|
|
|
|
done
|
|
|
|
# If we reach this point, it means the socket is not present.
|
|
|
|
echo "Socket file ${SOCKET} could not be found, which means ceph manager is not running."
|
|
|
|
exit 1
|