Ceph: don't overwrite mon map

When monmap is persisted, don't overwrite it when mon pod restarts.
This helps when there is just one mon or all mons reboot

Change-Id: I9119379f4bc026c315a2fa7507a1664b12ea6205
Signed-off-by: Huamin Chen <hchen@redhat.com>
This commit is contained in:
Huamin Chen 2017-10-03 15:27:04 -04:00
parent 2ca580a9b4
commit dddfa6651f
2 changed files with 11 additions and 1 deletions

View File

@ -37,6 +37,15 @@ function get_mon_config {
exit 1 exit 1
fi fi
# if monmap exists and the mon is already there, don't overwrite monmap
if [ -f "${MONMAP}" ]; then
monmaptool --print "${MONMAP}" |grep -q "${MON_IP// }"":6789"
if [ $? -eq 0 ]; then
log "${MON_IP} already exists in monmap ${MONMAP}"
return
fi
fi
# Create a monmap with the Pod Names and IP # Create a monmap with the Pod Names and IP
monmaptool --create ${MONMAP_ADD} --fsid ${fsid} $MONMAP --clobber monmaptool --create ${MONMAP_ADD} --fsid ${fsid} $MONMAP --clobber
} }

View File

@ -156,7 +156,8 @@ spec:
name: ceph-etc name: ceph-etc
defaultMode: 0444 defaultMode: 0444
- name: pod-var-lib-ceph - name: pod-var-lib-ceph
emptyDir: {} hostPath:
path: {{ .Values.ceph.storage.mon_directory }}
- name: pod-run - name: pod-run
emptyDir: emptyDir:
medium: "Memory" medium: "Memory"