Merge "Fix multiple mon deployment failures"

This commit is contained in:
Zuul 2019-05-22 11:22:30 +00:00 committed by Gerrit Code Review
commit 14f7501441
1 changed files with 11 additions and 1 deletions

View File

@ -39,6 +39,16 @@ if [[ ! -e "${MON_DIR}/keyring" ]]; then
ceph-authtool --create-keyring "${KEYRING_TMP}" --import-keyring "${KEYRING_ADMIN}"
ceph-authtool "${KEYRING_TMP}" --import-keyring "${KEYRING_MON}"
mkdir -p "${MON_DIR}"
ceph-mon --mkfs -i "${HOSTNAME}" --monmap "${MONMAP}" --keyring "${KEYRING_TMP}"
mon_stat=$(ceph mon stat --connect-timeout 1 || true)
mon_check=$(echo $mon_stat | awk '/mons/{print $0}' | wc -l)
if [[ ${mon_check} -eq 0 ]]; then
ceph-mon --mkfs -i "${HOSTNAME}" --keyring "${KEYRING_TMP}"
else
MONMAP_TMP="/tmp/ceph.${HOSTNAME}.monmap"
ceph mon getmap -o "${MONMAP_TMP}"
ceph-mon --mkfs -i "${HOSTNAME}" --monmap "${MONMAP_TMP}" --keyring "${KEYRING_TMP}"
rm "${MONMAP_TMP}"
fi
rm "${KEYRING_TMP}"
fi