Merge pull request #1531 from ceph/wip-1495

docker: Retry OSD disk prepare to workaround race condition
pull/1546/head
Andrew Schoen 2017-05-17 09:36:07 -05:00 committed by GitHub
commit 58618aa778
1 changed files with 16 additions and 2 deletions

View File

@ -21,10 +21,12 @@
# starting the next task # starting the next task
- name: prepare ceph osd disk - name: prepare ceph osd disk
shell: | shell: |
NAME="ceph-osd-prepare-{{ ansible_hostname }}-dev{{ item.0 | regex_replace('/', '') }}"
docker ps -a | grep -sq $NAME && docker rm $NAME || true
docker run --net=host \ docker run --net=host \
--pid=host \ --pid=host \
--privileged=true \ --privileged=true \
--name="ceph-osd-prepare-{{ ansible_hostname }}-dev{{ item.0 | regex_replace('/', '') }}" \ --name=$NAME \
-v /etc/ceph:/etc/ceph \ -v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \ -v /var/lib/ceph/:/var/lib/ceph/ \
-v /dev:/dev \ -v /dev:/dev \
@ -41,13 +43,20 @@
- item.1.get("rc", 0) != 0 - item.1.get("rc", 0) != 0
- ceph_osd_docker_prepare_env is defined - ceph_osd_docker_prepare_env is defined
- not osd_containerized_deployment_with_kv - not osd_containerized_deployment_with_kv
# https://github.com/ceph/ceph-ansible/issues/1495
register: prepare_osd_disk
until: prepare_osd_disk.rc == 0
retries: 5
delay: 3
- name: prepare ceph osd disk with kv_store - name: prepare ceph osd disk with kv_store
shell: | shell: |
NAME="ceph-osd-prepare-{{ ansible_hostname }}-dev-{{ item.0 | regex_replace('/', '') }}"
docker ps -a | grep -sq $NAME && docker rm $NAME || true
docker run --net=host \ docker run --net=host \
--pid=host \ --pid=host \
--privileged=true \ --privileged=true \
--name="ceph-osd-prepare-{{ ansible_hostname }}-dev-{{ item.0 | regex_replace('/', '') }}" \ --name=$NAME \
-v /dev:/dev \ -v /dev:/dev \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-e "OSD_DEVICE={{ item.0 }}" \ -e "OSD_DEVICE={{ item.0 }}" \
@ -66,6 +75,11 @@
- item.1.get("rc", 0) != 0 - item.1.get("rc", 0) != 0
- ceph_osd_docker_prepare_env is defined - ceph_osd_docker_prepare_env is defined
- osd_containerized_deployment_with_kv - osd_containerized_deployment_with_kv
# https://github.com/ceph/ceph-ansible/issues/1495
register: prepare_osd_disk_kv
until: prepare_osd_disk_kv.rc == 0
retries: 5
delay: 3
- name: generate ceph osd docker run script - name: generate ceph osd docker run script
become: true become: true