Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vstart: clean up usage a bit #13138

Merged
merged 10 commits into from Feb 28, 2017
6 changes: 4 additions & 2 deletions src/ceph_common.sh
Expand Up @@ -175,14 +175,16 @@ get_local_name_list() {
get_local_daemon_list "mon"
get_local_daemon_list "osd"
get_local_daemon_list "mds"
get_local_daemon_list "mgr"
}

get_name_list() {
orig="$*"

# extract list of monitors, mdss, osds defined in startup.conf
# extract list of monitors, mdss, osds, mgrs defined in startup.conf
allconf="$local "`$CCONF -c $conf -l mon | egrep -v '^mon$' || true ; \
$CCONF -c $conf -l mds | egrep -v '^mds$' || true ; \
$CCONF -c $conf -l mgr | egrep -v '^mgr$' || true ; \
$CCONF -c $conf -l osd | egrep -v '^osd$' || true`

if [ -z "$orig" ]; then
Expand All @@ -195,7 +197,7 @@ get_name_list() {
type=`echo $f | cut -c 1-3` # e.g. 'mon', if $item is 'mon1'
id=`echo $f | cut -c 4- | sed 's/\\.//'`
case $f in
mon | osd | mds)
mon | osd | mds | mgr)
for d in $allconf; do
if echo $d | grep -q ^$type; then
what="$what $d"
Expand Down
4 changes: 4 additions & 0 deletions src/stop.sh
Expand Up @@ -51,6 +51,10 @@ while [ $# -ge 1 ]; do
stop_mon=1
stop_all=0
;;
mgr | ceph-mgr )
stop_mon=1
stop_all=0
;;
mds | ceph-mds )
stop_mds=1
stop_all=0
Expand Down
1 change: 1 addition & 0 deletions src/test/CMakeLists.txt
Expand Up @@ -502,6 +502,7 @@ endif(HAVE_BLKID)
#following dependencies are run inside make check unit tests
add_dependencies(tests
ceph-mon
ceph-mgr
ceph
ceph-authtool
get_command_descriptions
Expand Down
2 changes: 1 addition & 1 deletion src/test/ceph_objectstore_tool.py
Expand Up @@ -151,7 +151,7 @@ def cat_file(level, filename):

def vstart(new, opt=""):
print("vstarting....", end="")
NEW = new and "-n" or ""
NEW = new and "-n" or "-N"
call("MON=1 OSD=4 CEPH_PORT=7400 {path}/src/vstart.sh --short -l {new} -d mon osd {opt} > /dev/null 2>&1".format(new=NEW, opt=opt, path=CEPH_ROOT), shell=True)
print("DONE")

Expand Down
35 changes: 19 additions & 16 deletions src/vstart.sh
Expand Up @@ -34,7 +34,7 @@ elif [ -n "$CEPH_ROOT" ]; then
[ -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 "$INIT_CEPH" ] && INIT_CEPH=$CEPH_BUILD_DIR/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
Expand All @@ -60,10 +60,10 @@ export DYLD_LIBRARY_PATH=$CEPH_LIB:$DYLD_LIBRARY_PATH
[ -z "$CEPH_NUM_MON" ] && CEPH_NUM_MON=3
[ -z "$CEPH_NUM_OSD" ] && CEPH_NUM_OSD=3
[ -z "$CEPH_NUM_MDS" ] && CEPH_NUM_MDS=3
[ -z "$CEPH_NUM_MGR" ] && CEPH_NUM_MGR=0
[ -z "$CEPH_NUM_MGR" ] && CEPH_NUM_MGR=1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ceph-mgr is not included in the "tests" target, see https://github.com/ceph/ceph/blob/master/src/test/CMakeLists.txt#L503. if we want to start mgr by default, we need to include it in "tests".

Starting mgr.x
/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/ceph-mgr -i x
2017-02-02 15:26:32.875139 7f8a4081a300 -1 WARNING: all dangerous and experimental features are enabled.
2017-02-02 15:26:32.875297 7f8a4081a300 -1 WARNING: all dangerous and experimental features are enabled.
2017-02-02 15:26:32.969390 7f980ad29700 -1 WARNING: all dangerous and experimental features are enabled.
2017-02-02 15:26:32.992809 7f980ad29700 -1 WARNING: all dangerous and experimental features are enabled.
/home/jenkins-build/build/workspace/ceph-pull-requests/src/vstart.sh: 329: /home/jenkins-build/build/workspace/ceph-pull-requests/src/vstart.sh: /home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/ceph-mgr: not found

        Start  11: test_pidfile.sh
  4/160 Test   #5: cephtool-test-mon.sh ....................***Failed   14.31 sec

see https://jenkins.ceph.com/job/ceph-pull-requests/17881/consoleFull#12243436770189bba6-5c6e-4283-b974-1eceae3f5f28

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrm, i can't find where the 'tests' dependencies are defined...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ -z "$CEPH_NUM_FS" ] && CEPH_NUM_FS=1
[ -z "$CEPH_MAX_MDS" ] && CEPH_MAX_MDS=1
[ -z "$CEPH_NUM_RGW" ] && CEPH_NUM_RGW=1
[ -z "$CEPH_NUM_RGW" ] && CEPH_NUM_RGW=0

[ -z "$CEPH_DIR" ] && CEPH_DIR="$PWD"
[ -z "$CEPH_DEV_DIR" ] && CEPH_DEV_DIR="$CEPH_DIR/dev"
Expand All @@ -78,14 +78,13 @@ else
fi

extra_conf=""
new=0
new=1
standby=0
debug=0
start_all=1
start_mon=0
start_mds=0
start_osd=0
start_rgw=0
ip=""
nodaemon=0
smallmds=0
Expand Down Expand Up @@ -115,8 +114,8 @@ usage=$usage"\t-d, --debug\n"
usage=$usage"\t-s, --standby_mds: Generate standby-replay MDS for each active\n"
usage=$usage"\t-l, --localhost: use localhost instead of hostname\n"
usage=$usage"\t-i <ip>: bind to specific ip\n"
usage=$usage"\t-r start radosgw (needs ceph compiled with --radosgw)\n"
usage=$usage"\t-n, --new\n"
usage=$usage"\t-n, --new (default)\n"
usage=$usage"\t-N, --not-new: reuse existing cluster config\n"
usage=$usage"\t--valgrind[_{osd,mds,mon,rgw}] 'toolname args...'\n"
usage=$usage"\t--nodaemon: use ceph-run as wrapper for mon/osd/mds\n"
usage=$usage"\t--smallmds: limit mds cache size\n"
Expand Down Expand Up @@ -160,15 +159,15 @@ case $1 in
ip="$2"
shift
;;
-r )
start_rgw=1
;;
-e )
ec=1
;;
--new | -n )
new=1
;;
--not-new | -N )
new=0
;;
--short )
short=1
;;
Expand Down Expand Up @@ -291,6 +290,10 @@ esac
shift
done

