mirror of https://github.com/ceph/ceph-ansible.git
ceph-osd: exit gracefully when no data partition
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>pull/5524/head
parent
90f3f61548
commit
4e3301d361
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue