From: Guillaume Abrioux Date: Thu, 8 Feb 2018 12:27:45 +0000 (+0100) Subject: osd: fix osd restart when dmcrypt X-Git-Tag: v3.0.25~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bbf8caaaf1dcf4e430ca11fc75f57b4f88804e18;p=ceph-ansible.git osd: fix osd restart when dmcrypt This commit fixes a bug that occurs especially for dmcrypt scenarios. There is an issue where the 'disk_list' container can't reach the ceph cluster because it's not launched with `--net=host`. If this container can't reach the cluster, it will hang on this step (when trying to retrieve the dm-crypt key) : ``` +common_functions.sh:448: open_encrypted_part(): ceph --cluster abc12 --name \ client.osd-lockbox.9138767f-7445-49e0-baad-35e19adca8bb --keyring \ /var/lib/ceph/osd-lockbox/9138767f-7445-49e0-baad-35e19adca8bb/keyring \ config-key get dm-crypt/osd/9138767f-7445-49e0-baad-35e19adca8bb/luks +common_functions.sh:452: open_encrypted_part(): base64 -d +common_functions.sh:452: open_encrypted_part(): cryptsetup --key-file \ -luksOpen /dev/sdb1 9138767f-7445-49e0-baad-35e19adca8bb ``` It means the `ceph-run-osd.sh` script won't be able to start the `osd_disk_activate` process in ceph-container because he won't have filled the `$DOCKER_ENV` environment variable properly. Adding `--net=host` to the 'disk_list' container fixes this issue. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1543284 Signed-off-by: Guillaume Abrioux (cherry picked from commit e537779bb3cf73c569ce6c29ab8b20169cc5ffae) Signed-off-by: Sébastien Han --- diff --git a/roles/ceph-osd/templates/ceph-osd-run.sh.j2 b/roles/ceph-osd/templates/ceph-osd-run.sh.j2 index 7778896eb..0a7482294 100644 --- a/roles/ceph-osd/templates/ceph-osd-run.sh.j2 +++ b/roles/ceph-osd/templates/ceph-osd-run.sh.j2 @@ -8,7 +8,7 @@ DOCKER_ENV="" ############# {% if disk_list.get('rc') == 0 -%} function expose_partitions () { -DOCKER_ENV=$(docker run --rm --name expose_partitions_${1} --privileged=true -v /dev/:/dev/ -v /etc/ceph:/etc/ceph -e CLUSTER={{ cluster }} -e OSD_DEVICE=/dev/${1} {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} disk_list) +DOCKER_ENV=$(docker run --rm --net=host --name expose_partitions_${1} --privileged=true -v /dev/:/dev/ -v /etc/ceph:/etc/ceph -e CLUSTER={{ cluster }} -e OSD_DEVICE=/dev/${1} {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} disk_list) docker rm -f expose_partitions_${1} } {% else -%}