Clean up CEPH_DATA_DIR when unstacking

When working locally it is nice to be able to
run unstack.sh and not have too much extra stuff
to clean up by hand before running stack.sh again.

So clean up CEPH_DATA_DIR, contenta and mounts.

Also fix a spot where '/var/lib/ceph' (the default
value for CEPH_DATA_DIR) was hard-coded.

Change-Id: I43ff06ca38f42ea4305b2c862902bf6f612e32f0
This commit is contained in:
Tom Barron 2020-12-07 19:49:16 +00:00
parent 8521f4a0c8
commit 631414af25
1 changed files with 11 additions and 1 deletions

View File

@ -496,7 +496,7 @@ function configure_ceph {
sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create mds.${MDS_ID} \
mon 'allow profile mds ' osd 'allow rw' mds 'allow' \
-o ${CEPH_DATA_DIR}/mds/ceph-${MDS_ID}/keyring
sudo chown ceph. /var/lib/ceph/mds/ceph-${MDS_ID}/keyring
sudo chown ceph. ${CEPH_DATA_DIR}/mds/ceph-${MDS_ID}/keyring
sudo systemctl enable ceph-mds@${MDS_ID}
fi
@ -1187,6 +1187,16 @@ function stop_ceph {
# NOTE(vkmc) Cleanup any leftover unit files
sudo rm -f /etc/systemd/system/ceph*
# Clean up CEPH_DATA_DIR
sudo umount ${CEPH_DATA_DIR}
# devstack create_disk function adds an entry in /etc/fstab
# that doesn't always get cleaned up on restacks so clean it
# up here. Use a pattern that escapes the '/' path delimiters
# in the expresssion given to the sed command.
pattern=$(echo $CEPH_DATA_DIR | sed 's_/_\\/_g')
sudo sed -i "/$pattern/d" /etc/fstab
sudo rm -rf ${CEPH_DATA_DIR}/*
}
# Restore xtrace