From 12f6e53090d36798228634672a597ad921886eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 7 Sep 2017 23:33:45 +0200 Subject: [PATCH 1/2] defaults: do not restart unconfigured (yet) daemons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a collocated scenario, where you might put a rgw, a mds and a mon on the same node you don't want the handler blindly restart all the daemons on the node. Indeed some of them might not be configured yet. Implementing a more precise socket detection, for each daemon type. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1488813 Signed-off-by: Sébastien Han --- roles/ceph-defaults/handlers/main.yml | 14 +++++-- roles/ceph-defaults/tasks/check_socket.yml | 46 ++++++++++++++++++++-- 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/roles/ceph-defaults/handlers/main.yml b/roles/ceph-defaults/handlers/main.yml index 8f21db762..91a533b65 100644 --- a/roles/ceph-defaults/handlers/main.yml +++ b/roles/ceph-defaults/handlers/main.yml @@ -19,7 +19,7 @@ listen: "restart ceph mons" when: # We do not want to run these checks on initial deployment (`socket.rc == 0`) - - socket.rc == 0 + - mon_socket.rc == 0 - mon_group_name in group_names # This does not just restart OSDs but everything else too. Unfortunately @@ -57,7 +57,7 @@ when: # We do not want to run these checks on initial deployment (`socket_osd_container.results[n].rc == 0`) # except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified - - ((crush_location is defined and crush_location) or socket.rc == 0) + - ((crush_location is defined and crush_location) or osd_socket.rc == 0) - ceph_current_fsid.rc == 0 - handler_health_osd_check # See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below @@ -76,12 +76,18 @@ - inventory_hostname in play_hosts - mds_group_name in group_names +- name: debug socket mds + debug: msg="{{mds_socket}}" + listen: "restart ceph mdss" + when: + - mds_group_name in group_names + - name: restart ceph mds daemon(s) command: /tmp/restart_mds_daemon.sh listen: "restart ceph mdss" when: # We do not want to run these checks on initial deployment (`socket.rc == 0`) - - socket.rc == 0 + - mds_socket.rc == 0 - mds_group_name in group_names - name: copy rgw restart script @@ -101,7 +107,7 @@ listen: "restart ceph rgws" when: # We do not want to run these checks on initial deployment (`socket.rc == 0`) - - socket.rc == 0 + - rgw_socket.rc == 0 - rgw_group_name in group_names - name: restart ceph nfss diff --git a/roles/ceph-defaults/tasks/check_socket.yml b/roles/ceph-defaults/tasks/check_socket.yml index 93f0db278..ddfffeca8 100644 --- a/roles/ceph-defaults/tasks/check_socket.yml +++ b/roles/ceph-defaults/tasks/check_socket.yml @@ -1,12 +1,52 @@ --- # These checks are used to avoid running handlers at initial deployment. -- name: check for a ceph socket +- name: check for a ceph mon socket shell: | - {{ docker_exec_cmd }} bash -c 'stat {{ rbd_client_admin_socket_path }}/*.asok > /dev/null 2>&1' + {{ docker_exec_cmd }} bash -c 'stat {{ rbd_client_admin_socket_path }}/{{ cluster }}-mon*.asok > /dev/null 2>&1' changed_when: false failed_when: false always_run: true - register: socket + register: mon_socket + +- name: check for a ceph osd socket + shell: | + {{ docker_exec_cmd }} bash -c 'stat {{ rbd_client_admin_socket_path }}/{{ cluster }}-osd*.asok > /dev/null 2>&1' + changed_when: false + failed_when: false + always_run: true + register: osd_socket + +- name: check for a ceph mds socket + shell: | + {{ docker_exec_cmd }} bash -c 'stat {{ rbd_client_admin_socket_path }}/{{ cluster }}-mds*.asok > /dev/null 2>&1' + changed_when: false + failed_when: false + always_run: true + register: mds_socket + +- name: check for a ceph rgw socket + shell: | + {{ docker_exec_cmd }} bash -c 'stat {{ rbd_client_admin_socket_path }}/{{ cluster }}-client.rgw*.asok > /dev/null 2>&1' + changed_when: false + failed_when: false + always_run: true + register: rgw_socket + +- name: check for a ceph mgr socket + shell: | + {{ docker_exec_cmd }} bash -c 'stat {{ rbd_client_admin_socket_path }}/{{ cluster }}-mgr*.asok > /dev/null 2>&1' + changed_when: false + failed_when: false + always_run: true + register: mgr_socket + +- name: check for a ceph rbd mirror socket + shell: | + {{ docker_exec_cmd }} bash -c 'stat {{ rbd_client_admin_socket_path }}/{{ cluster }}-client.rbd-mirror*.asok > /dev/null 2>&1' + changed_when: false + failed_when: false + always_run: true + register: rbd_mirror_socket - name: check for a ceph socket in containerized deployment (osds) shell: | From 44fd928e236878f56bc269fe650e8f8f3a649441 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 8 Sep 2017 15:57:58 +0200 Subject: [PATCH 2/2] mds: rename mds_socket fact Rename this fact to keep consistency with handlers in `ceph-defaults`. Signed-off-by: Guillaume Abrioux --- roles/ceph-mds/tasks/docker/enable_multimds.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/ceph-mds/tasks/docker/enable_multimds.yml b/roles/ceph-mds/tasks/docker/enable_multimds.yml index 7bf6e3e40..e050f79ef 100644 --- a/roles/ceph-mds/tasks/docker/enable_multimds.yml +++ b/roles/ceph-mds/tasks/docker/enable_multimds.yml @@ -1,10 +1,10 @@ --- - name: wait for mds socket to exist command: "{{ docker_exec_cmd }} stat /var/run/ceph/{{ cluster }}-mds.{{ ansible_hostname }}.asok" - register: mds_socket + register: multi_mds_socket retries: 5 delay: 15 - until: mds_socket.rc == 0 + until: multi_mds_socket.rc == 0 - name: enable multimds if requested when mon is containerized command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} fs set {{ cephfs }} allow_multimds true --yes-i-really-mean-it"