Add ceph wait before bootstrap

This will make sure ceph has a quorum and the cluster is functional
before attempting to use it. We also make sure udev has time to create
its links by looping a few times. This resolves the races found in the
bootstrap process

TrivialFix

Change-Id: Ia4624916feb5c80b2a067e5a62c176c1a5dea460
This commit is contained in:
SamYaple 2016-03-09 04:15:15 +00:00 committed by Sam Yaple
parent 1f3e75feb1
commit 3b65e49930
1 changed files with 14 additions and 2 deletions

View File

@ -3,6 +3,9 @@
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
# Wait for ceph quorum before proceeding
ceph quorum_status
# Formatting disk for ceph
sgdisk --zap-all -- "${OSD_DEV}"
sgdisk --new=2:1M:5G --change-name=2:KOLLA_CEPH_JOURNAL --typecode=2:45B0969E-9B03-4F30-B4C6-B4B80CEFF106 --mbrtogpt -- "${OSD_DEV}"
@ -10,8 +13,17 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
# This command may throw errors that we can safely ignore
partprobe || true
# We look up the appropriate device path with partition.
OSD_PARTITION=$(ls "${OSD_DEV}"* | egrep "${OSD_DEV}p?1")
count=0
while [[ "${OSD_PARTITION}x" == "x" ]]; do
if [[ "${count}" -gt 5 ]]; then
echo "Could not find OSD Partition"
exit 1
fi
sleep 1
# We look up the appropriate device path with partition.
OSD_PARTITION=$(ls "${OSD_DEV}"* | egrep "${OSD_DEV}p?1")
count=$(( count + 1 ))
done
JOURNAL_PARTITION="${OSD_PARTITION%?}2"
OSD_ID=$(ceph osd create)