2017-09-27 08:08:40 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
RETRIES="{{ handler_health_rbd_mirror_check_retries }}"
|
|
|
|
DELAY="{{ handler_health_rbd_mirror_check_delay }}"
|
2021-03-03 22:43:50 +08:00
|
|
|
RBD_MIRROR_NAME="{{ ansible_facts['hostname'] }}"
|
2020-09-26 00:15:02 +08:00
|
|
|
{% if containerized_deployment | bool %}
|
2021-03-03 22:43:50 +08:00
|
|
|
DOCKER_EXEC="{{ container_binary }} exec ceph-rbd-mirror-{{ ansible_facts['hostname'] }}"
|
2018-07-31 21:18:28 +08:00
|
|
|
{% endif %}
|
2018-10-11 03:24:22 +08:00
|
|
|
|
2018-07-31 21:18:28 +08:00
|
|
|
# Backward compatibility
|
2021-03-03 22:43:50 +08:00
|
|
|
$DOCKER_EXEC test -S /var/run/ceph/{{ cluster }}-client.rbd-mirror.{{ ansible_facts['fqdn'] }}.asok && SOCKET=/var/run/ceph/{{ cluster }}-client.rbd-mirror.{{ ansible_facts['fqdn'] }}.asok
|
|
|
|
$DOCKER_EXEC test -S /var/run/ceph/{{ cluster }}-client.rbd-mirror.{{ ansible_facts['hostname'] }}.asok && SOCKET=/var/run/ceph/{{ cluster }}-client.rbd-mirror.{{ ansible_facts['hostname'] }}.asok
|
2017-09-27 08:08:40 +08:00
|
|
|
|
|
|
|
# First, restart the daemon
|
|
|
|
systemctl restart ceph-rbd-mirror@rbd-mirror.${RBD_MIRROR_NAME}
|
|
|
|
|
|
|
|
# Wait and ensure the socket exists after restarting the daemon
|
|
|
|
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.
|
2018-11-27 17:45:05 +08:00
|
|
|
echo "Socket file ${SOCKET} could not be found, which means rbd mirror is not running. Showing ceph-rbd-mirror unit logs now:"
|
|
|
|
journalctl -u ceph-rbd-mirror@rbd-mirror.${RBD_MIRROR_NAME}
|
2017-09-27 08:08:40 +08:00
|
|
|
exit 1
|