Skip to content

Commit 26e700a

Browse files
authored
[debug dump util] Techsupport addition (#1669)
What I did HLD for Dump Utility: HLD. For More info on Tech Support Addition: TechSupport How I did it Module Names are retrieved by parsing the output of dump state --show command.
1 parent 9f2326e commit 26e700a

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

scripts/generate_dump

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ HOME=${HOME:-/root}
3838
USER=${USER:-root}
3939
TIMEOUT_MIN="5"
4040
SKIP_BCMCMD=0
41+
DEBUG_DUMP=false
4142

4243
handle_signal()
4344
{
@@ -1018,6 +1019,31 @@ save_counter_snapshot() {
10181019
save_cmd_all_ns "ifconfig -a" "ifconfig.counters_$idx"
10191020
}
10201021

1022+
###############################################################################
1023+
# save the debug dump output
1024+
###############################################################################
1025+
save_dump_state_all_ns() {
1026+
MODULES="$(dump state -s | sed '1d;2d' | awk '{print $1}')"
1027+
local UVDUMP="unified_view_dump"
1028+
echo "DEBUG DUMP: Modules Available to Generate Debug Dump Output"
1029+
echo $MODULES
1030+
$MKDIR $V -p $LOGDIR/$UVDUMP
1031+
1032+
for addr in $MODULES;
1033+
do
1034+
save_cmd "dump state $addr all --key-map" "$UVDUMP/$addr"
1035+
if [[ ( "$NUM_ASICS" > 1 ) ]] ; then
1036+
for (( i=0; i<$NUM_ASICS; i++ ))
1037+
do
1038+
local cmd="dump state $addr all --key-map --namespace asic$i"
1039+
local file="$UVDUMP/$addr.asic$i"
1040+
save_cmd "$cmd" "$file"
1041+
done
1042+
fi
1043+
done
1044+
}
1045+
1046+
10211047
###############################################################################
10221048
# Main generate_dump routine
10231049
# Globals:
@@ -1130,6 +1156,11 @@ main() {
11301156
save_bfd_info
11311157
save_redis_info
11321158

1159+
if $DEBUG_DUMP
1160+
then
1161+
save_dump_state_all_ns
1162+
fi
1163+
11331164
save_cmd "docker ps -a" "docker.ps"
11341165
save_cmd "docker top pmon" "docker.pmon"
11351166

@@ -1265,11 +1296,13 @@ OPTIONS
12651296
"24 March", "yesterday", etc.
12661297
-t TIMEOUT_MINS
12671298
Command level timeout in minutes
1299+
-d
1300+
Collect the output of debug dump cli
12681301
12691302
EOF
12701303
}
12711304

1272-
while getopts ":xnvhzas:t:" opt; do
1305+
while getopts ":xnvhzas:t:d" opt; do
12731306
case $opt in
12741307
x)
12751308
# enable bash debugging
@@ -1311,6 +1344,9 @@ while getopts ":xnvhzas:t:" opt; do
13111344
t)
13121345
TIMEOUT_MIN="${OPTARG}"
13131346
;;
1347+
d)
1348+
DEBUG_DUMP=true
1349+
;;
13141350
/?)
13151351
echo "Invalid option: -$OPTARG" >&2
13161352
exit 1

show/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,8 @@ def users(verbose):
10661066
@click.option('--verbose', is_flag=True, help="Enable verbose output")
10671067
@click.option('--allow-process-stop', is_flag=True, help="Dump additional data which may require system interruption")
10681068
@click.option('--silent', is_flag=True, help="Run techsupport in silent mode")
1069-
def techsupport(since, global_timeout, cmd_timeout, verbose, allow_process_stop, silent):
1069+
@click.option('--debug-dump', is_flag=True, help="Collect Debug Dump Output")
1070+
def techsupport(since, global_timeout, cmd_timeout, verbose, allow_process_stop, silent, debug_dump):
10701071
"""Gather information for troubleshooting"""
10711072
cmd = "sudo timeout -s SIGTERM --foreground {}m".format(global_timeout)
10721073

@@ -1081,6 +1082,10 @@ def techsupport(since, global_timeout, cmd_timeout, verbose, allow_process_stop,
10811082

10821083
if since:
10831084
cmd += " -s '{}'".format(since)
1085+
1086+
if debug_dump:
1087+
cmd += " -d "
1088+
10841089
cmd += " -t {}".format(cmd_timeout)
10851090
run_command(cmd, display_cmd=verbose)
10861091

0 commit comments

Comments
 (0)