scripts/ceph: move all temp files to /var/tmp/ceph

The current test scripts created a lot of data inside the SPDK repo;
move this to /var/tmp/ceph (where the image is already created) to avoid
polluting the repo working copy.

Change-Id: If895baecfa7fef80733f0d629f091a479a634a52
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/401647
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Daniel Verkamp 2018-02-27 09:51:48 -07:00 committed by Jim Harris
parent f370026edc
commit ad14da9eab
2 changed files with 18 additions and 21 deletions

View File

@ -4,20 +4,22 @@
set -x
set -e
script_dir=$(readlink -f $(dirname $0))
fsid=`uuidgen`
base_dir=`pwd`
base_dir=/var/tmp/ceph
mon_ip=127.0.0.1
mon_dir=${base_dir}/ceph/mon.a/
pid_dir=${base_dir}/ceph/pid
mon_dir=${base_dir}/mon.a/
pid_dir=${base_dir}/pid
ceph_conf=${base_dir}/ceph.conf
ceph_conf_temp=${base_dir}/ceph.conf.tmp
mnt_dir=${base_dir}/ceph/mnt
mnt_dir=${base_dir}/mnt
dev_backend=/dev/ceph
image=/var/tmp/ceph_raw.img
dev=/dev/loop200
# partition osd
cp $ceph_conf $ceph_conf_temp
mkdir ${base_dir}
cp ${script_dir}/ceph.conf $ceph_conf
if [ ! -e $image ]; then
fallocate -l 10G $image
@ -57,20 +59,20 @@ rm -rf ${mon_dir}/*
mkdir -p ${mon_dir}
mkdir -p ${pid_dir}
ceph-authtool --create-keyring --gen-key --name=mon. ${base_dir}/ceph/keyring --cap mon 'allow *'
ceph-authtool --gen-key --name=client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *' --cap mgr 'allow *' ${base_dir}/ceph/keyring
ceph-authtool --create-keyring --gen-key --name=mon. ${base_dir}/keyring --cap mon 'allow *'
ceph-authtool --gen-key --name=client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *' --cap mgr 'allow *' ${base_dir}/keyring
monmaptool --create --clobber --add a ${mon_ip}:12046 --print ${base_dir}/ceph/monmap
monmaptool --create --clobber --add a ${mon_ip}:12046 --print ${base_dir}/monmap
sh -c "ulimit -c unlimited && exec ceph-mon --mkfs -c ${ceph_conf} -i a --monmap=${base_dir}/ceph/monmap --keyring=${base_dir}/ceph/keyring --mon-data=${mon_dir}"
sh -c "ulimit -c unlimited && exec ceph-mon --mkfs -c ${ceph_conf} -i a --monmap=${base_dir}/monmap --keyring=${base_dir}/keyring --mon-data=${mon_dir}"
cp ${base_dir}/ceph/keyring ${mon_dir}/keyring
cp ${base_dir}/keyring ${mon_dir}/keyring
cp $ceph_conf /etc/ceph/ceph.conf
cp ${base_dir}/ceph/keyring /etc/ceph/keyring
cp ${base_dir}/keyring /etc/ceph/keyring
ceph-run sh -c "ulimit -n 16384 && ulimit -c unlimited && exec ceph-mon -c ${ceph_conf} -i a --keyring=${base_dir}/ceph/keyring --pid-file=${base_dir}/ceph/pid/root@`hostname`.pid --mon-data=${mon_dir}" || true
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
# create osd
@ -90,6 +92,3 @@ sleep 2
mkdir -p ${pid_dir}
env -i TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES=134217728 ceph-osd -c ${ceph_conf} -i 0 --pid-file=${pid_dir}/ceph-osd.0.pid
rm -f $ceph_conf
mv $ceph_conf_temp $ceph_conf

View File

@ -2,14 +2,12 @@
set -x
base_dir=`pwd`
home_folder=${base_dir}/ceph
image=/var/tmp/ceph_raw.img
base_dir=/var/tmp/ceph
image=${base_dir}/ceph_raw.img
dev_backend=/dev/ceph
pkill -9 ceph
sleep 3
umount /dev/loop200p2
losetup -d $dev_backend
rm -rf $home_folder
rm $image
rm -rf $base_dir