mirror of https://github.com/ceph/ceph-ansible.git
osd: bring backward compatibility with old Jewel images
There was a huge resync from luminous to jewel in ceph-docker: https://github.com/ceph/ceph-docker/pull/797 This change brought a new handy function to discover partitions tight to an OSD. This function doesn't exist in the old image so the ceph-osd-run.sh script breaks when trying to deploy Jewel OSD with that old Jewel image version. Signed-off-by: Sébastien Han <seb@redhat.com>pull/2084/head
parent
8016d5d1a5
commit
968ef04324
|
@ -10,6 +10,14 @@
|
||||||
when:
|
when:
|
||||||
- ceph_docker_on_openstack
|
- 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
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
register: disk_list
|
||||||
|
when:
|
||||||
|
- ceph_release_num[ceph_release] < ceph_release_num.kraken
|
||||||
|
|
||||||
- name: generate ceph osd docker run script
|
- name: generate ceph osd docker run script
|
||||||
become: true
|
become: true
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -5,12 +5,23 @@
|
||||||
#############
|
#############
|
||||||
# FUNCTIONS #
|
# FUNCTIONS #
|
||||||
#############
|
#############
|
||||||
|
{% if disk_list.get("rc", 1) == 0 -%}
|
||||||
|
|
||||||
function expose_partitions () {
|
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 --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}
|
docker rm -f expose_partitions_${1}
|
||||||
}
|
}
|
||||||
|
{% else -%}
|
||||||
|
# NOTE(leseb): maintains backwards compatibility with old ceph-docker Jewel images
|
||||||
|
# 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)
|
||||||
|
DOCKER_ENV="$DOCKER_ENV -e OSD_JOURNAL=$part"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
{% endif -%}
|
||||||
|
|
||||||
expose_partitions "$1"
|
expose_partitions "$1"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue