From 9f54b3b4a7c1a7015def3a7987e3e9e426385251 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 10 Jul 2018 11:56:17 +0200 Subject: [PATCH] mon: ensure socker is purged when mon is stopped On containerized deployment, if a mon is stopped, the socket is not purged and can cause failure when a cluster is redeployed after the purge playbook has been run. Typical error: ``` fatal: [osd0]: FAILED! => {} MSG: 'dict object' has no attribute 'osd_pool_default_pg_num' ``` the fact is not set because of this previous failure earlier: ``` ok: [mon0] => { "changed": false, "cmd": "docker exec ceph-mon-mon0 ceph --cluster test daemon mon.mon0 config get osd_pool_default_pg_num", "delta": "0:00:00.217382", "end": "2018-07-09 22:25:53.155969", "failed_when_result": false, "rc": 22, "start": "2018-07-09 22:25:52.938587" } STDERR: admin_socket: exception getting command descriptions: [Errno 111] Connection refused MSG: non-zero return code ``` This failure happens when the ceph-mon service is stopped, indeed, since the socket isn't purged, it's a leftover which is confusing the process. Signed-off-by: Guillaume Abrioux --- roles/ceph-mon/templates/ceph-mon.service.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index b6ebf0ba1..157ab7ca0 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.j2 @@ -63,7 +63,8 @@ ExecStart=/usr/bin/docker run --rm --name ceph-mon-%i \ -e CEPH_DAEMON=MON \ {{ ceph_mon_docker_extra_env }} \ {{ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} -ExecStopPost=-/usr/bin/docker stop ceph-mon-%i +ExecStop=-/usr/bin/docker stop ceph-mon-%i +ExecStopPost=-/bin/rm -f /var/run/ceph/{{ cluster }}-mon.{{ monitor_name }}.asok Restart=always RestartSec=10s TimeoutStartSec=120