From 9f5d725734040768923ace742811b6815ea3d965 Mon Sep 17 00:00:00 2001 From: Deepika Upadhyay Date: Mon, 10 Aug 2020 17:28:19 +0530 Subject: [PATCH] vstart: add jaeger option + misc refactoring Signed-off-by: Deepika Upadhyay --- src/vstart.sh | 130 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 87 insertions(+), 43 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index aceb72a32770..f8a351799f5b 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -166,6 +166,7 @@ lockdep=${LOCKDEP:-1} spdk_enabled=0 #disable SPDK by default zoned_enabled=0 io_uring_enabled=0 +with_jaeger=0 with_mgr_dashboard=true if [[ "$(get_cmake_variable WITH_MGR_DASHBOARD_FRONTEND)" != "ON" ]] || @@ -236,6 +237,7 @@ usage=$usage"\t--bluestore-io-uring: enable io_uring backend\n" usage=$usage"\t--inc-osd: append some more osds into existing vcluster\n" usage=$usage"\t--cephadm: enable cephadm orchestrator with ~/.ssh/id_rsa[.pub]\n" usage=$usage"\t--no-parallel: dont start all OSDs in parallel\n" +usage=$usage"\t--jaeger: use jaegertracing for tracing\n" usage_exit() { printf "$usage" @@ -244,27 +246,27 @@ usage_exit() { while [ $# -ge 1 ]; do case $1 in - -d | --debug ) + -d | --debug) debug=1 ;; -s | --standby_mds) standby=1 ;; - -l | --localhost ) + -l | --localhost) ip="127.0.0.1" ;; - -i ) + -i) [ -z "$2" ] && usage_exit ip="$2" shift ;; - -e ) + -e) ec=1 ;; - --new | -n ) + --new | -n) new=1 ;; - --inc-osd ) + --inc-osd) new=0 kill_all=0 inc_osd_num=$2 @@ -274,103 +276,103 @@ case $1 in shift fi ;; - --short ) + --short) short=1 ;; - --crimson ) + --crimson) ceph_osd=crimson-osd ;; - --osd-args ) + --osd-args) extra_osd_args="$2" shift ;; - --msgr1 ) + --msgr1) msgr="1" ;; - --msgr2 ) + --msgr2) msgr="2" ;; - --msgr21 ) + --msgr21) msgr="21" ;; - --cephadm ) + --cephadm) cephadm=1 ;; - --no-parallel ) + --no-parallel) parallel=false ;; - --valgrind ) + --valgrind) [ -z "$2" ] && usage_exit valgrind=$2 shift ;; - --valgrind_args ) + --valgrind_args) valgrind_args="$2" shift ;; - --valgrind_mds ) + --valgrind_mds) [ -z "$2" ] && usage_exit valgrind_mds=$2 shift ;; - --valgrind_osd ) + --valgrind_osd) [ -z "$2" ] && usage_exit valgrind_osd=$2 shift ;; - --valgrind_mon ) + --valgrind_mon) [ -z "$2" ] && usage_exit valgrind_mon=$2 shift ;; - --valgrind_mgr ) + --valgrind_mgr) [ -z "$2" ] && usage_exit valgrind_mgr=$2 shift ;; - --valgrind_rgw ) + --valgrind_rgw) [ -z "$2" ] && usage_exit valgrind_rgw=$2 shift ;; - --nodaemon ) + --nodaemon) nodaemon=1 ;; --redirect-output) redirect=1 ;; - --smallmds ) + --smallmds) smallmds=1 ;; - --rgw_port ) + --rgw_port) CEPH_RGW_PORT=$2 shift ;; - --rgw_frontend ) + --rgw_frontend) rgw_frontend=$2 shift ;; - --rgw_compression ) + --rgw_compression) rgw_compression=$2 shift ;; - --kstore_path ) + --kstore_path) kstore_path=$2 shift ;; - --filestore_path ) + --filestore_path) filestore_path=$2 shift ;; - -m ) + -m) [ -z "$2" ] && usage_exit MON_ADDR=$2 shift ;; - -x ) + -x) cephx=1 # this is on be default, flag exists for historical consistency ;; - -X ) + -X) cephx=0 ;; @@ -381,36 +383,35 @@ case $1 in gssapi_authx=0 ;; - -k ) + -k) if [ ! -r $conf_fn ]; then echo "cannot use old configuration: $conf_fn not readable." >&2 exit fi new=0 ;; - --memstore ) + --memstore) objectstore="memstore" ;; - -b | --bluestore ) + -b | --bluestore) objectstore="bluestore" ;; - -f | --filestore ) + -f | --filestore) objectstore="filestore" ;; - -K | --kstore ) + -K | --kstore) objectstore="kstore" ;; - --hitset ) + --hitset) hitset="$hitset $2 $3" shift shift ;; - -o ) - extra_conf="$extra_conf $2 -" + -o) + extra_conf="$extra_conf $2" shift ;; - --cache ) + --cache) if [ -z "$cache" ]; then cache="$2" else @@ -418,7 +419,7 @@ case $1 in fi shift ;; - --nolockdep ) + --nolockdep) lockdep=0 ;; --multimds) @@ -449,8 +450,13 @@ case $1 in ;; --bluestore-io-uring) io_uring_enabled=1 + shift + ;; + --jaeger) + with_jaeger=1 + echo "with_jaeger $with_jaeger" ;; - * ) + *) usage_exit esac shift @@ -1552,6 +1558,44 @@ if [ "$CEPH_NUM_RGW" -gt 0 ]; then do_rgw fi + + docker_service(){ + local service='' + #prefer podman + if pgrep -f podman > /dev/null; then + service="podman" + elif pgrep -f docker > /dev/null; then + service="docker" + fi + if [ -n "$service" ]; then + echo "using $service for deploying jaeger..." + #check for exited container, remove them and restart container + if [ "$($service ps -aq -f status=exited -f name=jaeger)" ]; then + $service rm jaeger + fi + if [ ! "$(podman ps -aq -f name=jaeger)" ]; then + $service "$@" + fi + else + echo "cannot find docker or podman, please restart service and rerun." + fi + } + +echo "" +if [ $with_jaeger -eq 1 ]; then + debug echo "Enabling jaegertracing..." + docker_service run -d --name jaeger \ + -p 5775:5775/udp \ + -p 6831:6831/udp \ + -p 6832:6832/udp \ + -p 5778:5778 \ + -p 16686:16686 \ + -p 14268:14268 \ + -p 14250:14250 \ + jaegertracing/all-in-one:1.20 +fi + + debug echo "vstart cluster complete. Use stop.sh to stop. See out/* (e.g. 'tail -f out/????') for debug output." echo "" -- 2.47.3