]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-debugpack: updates
authorSage Weil <sage@inktank.com>
Tue, 9 Oct 2012 21:10:48 +0000 (14:10 -0700)
committerSage Weil <sage@inktank.com>
Tue, 9 Oct 2012 21:13:57 +0000 (14:13 -0700)
- avoid copying data around; tar things directly into the tgz
- 'ceph report' instead of all the little bits
- unrotated logs only
- ensure target doesn't already exist

Signed-off-by: Sage Weil <sage@inktank.com>
doc/man/8/ceph-debugpack.rst
src/ceph-debugpack.in

index 6a6ff447bc1312d3dd892d923be5b94e2dfacd99..ecfafb1211feb003ca8fb941afe8587c99cbe3d2 100644 (file)
@@ -17,10 +17,10 @@ Description
 useful for debugging crashes. The resulting tarball can be shared with
 Ceph developers when debugging a problem.
 
-The tarball will include the binaries for ceph-mds, ceph-osd, and ceph-mon, any
+The tarball will include the binaries for ceph-mds, ceph-osd, and ceph-mon, radosgw, any
 log files, the ceph.conf configuration file, any core files we can
-find, and (if the system is running) dumps of the current osd, mds,
-and pg maps from the monitor.
+find, and (if the system is running) dumps of the current cluster state
+as reported by 'ceph report'.
 
 
 Options
index 7bcafbf4af2f609e3e2b41764b5d0abf1455ee2c..7be14e4429edcb8bb17247100d92dd66f8f381b0 100644 (file)
@@ -1,7 +1,5 @@
 #!/bin/sh
 
-
-
 # if we start up as ./init-ceph, assume everything else is in the
 # current directory too.
 if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
@@ -34,11 +32,9 @@ wait_pid_exit() {
        fi
 }
 
-
 . $LIBDIR/ceph_common.sh
 
-dest_tar=""
-
+dest_tar=''
 while [ $# -ge 1 ]; do
 case $1 in
     --conf | -c)
@@ -47,7 +43,7 @@ case $1 in
            conf=$1
            ;;
     *)
-           if [ "$dest_tar" != "" ]; then
+           if [ -n "$dest_tar" ]; then
                echo unrecognized option \'$1\'
                usage_exit
            fi
@@ -59,72 +55,59 @@ done
 
 [ "$dest_tar" = "" ] && usage_exit
 
-# get absolute path for dest_tar
-[ `echo $dest_tar | cut -c 1` != "/" ] && dest_tar="`pwd`/$dest_tar"
+echo "$0: generating debugpack tarball..."
+
+if [ -e $dest_tar ]; then
+    echo "$0: dest $dest_tar already exists, aborting"
+    exit 1
+fi
 
-bins="ceph-mon ceph-mds ceph-osd"
+# get absolute path for dest_tar
+bins="ceph-mon ceph-mds ceph-osd radosgw"
 core_paths="/ $BINDIR $BINDBGDIR"
 [ "$conf" = "" ] && conf=$ETCDIR/ceph.conf
 log_path=`$CCONF -c $conf "log dir"`
 
 [ -z "$conf" ] && usage_exit
 
-
-tmp_path=`mktemp -d /tmp/ceph-debugpack.XXXXXXXXXX`
-tmp_path_bin=$tmp_path/bin
-tmp_path_bin_dbg=$tmp_path/bin.dbg
-tmp_path_log=$tmp_path/out
-tmp_path_core=$tmp_path/core
-tmp_path_etc=$tmp_path/etc
-
-echo tmp_path=$tmp_path
-
-mkdir -p $tmp_path_bin
-mkdir -p $tmp_path_bin_dbg
-mkdir -p $tmp_path_log
-mkdir -p $tmp_path_core
-mkdir -p $tmp_path_etc
-
-
-#copy the binaries
-
-for name in $bins; do
-       [ -e $BINDIR/$name ] && cp $BINDIR/$name $tmp_path_bin
-       [ -e $BINDBGDIR/$name ] && cp $BINDBGDIR/$name $tmp_path_bin_dbg
+# all configs
+files='/etc/ceph'
+
+# binaries
+for bin in bins; do
+    if [ -e "/usr/bin/$bin" ]; then
+       files="$files /usr/bin/$bin"
+    fi
+    if [ -e "/usr/lib/debug/usr/bin/$bin" ]; then
+       files="$files /usr/lib/debug/usr/bin/$bin"
+    fi
 done
 
-
-# copy the logs
-cp -rp $log_path/* $tmp_path_log
+# logs (the non-rotated ones)
+for f in `find $path -maxdepth 1 -name 'core*'`; do
+    files="$files $f"
+done
 
 # copy cores (if exist)
-
 for path in $core_paths; do
-  files="`find $path -maxdepth 1 -name 'core*'`"
-  if [ "$files" != "" ]; then
-    for core_file in `ls $path/core*`; do
-      tmp_core=`mktemp $tmp_path_core/core.XXXX`
-      cp $core_file $tmp_core
-    done
-  fi
+    if [ -d $path ]; then
+        for f in `find $path -maxdepth 1 -name 'core*'`; do
+           files="$files $f"
+       done
+    fi
 done
 
-# copy config
-cp $conf $tmp_path_etc
+# cluster state
+tmp_path=`mktemp -d /tmp/ceph-debugpack.XXXXXXXXXX`
 
-# other output
-$BINDIR/ceph -s > $tmp_path_log/ceph-s &
-wait_pid_exit $!
-$BINDIR/ceph osd dump -o $tmp_path_log/ceph-osd-dump &
-wait_pid_exit $!
-$BINDIR/ceph mds dump -o $tmp_path_log/ceph-mds-dump &
-wait_pid_exit $!
-$BINDIR/ceph pg dump -o $tmp_path_log/ceph-pg-dump &
+$BINDIR/ceph report > $tmp_path/ceph-report &
 wait_pid_exit $!
 
+files="$files $tmp_path"
 
 # now create a tarball
-tmp_path_dir=`echo $tmp_path | cut -d / -f 3`
-tar cvfz $dest_tar -C /tmp $tmp_path_dir
-rm -fR $tmp_path
+tar cvfz $dest_tar $files
+rm -rf $tmp_path
+
+echo "$0: created debugpack tarball at $dest_tar"