defaults: add missing handlers for rbd mirorr and mgr

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/1939/head
Sébastien Han 2017-09-27 02:08:40 +02:00
parent 048b55be4a
commit e121bc58e9
7 changed files with 106 additions and 0 deletions

View File

@ -398,6 +398,14 @@ dummy:
#handler_health_nfs_check_retries: 5 #handler_health_nfs_check_retries: 5
#handler_health_nfs_check_delay: 10 #handler_health_nfs_check_delay: 10
# RBD MIRROR handler checks
#handler_health_rbd_mirror_check_retries: 5
#handler_health_rbd_mirror_check_delay: 10
# MGR handler checks
#handler_health_mgr_check_retries: 5
#handler_health_mgr_check_delay: 10
############### ###############
# NFS-GANESHA # # NFS-GANESHA #
############### ###############

View File

@ -398,6 +398,14 @@ ceph_repository: rhcs
#handler_health_nfs_check_retries: 5 #handler_health_nfs_check_retries: 5
#handler_health_nfs_check_delay: 10 #handler_health_nfs_check_delay: 10
# RBD MIRROR handler checks
#handler_health_rbd_mirror_check_retries: 5
#handler_health_rbd_mirror_check_delay: 10
# MGR handler checks
#handler_health_mgr_check_retries: 5
#handler_health_mgr_check_delay: 10
############### ###############
# NFS-GANESHA # # NFS-GANESHA #
############### ###############

View File

@ -117,6 +117,8 @@
- restart ceph osds - restart ceph osds
- restart ceph mdss - restart ceph mdss
- restart ceph rgws - restart ceph rgws
- restart ceph rbdmirrors
- restart ceph mgrs
- name: set fsid fact when generate_fsid = true - name: set fsid fact when generate_fsid = true
set_fact: set_fact:

View File

@ -390,6 +390,14 @@ handler_health_rgw_check_delay: 10
handler_health_nfs_check_retries: 5 handler_health_nfs_check_retries: 5
handler_health_nfs_check_delay: 10 handler_health_nfs_check_delay: 10
# RBD MIRROR handler checks
handler_health_rbd_mirror_check_retries: 5
handler_health_rbd_mirror_check_delay: 10
# MGR handler checks
handler_health_mgr_check_retries: 5
handler_health_mgr_check_delay: 10
############### ###############
# NFS-GANESHA # # NFS-GANESHA #
############### ###############

View File

@ -126,3 +126,43 @@
# We do not want to run these checks on initial deployment (`socket.rc == 0`) # We do not want to run these checks on initial deployment (`socket.rc == 0`)
- nfs_group_name in group_names - nfs_group_name in group_names
- nfs_socket_stat.rc == 0 - nfs_socket_stat.rc == 0
- name: copy rbd mirror restart script
template:
src: restart_rbd_mirror_daemon.sh.j2
dest: /tmp/restart_rbd_mirror_daemon.sh
owner: root
group: root
mode: 0750
listen: "restart ceph rbdmirrors"
when:
- rbdmirror_group_name in group_names
- inventory_hostname in play_hosts
- name: restart ceph rbd mirror daemon(s)
command: /tmp/restart_rbd_mirror_daemon.sh
listen: "restart ceph rbdmirrors"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- rbdmirror_group_name in group_names
- rbd_mirror_socket_stat.rc == 0
- name: copy mgr restart script
template:
src: restart_mgr_daemon.sh.j2
dest: /tmp/restart_mgr_daemon.sh
owner: root
group: root
mode: 0750
listen: "restart ceph mgrs"
when:
- mgr_group_name in group_names
- inventory_hostname in play_hosts
- name: restart ceph mgr daemon(s)
command: /tmp/restart_mgr_daemon.sh
listen: "restart ceph mgrs"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mgr_group_name in group_names
- mgr_socket_stat.rc == 0

View File

@ -0,0 +1,20 @@
#!/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
# 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
{{ docker_exec_cmd }} test -S $SOCKET && exit 0
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

View File

@ -0,0 +1,20 @@
#!/bin/bash
RETRIES="{{ handler_health_rbd_mirror_check_retries }}"
DELAY="{{ handler_health_rbd_mirror_check_delay }}"
RBD_MIRROR_NAME="{{ ansible_hostname }}"
SOCKET=/var/run/ceph/{{ cluster }}-client.rbd-mirror.${RBD_MIRROR_NAME}.asok
# First, restart the daemon
systemctl restart ceph-rbd-mirror@rbd-mirror.${RBD_MIRROR_NAME}
COUNT=10
# Wait and ensure the socket exists after restarting the daemon
while [ $RETRIES -ne 0 ]; do
{{ docker_exec_cmd }} test -S $SOCKET && exit 0
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 rbd mirror is not running."
exit 1