]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-osd: exit gracefully when no data partition
authorDimitri Savineau <dsavinea@redhat.com>
Fri, 26 Jun 2020 17:49:17 +0000 (13:49 -0400)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 7 Jul 2020 16:18:14 +0000 (18:18 +0200)
When using collocated or non-collocated osd_scenarios (ceph-disk) and
trying to deterime the OSD_DEVICE from the OSD_ID passed to the systemd
unit then we can be in a situation where the OSD hasn't been activated
but the OSD ID exists.
This means the data partition isn't in activate state and the ceph-disk
list command won't show the OSD ID on the data partition.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1850377
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
roles/ceph-osd/templates/ceph-osd-run.sh.j2

index 77325926387edf297075c08d03557a273760296b..675f221be78d9969d5d478782a62abbb50394920 100644 (file)
@@ -17,6 +17,10 @@ function id_to_device () {
  {{ container_binary }} run --rm --net=host --ulimit nofile=1024:4096 --ipc=host --pid=host --privileged=true -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /dev:/dev -v /etc/localtime:/etc/localtime:ro -e DEBUG=verbose -e CLUSTER={{ cluster }} {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} osd_ceph_disk_dmcrypt_data_map
 {% endif %}
   DATA_PART=$(docker run --rm --ulimit nofile=1024:4096 --privileged=true -v /dev/:/dev/ -v /etc/ceph:/etc/ceph:z --entrypoint ceph-disk {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} list | grep ", osd\.${1}," | awk '{ print $1 }')
+  if [ -z "${DATA_PART}" ]; then
+    echo "No data partition found for OSD ${i}"
+    exit 1
+  fi
   if [[ "${DATA_PART}" =~ ^/dev/(cciss|nvme|loop) ]]; then
     OSD_DEVICE=${DATA_PART:0:-2}
   else