]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
osd: fix container reboot 1933/head
authorSébastien Han <seb@redhat.com>
Thu, 21 Sep 2017 13:02:16 +0000 (15:02 +0200)
committerSébastien Han <seb@redhat.com>
Mon, 25 Sep 2017 11:34:47 +0000 (13:34 +0200)
It's sad but we can not rely on the prepare container anymore since the
log are flushed after reboot. So inpecting the container does not return
anything.
Now, instead we use a ephemeral container to look up for the
journal/block.db/block.wal (depending if filestore or bluestore) and
build the activate command accordingly.

Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-osd/templates/ceph-osd-run.sh.j2

index acc852ff387c0b65d1a800bf2324306d6fb6d7c4..8bcd3e9f8cf5ff4cb1c9700744d48c813cd397e0 100644 (file)
@@ -2,47 +2,17 @@
 # {{ ansible_managed }}
 
 
-#############
-# VARIABLES #
-#############
-
-REGEX="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
-
-
 #############
 # FUNCTIONS #
 #############
 
 
-function expose_devices {
-  local disks
-  # we use the prepare container to find the partitions to expose
-  disks=$(docker logs ceph-osd-prepare-{{ ansible_hostname }}-devdev${1} |& grep -Eo /dev/disk/by-partuuid/${REGEX} | uniq)
-  for disk in $disks; do
-    DEVICES="--device=$disk "
-  done
-}
-
-function expose_partitions {
-  local partition
-  for partition in Block.wal Block.db Journal; do
-    if docker logs ceph-osd-prepare-{{ ansible_hostname }}-devdev${1} |& grep -Eo "$partition is GPT partition"; then
-      if [[ "$partition" == "Block.wal" ]]; 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_BLUESTORE_BLOCK_WAL=$part"
-      elif [[ "$partition" == "Block.db" ]]; 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_BLUESTORE_BLOCK_DB=$part"
-      elif [[ "$partition" == "Journal" ]]; 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
-    fi
-  done
+function expose_partitions () {
+  DOCKER_ENV=$(docker run --name expose_partitions_${1} --privileged=true -v /dev/:/dev/ -v /etc/ceph:/etc/ceph -e OSD_DEVICE=/dev/${1} {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} disk_list)
+  docker rm -f expose_partitions_${1}
 }
 
-#expose_devices $1
-expose_partitions $1
+expose_partitions "$1"
 
 
 ########