From 3b65e4993076d7000c57b55aaa26cc11173c2238 Mon Sep 17 00:00:00 2001 From: SamYaple Date: Wed, 9 Mar 2016 04:15:15 +0000 Subject: [PATCH] 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 --- docker/ceph/ceph-osd/extend_start.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docker/ceph/ceph-osd/extend_start.sh b/docker/ceph/ceph-osd/extend_start.sh index 94736c8a89..202aad1861 100644 --- a/docker/ceph/ceph-osd/extend_start.sh +++ b/docker/ceph/ceph-osd/extend_start.sh @@ -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)