mirror of
https://github.com/ceph/ceph
synced 2025-02-22 10:37:15 +00:00
vstart.sh: unify the indent
Change-Id: Ie1dbe25f81609e5b2f6751da9e87e191a2f78bc2 Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
This commit is contained in:
parent
2cdcefbf1c
commit
a80aad81ad
721
src/vstart.sh
721
src/vstart.sh
@ -4,17 +4,17 @@
|
||||
set -e
|
||||
|
||||
if [ -n "$VSTART_DEST" ]; then
|
||||
SRC_PATH=`dirname $0`
|
||||
SRC_PATH=`(cd $SRC_PATH; pwd)`
|
||||
SRC_PATH=`dirname $0`
|
||||
SRC_PATH=`(cd $SRC_PATH; pwd)`
|
||||
|
||||
CEPH_DIR=$SRC_PATH
|
||||
CEPH_BIN=${PWD}/bin
|
||||
CEPH_LIB=${PWD}/lib
|
||||
CEPH_DIR=$SRC_PATH
|
||||
CEPH_BIN=${PWD}/bin
|
||||
CEPH_LIB=${PWD}/lib
|
||||
|
||||
CEPH_CONF_PATH=$VSTART_DEST
|
||||
CEPH_DEV_DIR=$VSTART_DEST/dev
|
||||
CEPH_OUT_DIR=$VSTART_DEST/out
|
||||
CEPH_ASOK_DIR=$VSTART_DEST/out
|
||||
CEPH_CONF_PATH=$VSTART_DEST
|
||||
CEPH_DEV_DIR=$VSTART_DEST/dev
|
||||
CEPH_OUT_DIR=$VSTART_DEST/out
|
||||
CEPH_ASOK_DIR=$VSTART_DEST/out
|
||||
fi
|
||||
|
||||
get_cmake_variable() {
|
||||
@ -24,38 +24,38 @@ get_cmake_variable() {
|
||||
|
||||
# for running out of the CMake build directory
|
||||
if [ -e CMakeCache.txt ]; then
|
||||
# Out of tree build, learn source location from CMakeCache.txt
|
||||
CEPH_ROOT=$(get_cmake_variable ceph_SOURCE_DIR)
|
||||
CEPH_BUILD_DIR=`pwd`
|
||||
[ -z "$MGR_PYTHON_PATH" ] && MGR_PYTHON_PATH=$CEPH_ROOT/src/pybind/mgr
|
||||
CEPH_MGR_PY_VERSION_MAJOR=$(get_cmake_variable MGR_PYTHON_VERSION | cut -d '.' -f 1)
|
||||
if [ -n "$CEPH_MGR_PY_VERSION_MAJOR" ]; then
|
||||
CEPH_PY_VERSION_MAJOR=${CEPH_MGR_PY_VERSION_MAJOR}
|
||||
else
|
||||
if [ $(get_cmake_variable WITH_PYTHON2) = ON ]; then
|
||||
CEPH_PY_VERSION_MAJOR=2
|
||||
else
|
||||
CEPH_PY_VERSION_MAJOR=3
|
||||
fi
|
||||
fi
|
||||
# Out of tree build, learn source location from CMakeCache.txt
|
||||
CEPH_ROOT=$(get_cmake_variable ceph_SOURCE_DIR)
|
||||
CEPH_BUILD_DIR=`pwd`
|
||||
[ -z "$MGR_PYTHON_PATH" ] && MGR_PYTHON_PATH=$CEPH_ROOT/src/pybind/mgr
|
||||
CEPH_MGR_PY_VERSION_MAJOR=$(get_cmake_variable MGR_PYTHON_VERSION | cut -d '.' -f 1)
|
||||
if [ -n "$CEPH_MGR_PY_VERSION_MAJOR" ]; then
|
||||
CEPH_PY_VERSION_MAJOR=${CEPH_MGR_PY_VERSION_MAJOR}
|
||||
else
|
||||
if [ $(get_cmake_variable WITH_PYTHON2) = ON ]; then
|
||||
CEPH_PY_VERSION_MAJOR=2
|
||||
else
|
||||
CEPH_PY_VERSION_MAJOR=3
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# use CEPH_BUILD_ROOT to vstart from a 'make install'
|
||||
if [ -n "$CEPH_BUILD_ROOT" ]; then
|
||||
[ -z "$CEPH_BIN" ] && CEPH_BIN=$CEPH_BUILD_ROOT/bin
|
||||
[ -z "$CEPH_LIB" ] && CEPH_LIB=$CEPH_BUILD_ROOT/lib
|
||||
[ -z "$EC_PATH" ] && EC_PATH=$CEPH_LIB/erasure-code
|
||||
[ -z "$OBJCLASS_PATH" ] && OBJCLASS_PATH=$CEPH_LIB/rados-classes
|
||||
# make install should install python extensions into PYTHONPATH
|
||||
[ -z "$CEPH_BIN" ] && CEPH_BIN=$CEPH_BUILD_ROOT/bin
|
||||
[ -z "$CEPH_LIB" ] && CEPH_LIB=$CEPH_BUILD_ROOT/lib
|
||||
[ -z "$EC_PATH" ] && EC_PATH=$CEPH_LIB/erasure-code
|
||||
[ -z "$OBJCLASS_PATH" ] && OBJCLASS_PATH=$CEPH_LIB/rados-classes
|
||||
# make install should install python extensions into PYTHONPATH
|
||||
elif [ -n "$CEPH_ROOT" ]; then
|
||||
[ -z "$CEPHFS_SHELL" ] && CEPHFS_SHELL=$CEPH_ROOT/src/tools/cephfs/cephfs-shell
|
||||
[ -z "$PYBIND" ] && PYBIND=$CEPH_ROOT/src/pybind
|
||||
[ -z "$CEPH_BIN" ] && CEPH_BIN=$CEPH_BUILD_DIR/bin
|
||||
[ -z "$CEPH_ADM" ] && CEPH_ADM=$CEPH_BIN/ceph
|
||||
[ -z "$INIT_CEPH" ] && INIT_CEPH=$CEPH_BIN/init-ceph
|
||||
[ -z "$CEPH_LIB" ] && CEPH_LIB=$CEPH_BUILD_DIR/lib
|
||||
[ -z "$OBJCLASS_PATH" ] && OBJCLASS_PATH=$CEPH_LIB
|
||||
[ -z "$EC_PATH" ] && EC_PATH=$CEPH_LIB
|
||||
[ -z "$CEPHFS_SHELL" ] && CEPHFS_SHELL=$CEPH_ROOT/src/tools/cephfs/cephfs-shell
|
||||
[ -z "$PYBIND" ] && PYBIND=$CEPH_ROOT/src/pybind
|
||||
[ -z "$CEPH_BIN" ] && CEPH_BIN=$CEPH_BUILD_DIR/bin
|
||||
[ -z "$CEPH_ADM" ] && CEPH_ADM=$CEPH_BIN/ceph
|
||||
[ -z "$INIT_CEPH" ] && INIT_CEPH=$CEPH_BIN/init-ceph
|
||||
[ -z "$CEPH_LIB" ] && CEPH_LIB=$CEPH_BUILD_DIR/lib
|
||||
[ -z "$OBJCLASS_PATH" ] && OBJCLASS_PATH=$CEPH_LIB
|
||||
[ -z "$EC_PATH" ] && EC_PATH=$CEPH_LIB
|
||||
fi
|
||||
|
||||
if [ -z "${CEPH_VSTART_WRAPPER}" ]; then
|
||||
@ -140,8 +140,8 @@ pci_id=""
|
||||
with_mgr_dashboard=true
|
||||
if [[ "$(get_cmake_variable WITH_MGR_DASHBOARD_FRONTEND)" != "ON" ]] ||
|
||||
[[ "$(get_cmake_variable WITH_RBD)" != "ON" ]]; then
|
||||
echo "ceph-mgr dashboard not built - disabling."
|
||||
with_mgr_dashboard=false
|
||||
echo "ceph-mgr dashboard not built - disabling."
|
||||
with_mgr_dashboard=false
|
||||
fi
|
||||
|
||||
filestore_path=
|
||||
@ -203,38 +203,38 @@ usage=$usage"\t--osd-args: specify any extra osd specific options\n"
|
||||
usage=$usage"\t--bluestore-devs: comma-separated list of blockdevs to use for bluestore\n"
|
||||
|
||||
usage_exit() {
|
||||
printf "$usage"
|
||||
exit
|
||||
printf "$usage"
|
||||
exit
|
||||
}
|
||||
|
||||
while [ $# -ge 1 ]; do
|
||||
case $1 in
|
||||
-d | --debug )
|
||||
debug=1
|
||||
;;
|
||||
debug=1
|
||||
;;
|
||||
-s | --standby_mds)
|
||||
standby=1
|
||||
;;
|
||||
standby=1
|
||||
;;
|
||||
-l | --localhost )
|
||||
ip="127.0.0.1"
|
||||
;;
|
||||
ip="127.0.0.1"
|
||||
;;
|
||||
-i )
|
||||
[ -z "$2" ] && usage_exit
|
||||
ip="$2"
|
||||
shift
|
||||
;;
|
||||
[ -z "$2" ] && usage_exit
|
||||
ip="$2"
|
||||
shift
|
||||
;;
|
||||
-e )
|
||||
ec=1
|
||||
;;
|
||||
ec=1
|
||||
;;
|
||||
--new | -n )
|
||||
new=1
|
||||
;;
|
||||
new=1
|
||||
;;
|
||||
--not-new | -N )
|
||||
new=0
|
||||
;;
|
||||
--short )
|
||||
short=1
|
||||
;;
|
||||
short=1
|
||||
;;
|
||||
--crimson )
|
||||
ceph_osd=crimson-osd
|
||||
;;
|
||||
@ -243,136 +243,135 @@ case $1 in
|
||||
shift
|
||||
;;
|
||||
--msgr1 )
|
||||
msgr="1"
|
||||
;;
|
||||
msgr="1"
|
||||
;;
|
||||
--msgr2 )
|
||||
msgr="2"
|
||||
;;
|
||||
msgr="2"
|
||||
;;
|
||||
--msgr21 )
|
||||
msgr="21"
|
||||
;;
|
||||
msgr="21"
|
||||
;;
|
||||
--valgrind )
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind=$2
|
||||
shift
|
||||
;;
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind=$2
|
||||
shift
|
||||
;;
|
||||
--valgrind_args )
|
||||
valgrind_args="$2"
|
||||
shift
|
||||
;;
|
||||
valgrind_args="$2"
|
||||
shift
|
||||
;;
|
||||
--valgrind_mds )
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_mds=$2
|
||||
shift
|
||||
;;
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_mds=$2
|
||||
shift
|
||||
;;
|
||||
--valgrind_osd )
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_osd=$2
|
||||
shift
|
||||
;;
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_osd=$2
|
||||
shift
|
||||
;;
|
||||
--valgrind_mon )
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_mon=$2
|
||||
shift
|
||||
;;
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_mon=$2
|
||||
shift
|
||||
;;
|
||||
--valgrind_mgr )
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_mgr=$2
|
||||
shift
|
||||
;;
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_mgr=$2
|
||||
shift
|
||||
;;
|
||||
--valgrind_rgw )
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_rgw=$2
|
||||
shift
|
||||
;;
|
||||
[ -z "$2" ] && usage_exit
|
||||
valgrind_rgw=$2
|
||||
shift
|
||||
;;
|
||||
--nodaemon )
|
||||
nodaemon=1
|
||||
;;
|
||||
nodaemon=1
|
||||
;;
|
||||
--redirect-output)
|
||||
redirect=1
|
||||
;;
|
||||
redirect=1
|
||||
;;
|
||||
--smallmds )
|
||||
smallmds=1
|
||||
;;
|
||||
smallmds=1
|
||||
;;
|
||||
--rgw_port )
|
||||
CEPH_RGW_PORT=$2
|
||||
shift
|
||||
;;
|
||||
CEPH_RGW_PORT=$2
|
||||
shift
|
||||
;;
|
||||
--rgw_frontend )
|
||||
rgw_frontend=$2
|
||||
shift
|
||||
;;
|
||||
rgw_frontend=$2
|
||||
shift
|
||||
;;
|
||||
--rgw_compression )
|
||||
rgw_compression=$2
|
||||
shift
|
||||
;;
|
||||
rgw_compression=$2
|
||||
shift
|
||||
;;
|
||||
--kstore_path )
|
||||
kstore_path=$2
|
||||
shift
|
||||
;;
|
||||
kstore_path=$2
|
||||
shift
|
||||
;;
|
||||
--filestore_path )
|
||||
filestore_path=$2
|
||||
shift
|
||||
;;
|
||||
filestore_path=$2
|
||||
shift
|
||||
;;
|
||||
-m )
|
||||
[ -z "$2" ] && usage_exit
|
||||
MON_ADDR=$2
|
||||
shift
|
||||
;;
|
||||
[ -z "$2" ] && usage_exit
|
||||
MON_ADDR=$2
|
||||
shift
|
||||
;;
|
||||
-x )
|
||||
cephx=1 # this is on be default, flag exists for historical consistency
|
||||
;;
|
||||
cephx=1 # this is on be default, flag exists for historical consistency
|
||||
;;
|
||||
-X )
|
||||
cephx=0
|
||||
;;
|
||||
|
||||
cephx=0
|
||||
;;
|
||||
|
||||
-g | --gssapi)
|
||||
gssapi_authx=1
|
||||
;;
|
||||
gssapi_authx=1
|
||||
;;
|
||||
-G)
|
||||
gssapi_authx=0
|
||||
;;
|
||||
gssapi_authx=0
|
||||
;;
|
||||
|
||||
-k )
|
||||
if [ ! -r $conf_fn ]; then
|
||||
echo "cannot use old configuration: $conf_fn not readable." >&2
|
||||
exit
|
||||
fi
|
||||
overwrite_conf=0
|
||||
;;
|
||||
if [ ! -r $conf_fn ]; then
|
||||
echo "cannot use old configuration: $conf_fn not readable." >&2
|
||||
exit
|
||||
fi
|
||||
overwrite_conf=0
|
||||
;;
|
||||
--memstore )
|
||||
objectstore="memstore"
|
||||
;;
|
||||
objectstore="memstore"
|
||||
;;
|
||||
-b | --bluestore )
|
||||
objectstore="bluestore"
|
||||
;;
|
||||
objectstore="bluestore"
|
||||
;;
|
||||
-f | --filestore )
|
||||
objectstore="filestore"
|
||||
;;
|
||||
objectstore="filestore"
|
||||
;;
|
||||
-K | --kstore )
|
||||
objectstore="kstore"
|
||||
;;
|
||||
objectstore="kstore"
|
||||
;;
|
||||
--hitset )
|
||||
hitset="$hitset $2 $3"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
hitset="$hitset $2 $3"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-o )
|
||||
extra_conf="$extra_conf $2
|
||||
"
|
||||
shift
|
||||
;;
|
||||
extra_conf="$extra_conf $2"
|
||||
shift
|
||||
;;
|
||||
--cache )
|
||||
if [ -z "$cache" ]; then
|
||||
cache="$2"
|
||||
else
|
||||
cache="$cache $2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
if [ -z "$cache" ]; then
|
||||
cache="$2"
|
||||
else
|
||||
cache="$cache $2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
--nolockdep )
|
||||
lockdep=0
|
||||
;;
|
||||
lockdep=0
|
||||
;;
|
||||
--multimds)
|
||||
CEPH_MAX_MDS="$2"
|
||||
shift
|
||||
@ -385,19 +384,19 @@ case $1 in
|
||||
pci_id="$2"
|
||||
spdk_enabled=1
|
||||
shift
|
||||
;;
|
||||
;;
|
||||
--bluestore-devs )
|
||||
IFS=',' read -r -a bluestore_dev <<< "$2"
|
||||
for dev in "${bluestore_dev[@]}"; do
|
||||
if [ ! -b $dev -o ! -w $dev ]; then
|
||||
echo "All --bluestore-devs must refer to writable block devices"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
shift
|
||||
IFS=',' read -r -a bluestore_dev <<< "$2"
|
||||
for dev in "${bluestore_dev[@]}"; do
|
||||
if [ ! -b $dev -o ! -w $dev ]; then
|
||||
echo "All --bluestore-devs must refer to writable block devices"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
shift
|
||||
;;
|
||||
* )
|
||||
usage_exit
|
||||
usage_exit
|
||||
esac
|
||||
shift
|
||||
done
|
||||
@ -422,18 +421,18 @@ if [ "$overwrite_conf" -eq 0 ]; then
|
||||
else
|
||||
if [ "$new" -ne 0 ]; then
|
||||
# only delete if -n
|
||||
if [ -e "$conf_fn" ]; then
|
||||
asok_dir=`dirname $($CEPH_BIN/ceph-conf -c $conf_fn --show-config-value admin_socket)`
|
||||
rm -- "$conf_fn"
|
||||
if [ $asok_dir != /var/run/ceph ]; then
|
||||
[ -d $asok_dir ] && rm -f $asok_dir/* && rmdir $asok_dir
|
||||
fi
|
||||
fi
|
||||
if [ -z "$CEPH_ASOK_DIR" ]; then
|
||||
if [ -e "$conf_fn" ]; then
|
||||
asok_dir=`dirname $($CEPH_BIN/ceph-conf -c $conf_fn --show-config-value admin_socket)`
|
||||
rm -- "$conf_fn"
|
||||
if [ $asok_dir != /var/run/ceph ]; then
|
||||
[ -d $asok_dir ] && rm -f $asok_dir/* && rmdir $asok_dir
|
||||
fi
|
||||
fi
|
||||
if [ -z "$CEPH_ASOK_DIR" ]; then
|
||||
CEPH_ASOK_DIR=`mktemp -u -d "${TMPDIR:-/tmp}/ceph-asok.XXXXXX"`
|
||||
fi
|
||||
else
|
||||
if [ -z "$CEPH_ASOK_DIR" ]; then
|
||||
if [ -z "$CEPH_ASOK_DIR" ]; then
|
||||
CEPH_ASOK_DIR=`dirname $($CEPH_BIN/ceph-conf -c $conf_fn --show-config-value admin_socket)`
|
||||
fi
|
||||
# -k is implied... (doesn't make sense otherwise)
|
||||
@ -487,9 +486,9 @@ run() {
|
||||
}
|
||||
|
||||
wconf() {
|
||||
if [ "$overwrite_conf" -eq 1 ]; then
|
||||
cat >> "$conf_fn"
|
||||
fi
|
||||
if [ "$overwrite_conf" -eq 1 ]; then
|
||||
cat >> "$conf_fn"
|
||||
fi
|
||||
}
|
||||
|
||||
get_pci_selector() {
|
||||
@ -512,23 +511,26 @@ prepare_conf() {
|
||||
|
||||
local mgr_modules="restful iostat"
|
||||
if $with_mgr_dashboard; then
|
||||
mgr_modules="dashboard $mgr_modules"
|
||||
mgr_modules="dashboard $mgr_modules"
|
||||
fi
|
||||
|
||||
local msgr_conf=''
|
||||
if [ $msgr -eq 21 ]; then
|
||||
msgr_conf="ms bind msgr2 = true
|
||||
ms bind msgr1 = true
|
||||
msgr_conf="
|
||||
ms bind msgr2 = true
|
||||
ms bind msgr1 = true
|
||||
";
|
||||
fi
|
||||
if [ $msgr -eq 2 ]; then
|
||||
msgr_conf="ms bind msgr2 = true
|
||||
ms bind msgr1 = false
|
||||
msgr_conf="
|
||||
ms bind msgr2 = true
|
||||
ms bind msgr1 = false
|
||||
";
|
||||
fi
|
||||
if [ $msgr -eq 1 ]; then
|
||||
msgr_conf="ms bind msgr2 = false
|
||||
ms bind msgr1 = true
|
||||
msgr_conf="
|
||||
ms bind msgr2 = false
|
||||
ms bind msgr1 = true
|
||||
";
|
||||
fi
|
||||
|
||||
@ -551,69 +553,69 @@ ms bind msgr1 = true
|
||||
plugin dir = $CEPH_LIB
|
||||
filestore fd cache size = 32
|
||||
run dir = $CEPH_OUT_DIR
|
||||
crash dir = $CEPH_OUT_DIR
|
||||
crash dir = $CEPH_OUT_DIR
|
||||
enable experimental unrecoverable data corrupting features = *
|
||||
osd_crush_chooseleaf_type = 0
|
||||
debug asok assert abort = true
|
||||
osd_crush_chooseleaf_type = 0
|
||||
debug asok assert abort = true
|
||||
$msgr_conf
|
||||
$extra_conf
|
||||
EOF
|
||||
if [ "$lockdep" -eq 1 ] ; then
|
||||
wconf <<EOF
|
||||
if [ "$lockdep" -eq 1 ] ; then
|
||||
wconf <<EOF
|
||||
lockdep = true
|
||||
EOF
|
||||
fi
|
||||
if [ "$cephx" -eq 1 ] ; then
|
||||
wconf <<EOF
|
||||
auth cluster required = cephx
|
||||
auth service required = cephx
|
||||
auth client required = cephx
|
||||
fi
|
||||
if [ "$cephx" -eq 1 ] ; then
|
||||
wconf <<EOF
|
||||
auth cluster required = cephx
|
||||
auth service required = cephx
|
||||
auth client required = cephx
|
||||
EOF
|
||||
elif [ "$gssapi_authx" -eq 1 ] ; then
|
||||
wconf <<EOF
|
||||
auth cluster required = gss
|
||||
auth service required = gss
|
||||
auth client required = gss
|
||||
gss ktab client file = $CEPH_DEV_DIR/gss_\$name.keytab
|
||||
elif [ "$gssapi_authx" -eq 1 ] ; then
|
||||
wconf <<EOF
|
||||
auth cluster required = gss
|
||||
auth service required = gss
|
||||
auth client required = gss
|
||||
gss ktab client file = $CEPH_DEV_DIR/gss_\$name.keytab
|
||||
EOF
|
||||
else
|
||||
wconf <<EOF
|
||||
auth cluster required = none
|
||||
auth service required = none
|
||||
auth client required = none
|
||||
else
|
||||
wconf <<EOF
|
||||
auth cluster required = none
|
||||
auth service required = none
|
||||
auth client required = none
|
||||
EOF
|
||||
fi
|
||||
if [ "$short" -eq 1 ]; then
|
||||
COSDSHORT=" osd max object name len = 460
|
||||
fi
|
||||
if [ "$short" -eq 1 ]; then
|
||||
COSDSHORT=" osd max object name len = 460
|
||||
osd max object namespace len = 64"
|
||||
fi
|
||||
if [ "$objectstore" == "bluestore" ]; then
|
||||
if [ "$spdk_enabled" -eq 1 ]; then
|
||||
if [ "$(get_pci_selector_num)" -eq 0 ]; then
|
||||
echo "Not find the specified NVME device, please check." >&2
|
||||
exit
|
||||
fi
|
||||
if [ $(get_pci_selector_num) -lt $CEPH_NUM_OSD ]; then
|
||||
echo "OSD number ($CEPH_NUM_OSD) is greater than NVME SSD number ($(get_pci_selector_num)), please check." >&2
|
||||
exit
|
||||
fi
|
||||
BLUESTORE_OPTS=" bluestore_block_db_path = \"\"
|
||||
fi
|
||||
if [ "$objectstore" == "bluestore" ]; then
|
||||
if [ "$spdk_enabled" -eq 1 ]; then
|
||||
if [ "$(get_pci_selector_num)" -eq 0 ]; then
|
||||
echo "Not find the specified NVME device, please check." >&2
|
||||
exit
|
||||
fi
|
||||
if [ $(get_pci_selector_num) -lt $CEPH_NUM_OSD ]; then
|
||||
echo "OSD number ($CEPH_NUM_OSD) is greater than NVME SSD number ($(get_pci_selector_num)), please check." >&2
|
||||
exit
|
||||
fi
|
||||
BLUESTORE_OPTS=" bluestore_block_db_path = \"\"
|
||||
bluestore_block_db_size = 0
|
||||
bluestore_block_db_create = false
|
||||
bluestore_block_wal_path = \"\"
|
||||
bluestore_block_wal_size = 0
|
||||
bluestore_block_wal_create = false
|
||||
bluestore_spdk_mem = 2048"
|
||||
else
|
||||
BLUESTORE_OPTS=" bluestore block db path = $CEPH_DEV_DIR/osd\$id/block.db.file
|
||||
else
|
||||
BLUESTORE_OPTS=" bluestore block db path = $CEPH_DEV_DIR/osd\$id/block.db.file
|
||||
bluestore block db size = 1073741824
|
||||
bluestore block db create = true
|
||||
bluestore block wal path = $CEPH_DEV_DIR/osd\$id/block.wal.file
|
||||
bluestore block wal size = 1048576000
|
||||
bluestore block wal create = true"
|
||||
fi
|
||||
fi
|
||||
wconf <<EOF
|
||||
fi
|
||||
wconf <<EOF
|
||||
[client]
|
||||
keyring = $keyring_fn
|
||||
log file = $CEPH_OUT_DIR/\$name.\$pid.log
|
||||
@ -682,89 +684,87 @@ start_mon() {
|
||||
do
|
||||
[ $count -eq $CEPH_NUM_MON ] && break;
|
||||
count=$(($count + 1))
|
||||
if [ -z "$MONS" ];
|
||||
then
|
||||
MONS="$f"
|
||||
if [ -z "$MONS" ]; then
|
||||
MONS="$f"
|
||||
else
|
||||
MONS="$MONS $f"
|
||||
MONS="$MONS $f"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$new" -eq 1 ]; then
|
||||
if [ `echo $IP | grep '^127\\.'` ]
|
||||
then
|
||||
echo
|
||||
echo "NOTE: hostname resolves to loopback; remote hosts will not be able to"
|
||||
echo " connect. either adjust /etc/hosts, or edit this script to use your"
|
||||
echo " machine's real IP."
|
||||
echo
|
||||
fi
|
||||
if [ `echo $IP | grep '^127\\.'` ]; then
|
||||
echo
|
||||
echo "NOTE: hostname resolves to loopback; remote hosts will not be able to"
|
||||
echo " connect. either adjust /etc/hosts, or edit this script to use your"
|
||||
echo " machine's real IP."
|
||||
echo
|
||||
fi
|
||||
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --create-keyring --gen-key --name=mon. "$keyring_fn" --cap mon 'allow *'
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --gen-key --name=client.admin \
|
||||
--cap mon 'allow *' \
|
||||
--cap osd 'allow *' \
|
||||
--cap mds 'allow *' \
|
||||
--cap mgr 'allow *' \
|
||||
"$keyring_fn"
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --create-keyring --gen-key --name=mon. "$keyring_fn" --cap mon 'allow *'
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --gen-key --name=client.admin \
|
||||
--cap mon 'allow *' \
|
||||
--cap osd 'allow *' \
|
||||
--cap mds 'allow *' \
|
||||
--cap mgr 'allow *' \
|
||||
"$keyring_fn"
|
||||
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --gen-key --name=client.fs\
|
||||
--cap mon 'allow r' \
|
||||
--cap osd 'allow rw tag cephfs data=*' \
|
||||
--cap mds 'allow rwp' \
|
||||
"$keyring_fn"
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --gen-key --name=client.fs\
|
||||
--cap mon 'allow r' \
|
||||
--cap osd 'allow rw tag cephfs data=*' \
|
||||
--cap mds 'allow rwp' \
|
||||
"$keyring_fn"
|
||||
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --gen-key --name=client.rgw \
|
||||
--cap mon 'allow rw' \
|
||||
--cap osd 'allow rwx' \
|
||||
--cap mgr 'allow rw' \
|
||||
"$keyring_fn"
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --gen-key --name=client.rgw \
|
||||
--cap mon 'allow rw' \
|
||||
--cap osd 'allow rwx' \
|
||||
--cap mgr 'allow rw' \
|
||||
"$keyring_fn"
|
||||
|
||||
# build a fresh fs monmap, mon fs
|
||||
local params=()
|
||||
local count=0
|
||||
local mon_host=""
|
||||
for f in $MONS
|
||||
do
|
||||
if [ $msgr -eq 1 ]; then
|
||||
A="v1:$IP:$(($CEPH_PORT+$count+1))"
|
||||
fi
|
||||
if [ $msgr -eq 2 ]; then
|
||||
A="v2:$IP:$(($CEPH_PORT+$count+1))"
|
||||
fi
|
||||
if [ $msgr -eq 21 ]; then
|
||||
A="[v2:$IP:$(($CEPH_PORT+$count)),v1:$IP:$(($CEPH_PORT+$count+1))]"
|
||||
fi
|
||||
params+=("--addv" "$f" "$A")
|
||||
mon_host="$mon_host $A"
|
||||
wconf <<EOF
|
||||
# build a fresh fs monmap, mon fs
|
||||
local params=()
|
||||
local count=0
|
||||
local mon_host=""
|
||||
for f in $MONS
|
||||
do
|
||||
if [ $msgr -eq 1 ]; then
|
||||
A="v1:$IP:$(($CEPH_PORT+$count+1))"
|
||||
fi
|
||||
if [ $msgr -eq 2 ]; then
|
||||
A="v2:$IP:$(($CEPH_PORT+$count+1))"
|
||||
fi
|
||||
if [ $msgr -eq 21 ]; then
|
||||
A="[v2:$IP:$(($CEPH_PORT+$count)),v1:$IP:$(($CEPH_PORT+$count+1))]"
|
||||
fi
|
||||
params+=("--addv" "$f" "$A")
|
||||
mon_host="$mon_host $A"
|
||||
wconf <<EOF
|
||||
[mon.$f]
|
||||
host = $HOSTNAME
|
||||
mon data = $CEPH_DEV_DIR/mon.$f
|
||||
EOF
|
||||
count=$(($count + 2))
|
||||
done
|
||||
wconf <<EOF
|
||||
count=$(($count + 2))
|
||||
done
|
||||
wconf <<EOF
|
||||
[global]
|
||||
mon host = $mon_host
|
||||
EOF
|
||||
prun "$CEPH_BIN/monmaptool" --create --clobber "${params[@]}" --print "$monmap_fn"
|
||||
prun "$CEPH_BIN/monmaptool" --create --clobber "${params[@]}" --print "$monmap_fn"
|
||||
|
||||
for f in $MONS
|
||||
do
|
||||
prun rm -rf -- "$CEPH_DEV_DIR/mon.$f"
|
||||
prun mkdir -p "$CEPH_DEV_DIR/mon.$f"
|
||||
prun "$CEPH_BIN/ceph-mon" --mkfs -c "$conf_fn" -i "$f" --monmap="$monmap_fn" --keyring="$keyring_fn"
|
||||
done
|
||||
for f in $MONS
|
||||
do
|
||||
prun rm -rf -- "$CEPH_DEV_DIR/mon.$f"
|
||||
prun mkdir -p "$CEPH_DEV_DIR/mon.$f"
|
||||
prun "$CEPH_BIN/ceph-mon" --mkfs -c "$conf_fn" -i "$f" --monmap="$monmap_fn" --keyring="$keyring_fn"
|
||||
done
|
||||
|
||||
prun rm -- "$monmap_fn"
|
||||
fi
|
||||
prun rm -- "$monmap_fn"
|
||||
fi
|
||||
|
||||
# start monitors
|
||||
for f in $MONS
|
||||
do
|
||||
run 'mon' $f $CEPH_BIN/ceph-mon -i $f $ARGS $CMON_ARGS
|
||||
done
|
||||
# start monitors
|
||||
for f in $MONS
|
||||
do
|
||||
run 'mon' $f $CEPH_BIN/ceph-mon -i $f $ARGS $CMON_ARGS
|
||||
done
|
||||
}
|
||||
|
||||
start_osd() {
|
||||
@ -785,33 +785,33 @@ EOF
|
||||
if command -v btrfs > /dev/null; then
|
||||
for f in $CEPH_DEV_DIR/osd$osd/*; do btrfs sub delete $f &> /dev/null || true; done
|
||||
fi
|
||||
if [ -n "$filestore_path" ]; then
|
||||
ln -s $filestore_path $CEPH_DEV_DIR/osd$osd
|
||||
elif [ -n "$kstore_path" ]; then
|
||||
ln -s $kstore_path $CEPH_DEV_DIR/osd$osd
|
||||
else
|
||||
mkdir -p $CEPH_DEV_DIR/osd$osd
|
||||
if [ -n "${bluestore_dev[$osd]}" ]; then
|
||||
dd if=/dev/zero of=${bluestore_dev[$osd]} bs=1M count=1
|
||||
ln -s ${bluestore_dev[$osd]} $CEPH_DEV_DIR/osd$osd/block
|
||||
wconf <<EOF
|
||||
bluestore fsck on mount = false
|
||||
if [ -n "$filestore_path" ]; then
|
||||
ln -s $filestore_path $CEPH_DEV_DIR/osd$osd
|
||||
elif [ -n "$kstore_path" ]; then
|
||||
ln -s $kstore_path $CEPH_DEV_DIR/osd$osd
|
||||
else
|
||||
mkdir -p $CEPH_DEV_DIR/osd$osd
|
||||
if [ -n "${bluestore_dev[$osd]}" ]; then
|
||||
dd if=/dev/zero of=${bluestore_dev[$osd]} bs=1M count=1
|
||||
ln -s ${bluestore_dev[$osd]} $CEPH_DEV_DIR/osd$osd/block
|
||||
wconf <<EOF
|
||||
bluestore fsck on mount = false
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
local uuid=`uuidgen`
|
||||
echo "add osd$osd $uuid"
|
||||
OSD_SECRET=$($CEPH_BIN/ceph-authtool --gen-print-key)
|
||||
echo "{\"cephx_secret\": \"$OSD_SECRET\"}" > $CEPH_DEV_DIR/osd$osd/new.json
|
||||
OSD_SECRET=$($CEPH_BIN/ceph-authtool --gen-print-key)
|
||||
echo "{\"cephx_secret\": \"$OSD_SECRET\"}" > $CEPH_DEV_DIR/osd$osd/new.json
|
||||
ceph_adm osd new $uuid -i $CEPH_DEV_DIR/osd$osd/new.json
|
||||
rm $CEPH_DEV_DIR/osd$osd/new.json
|
||||
rm $CEPH_DEV_DIR/osd$osd/new.json
|
||||
$SUDO $CEPH_BIN/$ceph_osd $extra_osd_args -i $osd $ARGS --mkfs --key $OSD_SECRET --osd-uuid $uuid
|
||||
|
||||
local key_fn=$CEPH_DEV_DIR/osd$osd/keyring
|
||||
cat > $key_fn<<EOF
|
||||
cat > $key_fn<<EOF
|
||||
[osd.$osd]
|
||||
key = $OSD_SECRET
|
||||
key = $OSD_SECRET
|
||||
EOF
|
||||
echo adding osd$osd key to auth repository
|
||||
ceph_adm -i "$key_fn" auth add osd.$osd osd "allow *" mon "allow profile osd" mgr "allow profile osd"
|
||||
@ -899,39 +899,39 @@ start_mds() {
|
||||
local mds=0
|
||||
for name in a b c d e f g h i j k l m n o p
|
||||
do
|
||||
[ $mds -eq $CEPH_NUM_MDS ] && break
|
||||
mds=$(($mds + 1))
|
||||
[ $mds -eq $CEPH_NUM_MDS ] && break
|
||||
mds=$(($mds + 1))
|
||||
|
||||
if [ "$new" -eq 1 ]; then
|
||||
prun mkdir -p "$CEPH_DEV_DIR/mds.$name"
|
||||
key_fn=$CEPH_DEV_DIR/mds.$name/keyring
|
||||
wconf <<EOF
|
||||
if [ "$new" -eq 1 ]; then
|
||||
prun mkdir -p "$CEPH_DEV_DIR/mds.$name"
|
||||
key_fn=$CEPH_DEV_DIR/mds.$name/keyring
|
||||
wconf <<EOF
|
||||
[mds.$name]
|
||||
host = $HOSTNAME
|
||||
EOF
|
||||
if [ "$standby" -eq 1 ]; then
|
||||
mkdir -p $CEPH_DEV_DIR/mds.${name}s
|
||||
wconf <<EOF
|
||||
mds standby for rank = $mds
|
||||
if [ "$standby" -eq 1 ]; then
|
||||
mkdir -p $CEPH_DEV_DIR/mds.${name}s
|
||||
wconf <<EOF
|
||||
mds standby for rank = $mds
|
||||
[mds.${name}s]
|
||||
mds standby replay = true
|
||||
mds standby for name = ${name}
|
||||
EOF
|
||||
fi
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --create-keyring --gen-key --name="mds.$name" "$key_fn"
|
||||
ceph_adm -i "$key_fn" auth add "mds.$name" mon 'allow profile mds' osd 'allow rw tag cephfs *=*' mds 'allow' mgr 'allow profile mds'
|
||||
if [ "$standby" -eq 1 ]; then
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --create-keyring --gen-key --name="mds.${name}s" \
|
||||
"$CEPH_DEV_DIR/mds.${name}s/keyring"
|
||||
ceph_adm -i "$CEPH_DEV_DIR/mds.${name}s/keyring" auth add "mds.${name}s" \
|
||||
mon 'allow profile mds' osd 'allow *' mds 'allow' mgr 'allow profile mds'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --create-keyring --gen-key --name="mds.$name" "$key_fn"
|
||||
ceph_adm -i "$key_fn" auth add "mds.$name" mon 'allow profile mds' osd 'allow rw tag cephfs *=*' mds 'allow' mgr 'allow profile mds'
|
||||
if [ "$standby" -eq 1 ]; then
|
||||
prun $SUDO "$CEPH_BIN/ceph-authtool" --create-keyring --gen-key --name="mds.${name}s" \
|
||||
"$CEPH_DEV_DIR/mds.${name}s/keyring"
|
||||
ceph_adm -i "$CEPH_DEV_DIR/mds.${name}s/keyring" auth add "mds.${name}s" \
|
||||
mon 'allow profile mds' osd 'allow *' mds 'allow' mgr 'allow profile mds'
|
||||
fi
|
||||
fi
|
||||
|
||||
run 'mds' $name $CEPH_BIN/ceph-mds -i $name $ARGS $CMDS_ARGS
|
||||
if [ "$standby" -eq 1 ]; then
|
||||
run 'mds' $CEPH_BIN/ceph-mds -i ${name}s $ARGS $CMDS_ARGS
|
||||
fi
|
||||
run 'mds' $name $CEPH_BIN/ceph-mds -i $name $ARGS $CMDS_ARGS
|
||||
if [ "$standby" -eq 1 ]; then
|
||||
run 'mds' $CEPH_BIN/ceph-mds -i ${name}s $ARGS $CMDS_ARGS
|
||||
fi
|
||||
|
||||
#valgrind --tool=massif $CEPH_BIN/ceph-mds $ARGS --mds_log_max_segments 2 --mds_thrash_fragments 0 --mds_thrash_exports 0 > m #--debug_ms 20
|
||||
#$CEPH_BIN/ceph-mds -d $ARGS --mds_thrash_fragments 0 --mds_thrash_exports 0 #--debug_ms 20
|
||||
@ -948,8 +948,8 @@ EOF
|
||||
local fs=0
|
||||
for name in a b c d e f g h i j k l m n o p
|
||||
do
|
||||
ceph_adm fs volume create ${name}
|
||||
ceph_adm fs authorize ${name} "client.fs_${name}" / rwp
|
||||
ceph_adm fs volume create ${name}
|
||||
ceph_adm fs authorize ${name} "client.fs_${name}" / rwp
|
||||
fs=$(($fs + 1))
|
||||
[ $fs -eq $CEPH_NUM_FS ] && break
|
||||
done
|
||||
@ -968,23 +968,22 @@ else
|
||||
debug mon = 20
|
||||
debug paxos = 20
|
||||
debug auth = 20
|
||||
debug mgrc = 20
|
||||
debug mgrc = 20
|
||||
debug ms = 1'
|
||||
fi
|
||||
|
||||
if [ -n "$MON_ADDR" ]; then
|
||||
CMON_ARGS=" -m "$MON_ADDR
|
||||
COSD_ARGS=" -m "$MON_ADDR
|
||||
CMDS_ARGS=" -m "$MON_ADDR
|
||||
CMON_ARGS=" -m "$MON_ADDR
|
||||
COSD_ARGS=" -m "$MON_ADDR
|
||||
CMDS_ARGS=" -m "$MON_ADDR
|
||||
fi
|
||||
|
||||
if [ -z "$CEPH_PORT" ]
|
||||
then
|
||||
while [ true ]
|
||||
do
|
||||
CEPH_PORT="$(echo $(( RANDOM % 1000 + 40000 )))"
|
||||
ss -a -n | egrep "\<LISTEN\>.+:${CEPH_PORT}\s+" 1>/dev/null 2>&1 || break
|
||||
done
|
||||
if [ -z "$CEPH_PORT" ]; then
|
||||
while [ true ]
|
||||
do
|
||||
CEPH_PORT="$(echo $(( RANDOM % 1000 + 40000 )))"
|
||||
ss -a -n | egrep "\<LISTEN\>.+:${CEPH_PORT}\s+" 1>/dev/null 2>&1 || break
|
||||
done
|
||||
fi
|
||||
|
||||
[ -z "$INIT_CEPH" ] && INIT_CEPH=$CEPH_BIN/init-ceph
|
||||
@ -1010,9 +1009,9 @@ if [ -n "$ip" ]; then
|
||||
else
|
||||
echo hostname $HOSTNAME
|
||||
if [ -x "$(which ip 2>/dev/null)" ]; then
|
||||
IP_CMD="ip addr"
|
||||
IP_CMD="ip addr"
|
||||
else
|
||||
IP_CMD="ifconfig"
|
||||
IP_CMD="ifconfig"
|
||||
fi
|
||||
# filter out IPv4 and localhost addresses
|
||||
IP="$($IP_CMD | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' | head -n1)"
|
||||
@ -1067,8 +1066,8 @@ mds_debug_subtrees = true
|
||||
EOF
|
||||
|
||||
if [ "$debug" -ne 0 ]; then
|
||||
echo Setting debug configs ...
|
||||
cat <<EOF | $CEPH_BIN/ceph -c $conf_fn config assimilate-conf -i -
|
||||
echo Setting debug configs ...
|
||||
cat <<EOF | $CEPH_BIN/ceph -c $conf_fn config assimilate-conf -i -
|
||||
[mgr]
|
||||
debug_ms = 1
|
||||
debug_mgr = 20
|
||||
@ -1114,8 +1113,8 @@ fi
|
||||
if [ "$smallmds" -eq 1 ]; then
|
||||
wconf <<EOF
|
||||
[mds]
|
||||
mds log max segments = 2
|
||||
mds cache size = 10000
|
||||
mds log max segments = 2
|
||||
mds cache size = 10000
|
||||
EOF
|
||||
fi
|
||||
|
||||
@ -1149,10 +1148,10 @@ fi
|
||||
|
||||
do_cache() {
|
||||
while [ -n "$*" ]; do
|
||||
p="$1"
|
||||
shift
|
||||
echo "creating cache for pool $p ..."
|
||||
ceph_adm <<EOF
|
||||
p="$1"
|
||||
shift
|
||||
echo "creating cache for pool $p ..."
|
||||
ceph_adm <<EOF
|
||||
osd pool create ${p}-cache 8
|
||||
osd tier add $p ${p}-cache
|
||||
osd tier cache-mode ${p}-cache writeback
|
||||
@ -1164,12 +1163,12 @@ do_cache $cache
|
||||
|
||||
do_hitsets() {
|
||||
while [ -n "$*" ]; do
|
||||
pool="$1"
|
||||
type="$2"
|
||||
shift
|
||||
shift
|
||||
echo "setting hit_set on pool $pool type $type ..."
|
||||
ceph_adm <<EOF
|
||||
pool="$1"
|
||||
type="$2"
|
||||
shift
|
||||
shift
|
||||
echo "setting hit_set on pool $pool type $type ..."
|
||||
ceph_adm <<EOF
|
||||
osd pool set $pool hit_set_type $type
|
||||
osd pool set $pool hit_set_count 8
|
||||
osd pool set $pool hit_set_period 30
|
||||
@ -1228,7 +1227,7 @@ do_rgw_create_users()
|
||||
do_rgw()
|
||||
{
|
||||
if [ "$new" -eq 1 ]; then
|
||||
do_rgw_create_users
|
||||
do_rgw_create_users
|
||||
if [ -n "$rgw_compression" ]; then
|
||||
echo "setting compression type=$rgw_compression"
|
||||
$CEPH_BIN/radosgw-admin zone placement modify -c $conf_fn --rgw-zone=default --placement-id=default-placement --compression=$rgw_compression > /dev/null
|
||||
@ -1294,7 +1293,7 @@ echo ""
|
||||
fi
|
||||
|
||||
if [ -n "$CEPHFS_SHELL" ]; then
|
||||
echo "alias cephfs-shell=$CEPHFS_SHELL"
|
||||
echo "alias cephfs-shell=$CEPHFS_SHELL"
|
||||
fi
|
||||
} | tee -a $CEPH_DIR/vstart_environment.sh
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user