scripts/ceph: Always update the admin key config file.

/etc/ceph/ceph.client.admin.keyring is used by
the liborados client, if keyring is udpated, we should
update this file.

If we see:

librados: client.admin authentication error (1) Operation not permitted

Usually, we should set the read privilge for the file.

Change-Id: I34967844a5d0578f740e601def4b0cbd297a95dc
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471947
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ziye Yang 2019-10-22 13:18:40 +08:00 committed by Jim Harris
parent 2176f081dd
commit 7d60b02c8d

View File

@ -66,6 +66,7 @@ echo -e "\tmon addr = ${mon_ip}:12046" >> "$ceph_conf"
rm -rf ${mon_dir}/*
mkdir -p ${mon_dir}
mkdir -p ${pid_dir}
rm -f /etc/ceph/ceph.client.admin.keyring
ceph-authtool --create-keyring --gen-key --name=mon. ${base_dir}/keyring --cap mon 'allow *'
ceph-authtool --gen-key --name=client.admin --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *' --cap mgr 'allow *' ${base_dir}/keyring
@ -79,6 +80,8 @@ cp ${base_dir}/keyring ${mon_dir}/keyring
cp $ceph_conf /etc/ceph/ceph.conf
cp ${base_dir}/keyring /etc/ceph/keyring
cp ${base_dir}/keyring /etc/ceph/ceph.client.admin.keyring
chmod a+r /etc/ceph/ceph.client.admin.keyring
ceph-run sh -c "ulimit -n 16384 && ulimit -c unlimited && exec ceph-mon -c ${ceph_conf} -i a --keyring=${base_dir}/keyring --pid-file=${base_dir}/pid/root@$(hostname).pid --mon-data=${mon_dir}" || true