]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
osd: bring backward compatibility with old Jewel images 2106/head
authorSébastien Han <seb@redhat.com>
Fri, 20 Oct 2017 13:15:38 +0000 (15:15 +0200)
committerSébastien Han <seb@redhat.com>
Wed, 25 Oct 2017 15:34:17 +0000 (17:34 +0200)
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>
(cherry picked from commit 968ef04324e9064fcecfe88bc5464ad9c2673a13)
Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-osd/tasks/docker/start_docker_osd.yml
roles/ceph-osd/templates/ceph-osd-run.sh.j2

index fce8a7fbccd11809ce247f7104e79d93c71aa1b3..c038e91648667b09d32715d118edbbbaa9254d20 100644 (file)
   when:
     - 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
   become: true
   template:
index bd854ae0a87221a340e7e76405506aca24926136..bd2f5efea171a34c272c757837680475adf75bb8 100644 (file)
@@ -5,12 +5,23 @@
 #############
 # FUNCTIONS #
 #############
-
-
+{% 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 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"