]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
defaults: do not restart unconfigured (yet) daemons
authorSébastien Han <seb@redhat.com>
Thu, 7 Sep 2017 21:33:45 +0000 (23:33 +0200)
committerSébastien Han <seb@redhat.com>
Fri, 8 Sep 2017 10:02:37 +0000 (12:02 +0200)
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 <seb@redhat.com>
roles/ceph-defaults/handlers/main.yml
roles/ceph-defaults/tasks/check_socket.yml

index 8f21db762aae6fd39c743a118e0d3328f57161dd..91a533b65d0c01ab9473fd7256248f1151bc8302 100644 (file)
@@ -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
     - 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
   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
index 93f0db278c6cb6cc9326154c717b90ced91f5767..ddfffeca8b8faebd6c71be20798511dea2a22bd8 100644 (file)
@@ -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: |