mirror of
https://github.com/ceph/ceph
synced 2024-12-16 16:39:21 +00:00
mkcephfs: error out if mon data directory is not empty
The ceph-mon --mkfs function no longer wipes out the directory; it is in fact mostly a no-op that just verifies the dir exists. So, ensure that the directory is empty at mkfs time. This could alternatively do an 'rm -r' in that directory (that is in fact what ceph-mon used to do), but this is safer. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
6b1835a92c
commit
4e66a3b98d
@ -266,6 +266,12 @@ if [ -n "$initdaemon" ]; then
|
||||
fi
|
||||
|
||||
if [ $type = "mon" ]; then
|
||||
get_conf mon_data "/var/run/ceph/mon/ceph-$id" "mon data"
|
||||
if [ `ls $mon_data | wc -l` -ne 0 ]; then
|
||||
echo "ERROR: $name mon_data directory $mon_data is not empty."
|
||||
echo " Please make sure that it is empty before running mkcephfs."
|
||||
exit 1
|
||||
fi
|
||||
$BINDIR/ceph-mon -c $conf --mkfs -i $id --monmap $dir/monmap --osdmap $dir/osdmap -k $dir/keyring.mon
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user