summaryrefslogtreecommitdiff
path: root/docker/ceph
diff options
context:
space:
mode:
authorwangwei <wangwei@navercorp.com>2019-04-15 18:36:40 +0900
committerwangwei <wang.wei@navercorp.com>2019-05-23 01:19:02 +0000
commit877df152ddc6dcf83e5a92964a275de2dfc1444b (patch)
tree67481ced6718faabfb593f87f84e05b1a0898510 /docker/ceph
parent728d49e14068a6977c6e6cb601278dcf69b2e9ff (diff)
downloadkolla-877df152ddc6dcf83e5a92964a275de2dfc1444b.tar.gz
kolla-877df152ddc6dcf83e5a92964a275de2dfc1444b.zip
Fix multiple mon deployment failures
When 4 or 5 mons are deployed, all mons will always be in the election state, and the ceph cluster cannot be accessed. After comparing with ceph-deploy, I found that when the cluster was initialized, it did not use monmap. When adding a new mon node, it needs to use monmap. According to the above situation, I fixed the problem. Change-Id: Idbfc6741d371adcb06ed97d578d75d3bce862743 Closes-bug: #1824783 (cherry picked from commit 285814353af29395932e15d78c6a154796978a21)
Diffstat (limited to 'docker/ceph')
-rw-r--r--docker/ceph/ceph-mon/extend_start.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/docker/ceph/ceph-mon/extend_start.sh b/docker/ceph/ceph-mon/extend_start.sh
index 8ec53e8b7..4c3e91b31 100644
--- a/docker/ceph/ceph-mon/extend_start.sh
+++ b/docker/ceph/ceph-mon/extend_start.sh
@@ -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