Fix racy conditions with Ceph caps updating
The sed commands are replaced with simpler methods of extracting the cephx cap keys. Change-Id: I783c360569bf17b16d128544b5ab11cb1ce9a7ed
This commit is contained in:
parent
76fb1fb10a
commit
621d3938db
@ -42,8 +42,7 @@ if USERINFO=$(ceph auth get client.${RBD_POOL_USER}); then
|
|||||||
mon "profile r" \
|
mon "profile r" \
|
||||||
osd "profile rwx pool=${RBD_POOL_NAME}" \
|
osd "profile rwx pool=${RBD_POOL_NAME}" \
|
||||||
mgr "allow r"
|
mgr "allow r"
|
||||||
KEYSTR=$(echo $USERINFO | sed 's/.*\( key = .*\) caps mon.*/\1/')
|
ceph auth get client.${RBD_POOL_USER} -o ${KEYRING}
|
||||||
echo $KEYSTR > ${KEYRING}
|
|
||||||
else
|
else
|
||||||
ceph auth get-or-create client.${RBD_POOL_USER} \
|
ceph auth get-or-create client.${RBD_POOL_USER} \
|
||||||
mon "profile r" \
|
mon "profile r" \
|
||||||
|
@ -20,6 +20,12 @@ set -ex
|
|||||||
export HOME=/tmp
|
export HOME=/tmp
|
||||||
|
|
||||||
KEYRING=/etc/ceph/ceph.client.${CEPH_CINDER_USER}.keyring
|
KEYRING=/etc/ceph/ceph.client.${CEPH_CINDER_USER}.keyring
|
||||||
|
{{- if .Values.conf.ceph.cinder.keyring }}
|
||||||
|
cat > ${KEYRING} <<EOF
|
||||||
|
[client.{{ .Values.conf.ceph.cinder.user }}]
|
||||||
|
key = {{ .Values.conf.ceph.cinder.keyring }}
|
||||||
|
EOF
|
||||||
|
{{- else }}
|
||||||
if ! [ "x${CEPH_CINDER_USER}" == "xadmin" ]; then
|
if ! [ "x${CEPH_CINDER_USER}" == "xadmin" ]; then
|
||||||
#
|
#
|
||||||
# If user is not client.admin, check if it already exists. If not create
|
# If user is not client.admin, check if it already exists. If not create
|
||||||
@ -32,8 +38,7 @@ if ! [ "x${CEPH_CINDER_USER}" == "xadmin" ]; then
|
|||||||
ceph auth caps client.${CEPH_CINDER_USER} \
|
ceph auth caps client.${CEPH_CINDER_USER} \
|
||||||
mon "profile rbd" \
|
mon "profile rbd" \
|
||||||
osd "profile rbd"
|
osd "profile rbd"
|
||||||
KEYSTR=$(echo $USERINFO | sed 's/.*\( key = .*\) caps mon.*/\1/')
|
ceph auth get client.${CEPH_CINDER_USER} -o ${KEYRING}
|
||||||
echo $KEYSTR > ${KEYRING}
|
|
||||||
else
|
else
|
||||||
echo "Creating Cephx user client.${CEPH_CINDER_USER}"
|
echo "Creating Cephx user client.${CEPH_CINDER_USER}"
|
||||||
ceph auth get-or-create client.${CEPH_CINDER_USER} \
|
ceph auth get-or-create client.${CEPH_CINDER_USER} \
|
||||||
@ -43,3 +48,4 @@ if ! [ "x${CEPH_CINDER_USER}" == "xadmin" ]; then
|
|||||||
fi
|
fi
|
||||||
rm -f /etc/ceph/ceph.client.admin.keyring
|
rm -f /etc/ceph/ceph.client.admin.keyring
|
||||||
fi
|
fi
|
||||||
|
{{- end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user