mirror of https://github.com/ceph/ceph-ansible.git
osd: enhance backward compatibility
During the initial implementation of this 'old' thing we were falling into this issue without noticing https://github.com/moby/moby/issues/30341 and where blindly using --rm, now this is fixed the prepare container disappears and thus activation fail. I'm fixing this for old jewel images. Also this fixes the machine reboot case where the docker logs are purgend. In the old scenario, we now store the log locally in the same directory as the ceph-osd-run.sh script. Signed-off-by: Sébastien Han <seb@redhat.com>pull/2128/head
parent
ab7eb79212
commit
d4ed9a2064
|
@ -6,7 +6,7 @@
|
|||
|
||||
- name: set docker_exec_client_cmd for containers
|
||||
set_fact:
|
||||
docker_exec_client_cmd: docker run -v /etc/ceph:/etc/ceph --entrypoint /usr/bin/{{ docker_exec_client_cmd_binary }} {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
|
||||
docker_exec_client_cmd: docker run --rm -v /etc/ceph:/etc/ceph --entrypoint /usr/bin/{{ docker_exec_client_cmd_binary }} {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
|
||||
when: containerized_deployment
|
||||
|
||||
- name: set docker_exec_client_cmd for non-containers
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
- fetch_container_image
|
||||
|
||||
- name: get ceph version
|
||||
command: docker run --entrypoint /usr/bin/ceph {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --version
|
||||
command: docker run --rm --entrypoint /usr/bin/ceph {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --version
|
||||
changed_when: false
|
||||
check_mode: no
|
||||
register: ceph_version
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
- ceph_docker_on_openstack
|
||||
|
||||
- name: test if the container image has the disk_list function
|
||||
command: docker run --entrypoint=stat {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} disk_list.sh
|
||||
command: docker run --rm --entrypoint=stat {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} disk_list.sh
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: disk_list
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
- name: prepare ceph containerized osd disk collocated
|
||||
shell: |
|
||||
docker run --net=host \
|
||||
--rm \
|
||||
--pid=host \
|
||||
--privileged=true \
|
||||
--name=ceph-osd-prepare-{{ ansible_hostname }}-{{ item.1 | regex_replace('/dev/', '') }} \
|
||||
|
@ -32,7 +31,6 @@
|
|||
- name: automatic prepare ceph containerized osd disk collocated
|
||||
shell: |
|
||||
docker run --net=host \
|
||||
--rm \
|
||||
--pid=host \
|
||||
--privileged=true \
|
||||
--name=ceph-osd-prepare-{{ ansible_hostname }}-{{ item.key }} \
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
- name: prepare ceph "{{ osd_objectstore }}" containerized osd disk(s) non-collocated
|
||||
shell: |
|
||||
docker run --net=host \
|
||||
--rm \
|
||||
--pid=host \
|
||||
--privileged=true \
|
||||
--name=ceph-osd-prepare-{{ ansible_hostname }}-{{ item.1 | regex_replace('/dev/', '') }} \
|
||||
|
@ -34,7 +33,6 @@
|
|||
- name: prepare ceph "{{ osd_objectstore }}" containerized osd disk(s) non-collocated with a dedicated device for db and wal
|
||||
shell: |
|
||||
docker run --net=host \
|
||||
--rm \
|
||||
--pid=host \
|
||||
--privileged=true \
|
||||
--name=ceph-osd-prepare-{{ ansible_hostname }}-{{ item.1 | regex_replace('/dev/', '') }} \
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#############
|
||||
{% if disk_list.get("rc", 1) == 0 -%}
|
||||
function expose_partitions () {
|
||||
DOCKER_ENV=$(docker run --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 --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 -%}
|
||||
|
@ -15,9 +15,22 @@ DOCKER_ENV=$(docker run --name expose_partitions_${1} --privileged=true -v /dev/
|
|||
# Jewel images prior to https://github.com/ceph/ceph-docker/pull/797
|
||||
REGEX="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
|
||||
function expose_partitions {
|
||||
local partition
|
||||
if docker logs ceph-osd-prepare-{{ ansible_hostname }}-devdev${1} |& grep -Eo "$partition is GPT partition"; then
|
||||
part=$(docker logs ceph-osd-prepare-{{ ansible_hostname }}-devdev${1} |& grep "$partition is GPT partition" | grep -Eo /dev/disk/by-partuuid/${REGEX} | uniq)
|
||||
if docker ps -a | grep -sq ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}; then
|
||||
if [[ ! -f {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}.log ]]; then
|
||||
docker logs ceph-osd-prepare-{{ ansible_hostname }}-devdev${1} &> {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}.log
|
||||
fi
|
||||
fi
|
||||
if docker ps -a | grep -sq ceph-osd-prepare-{{ ansible_hostname }}-${1}; then
|
||||
if [[ ! -f {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-${1}.log ]]; then
|
||||
docker logs ceph-osd-prepare-{{ ansible_hostname }}-${1} &> {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-${1}.log
|
||||
fi
|
||||
fi
|
||||
if [[ -f {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}.log ]]; then
|
||||
part=$(grep "Journal is GPT partition" {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}.log | grep -Eo /dev/disk/by-partuuid/${REGEX} | uniq)
|
||||
DOCKER_ENV="$DOCKER_ENV -e OSD_JOURNAL=$part"
|
||||
fi
|
||||
if [[ -f {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-${1}.log ]]; then
|
||||
part=$(grep "Journal is GPT partition" {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-${1}.log | grep -Eo /dev/disk/by-partuuid/${REGEX} | uniq)
|
||||
DOCKER_ENV="$DOCKER_ENV -e OSD_JOURNAL=$part"
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue