# abort on failure
set -e
+quoted_print() {
+ for s in "$@"; do
+ if [[ "$s" =~ \ ]]; then
+ printf -- "'%s' " "$s"
+ else
+ printf -- "$s "
+ fi
+ done
+ printf '\n'
+}
+
+debug() {
+ if [ -w /dev/tty -a ! -t 2 ]; then
+ "$@" | tee /dev/tty >&2
+ else
+ "$@" >&2
+ fi
+}
+
+prunb() {
+ debug quoted_print "$@" '&'
+ "$@" &
+}
+
+prun() {
+ debug quoted_print "$@"
+ "$@"
+}
+
+
if [ -n "$VSTART_DEST" ]; then
SRC_PATH=`dirname $0`
SRC_PATH=`(cd $SRC_PATH; pwd)`
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."
+ debug echo "ceph-mgr dashboard not built - disabling."
with_mgr_dashboard=false
fi
ARGS="-c $conf_fn"
-quoted_print() {
- for s in "$@"; do
- if [[ "$s" =~ \ ]]; then
- printf -- "'%s' " "$s"
- else
- printf -- "$s "
- fi
- done
- printf '\n'
-}
-
-debug() {
- if [ -w /dev/tty -a ! -t 2 ]; then
- "$@" | tee /dev/tty >&2
- else
- "$@" >&2
- fi
-}
-
-prunb() {
- debug quoted_print "$@" '&'
- "$@" &
-}
-
-prun() {
- debug quoted_print "$@"
- "$@"
-}
-
run() {
type=$1
shift
MGR_PORT=$(($MGR_PORT + 1000))
fi
- echo "Starting mgr.${name}"
+ debug echo "Starting mgr.${name}"
run 'mgr' $name $CEPH_BIN/ceph-mgr -i $name $ARGS
done
# setting login credentials for dashboard
if $with_mgr_dashboard; then
while ! ceph_adm -h | grep -c -q ^dashboard ; do
- echo 'waiting for mgr dashboard module to start'
+ debug echo 'waiting for mgr dashboard module to start'
sleep 1
done
ceph_adm dashboard ac-user-create admin admin administrator
if [ "$ssl" != "0" ]; then
if ! ceph_adm dashboard create-self-signed-cert; then
- echo dashboard module not working correctly!
+ debug echo dashboard module not working correctly!
fi
fi
fi
while ! ceph_adm -h | grep -c -q ^restful ; do
- echo 'waiting for mgr restful module to start'
+ debug echo 'waiting for mgr restful module to start'
sleep 1
done
if ceph_adm restful create-self-signed-cert; then
RESTFUL_SECRET=`cat $SF`
rm $SF
else
- echo MGR Restful is not working, perhaps the package is not installed?
+ debug echo MGR Restful is not working, perhaps the package is not installed?
fi
fi
if [ "$ssh" -eq 1 ]; then
- echo Enabling ssh orchestrator
+ debug echo Enabling ssh orchestrator
ceph_adm config-key set mgr/ssh/ssh_identity_key -i ~/.ssh/id_rsa
ceph_adm config-key set mgr/ssh/ssh_identity_pub -i ~/.ssh/id_rsa.pub
ceph_adm mgr module enable ssh
debug mon = 10
debug ms = 1'
else
- echo "** going verbose **"
+ debug echo "** going verbose **"
CMONDEBUG='
debug mon = 20
debug paxos = 20
if [ $CEPH_NUM_MON -gt 0 ]; then
start_mon
- echo Populating config ...
+ debug echo Populating config ...
cat <<EOF | $CEPH_BIN/ceph -c $conf_fn config assimilate-conf -i -
[global]
osd_pool_default_size = $OSD_POOL_DEFAULT_SIZE
EOF
if [ "$debug" -ne 0 ]; then
- echo Setting debug configs ...
+ debug echo Setting debug configs ...
cat <<EOF | $CEPH_BIN/ceph -c $conf_fn config assimilate-conf -i -
[mgr]
debug_ms = 1
while [ -n "$*" ]; do
p="$1"
shift
- echo "creating cache for pool $p ..."
+ debug echo "creating cache for pool $p ..."
ceph_adm <<EOF
osd pool create ${p}-cache
osd tier add $p ${p}-cache
type="$2"
shift
shift
- echo "setting hit_set on pool $pool type $type ..."
+ debug 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
# Create S3 user
local akey='0555b35654ad1656d804'
local skey='h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=='
- echo "setting up user testid"
+ debug echo "setting up user testid"
$CEPH_BIN/radosgw-admin user create --uid testid --access-key $akey --secret $skey --display-name 'M. Tester' --email tester@ceph.com -c $conf_fn > /dev/null
# Create S3-test users
# See: https://github.com/ceph/s3-tests
- echo "setting up s3-test users"
+ debug echo "setting up s3-test users"
$CEPH_BIN/radosgw-admin user create \
--uid 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef \
--access-key ABCDEFGHIJKLMNOPQRST \
--email tenanteduser@example.com -c $conf_fn > /dev/null
# Create Swift user
- echo "setting up user tester"
+ debug echo "setting up user tester"
$CEPH_BIN/radosgw-admin user create -c $conf_fn --subuser=test:tester --display-name=Tester-Subuser --key-type=swift --secret=testing --access=full > /dev/null
echo ""
if [ "$new" -eq 1 ]; then
do_rgw_create_users
if [ -n "$rgw_compression" ]; then
- echo "setting compression type=$rgw_compression"
+ debug 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
fi
fi
mgr 'allow rw' \
>> "$keyring_fn"
- echo start rgw on http${CEPH_RGW_HTTPS}://localhost:${current_port}
+ debug echo start rgw on http${CEPH_RGW_HTTPS}://localhost:${current_port}
run 'rgw' $current_port $RGWSUDO $CEPH_BIN/radosgw -c $conf_fn \
--log-file=${CEPH_OUT_DIR}/radosgw.${current_port}.log \
--admin-socket=${CEPH_OUT_DIR}/radosgw.${current_port}.asok \
do_rgw
fi
-echo "started. stop.sh to stop. see out/* (e.g. 'tail -f out/????') for debug output."
+debug echo "vstart cluster complete. Use stop.sh to stop. See out/* (e.g. 'tail -f out/????') for debug output."
echo ""
if [ "$new" -eq 1 ]; then