summaryrefslogtreecommitdiff
path: root/src/multi-dump.sh
diff options
context:
space:
mode:
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>2010-11-18 21:13:02 -0800
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>2010-11-18 21:13:02 -0800
commitb91e14e12270b647687edc4da9a67abce8e12efb (patch)
tree898a88b3309426ec67d13f800a74c70f2714fbbe /src/multi-dump.sh
parent9cab522e71d003b328bb3ce2fd0698f52fb8f91f (diff)
downloadceph-b91e14e12270b647687edc4da9a67abce8e12efb.tar.gz
multi-dump.sh: add diff mode
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
Diffstat (limited to 'src/multi-dump.sh')
-rwxr-xr-xsrc/multi-dump.sh32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/multi-dump.sh b/src/multi-dump.sh
index f3cf67e706d..751d059b812 100755
--- a/src/multi-dump.sh
+++ b/src/multi-dump.sh
@@ -11,10 +11,12 @@ usage() {
echo <<EOF
multi-dump.sh: dumps out ceph maps
+-D Enable diff-mode
-e <start-epoch> What epoch to end with.
-h This help message
-s <start-epoch> What epoch to start with. Defaults to 1.
--t <osdmap> What type of map to dump. Defaults to osdmap.
+-t <map-type> What type of map to dump. Defaults to osdmap.
+ Valid map types are: osdmap,
EOF
}
@@ -32,11 +34,24 @@ dump_osdmap() {
./ceph osd getmap $v -o $TEMPDIR/$v >> $TEMPDIR/cephtool-out \
|| die "cephtool failed to dump epoch $v"
done
- for v in `seq $START_EPOCH $END_EPOCH`; do
- echo "************** $v **************"
- ./osdmaptool --print $TEMPDIR/$v \
- || die "osdmaptool failed to print epoch $v"
- done
+ if [ $DIFFMODE -eq 1 ]; then
+ for v in `seq $START_EPOCH $END_EPOCH`; do
+ ./osdmaptool --print $TEMPDIR/$v > $TEMPDIR/$v.out
+ done
+ cat $TEMPDIR/$START_EPOCH.out
+ E=$((END_EPOCH-1))
+ for v in `seq $START_EPOCH $E`; do
+ S=$((v+1))
+ echo "************** $S **************"
+ diff $TEMPDIR/$v.out $TEMPDIR/$S.out
+ done
+ else
+ for v in `seq $START_EPOCH $END_EPOCH`; do
+ echo "************** $v **************"
+ ./osdmaptool --print $TEMPDIR/$v \
+ || die "osdmaptool failed to print epoch $v"
+ done
+ fi
}
### Setup
@@ -48,11 +63,14 @@ MAP_TYPE=osdmap
cd $MYDIR
### Parse arguments
+DIFFMODE=0
START_EPOCH=1
END_EPOCH=0
-while getopts "e:hs:t:" flag; do
+while getopts "De:hs:t:" flag; do
case $flag in
+ D) DIFFMODE=1;;
+
e) END_EPOCH=$OPTARG;;
h) usage