if [ "$start_all" -eq 1 ]; then
$SUDO $INIT_CEPH stop
fi

if [ "$overwrite_conf" -eq 0 ]; then
MON=`$CEPH_BIN/ceph-conf -c $conf_fn --name $VSTART_SEC num_mon 2>/dev/null` && \
CEPH_NUM_MON="$MON"
Expand Down Expand Up @@ -423,9 +426,6 @@ fi
# sudo if btrfs
test -d $CEPH_DEV_DIR/osd0/. && test -e $CEPH_DEV_DIR/sudo && SUDO="sudo"

if [ "$start_all" -eq 1 ]; then
$SUDO $INIT_CEPH stop
fi
prun $SUDO rm -f core*

test -d $CEPH_OUT_DIR || mkdir $CEPH_OUT_DIR
Expand Down Expand Up @@ -791,7 +791,7 @@ if [ "$CEPH_NUM_MGR" -gt 0 ]; then

cat <<EOF >> $conf_fn
[mgr.$name]

host = $HOSTNAME
EOF

echo "Starting mgr.${name}"
Expand Down Expand Up @@ -888,9 +888,12 @@ do_rgw()

RGWSUDO=
[ $CEPH_RGW_PORT -lt 1024 ] && RGWSUDO=sudo
run 'rgw' $RGWSUDO $CEPH_BIN/radosgw -c $conf_fn --log-file=${CEPH_OUT_DIR}/rgw.log ${RGWDEBUG} --debug-ms=1
n=$(($CEPH_NUM_RGW - 1))
for rgw in `seq 0 $n`; do
run 'rgw' $RGWSUDO $CEPH_BIN/radosgw -c $conf_fn --log-file=${CEPH_OUT_DIR}/rgw.$rgw.log ${RGWDEBUG} --debug-ms=1
done
}
if [ "$start_rgw" -eq 1 ]; then
if [ "$CEPH_NUM_RGW" -gt 0 ]; then
do_rgw
fi

Expand Down