Skip to content

Commit

Permalink
show tech with platform dump option (sonic-net#1158)
Browse files Browse the repository at this point in the history
- What I did
Add an option to force the hardware register dump with -f for show techsupport --allow-process-stop
- How I did it
Add an option '--allow-process-stop' to show techsupport cli command and '-a' to generate_dump script
- How to verify it
Perform show techsupport --allow-process-stop to collect extra hardware registers information which may require system interruption.
- Previous command output (if the output of a command-line utility has changed)
N/A
- New command output (if the output of a command-line utility has changed)
N/A
  • Loading branch information
sujinmkang authored Dec 15, 2020
1 parent 6255384 commit 6dd5d31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
11 changes: 9 additions & 2 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ MV=mv
GREP=grep
TOUCH=touch
V=
ALLOW_PROCESS_STOP=
NOOP=false
DO_COMPRESS=true
CMD_PREFIX=
Expand Down Expand Up @@ -763,7 +764,7 @@ main() {
# run 'hw-management-generate-dump.sh' script and save the result file
HW_DUMP_FILE=/usr/bin/hw-management-generate-dump.sh
if [ -f "$HW_DUMP_FILE" ]; then
/usr/bin/hw-management-generate-dump.sh
/usr/bin/hw-management-generate-dump.sh $ALLOW_PROCESS_STOP
save_file "/tmp/hw-mgmt-dump*" "hw-mgmt" false
rm -f /tmp/hw-mgmt-dump*
else
Expand Down Expand Up @@ -827,6 +828,9 @@ OPTIONS
passed to them
-n
Noop mode. Don't actually create anything, just echo what would happen
-a
Allow any process stop. This allows for collection of platform HW register
status, which may require potential system interruption
-z
Don't compress the tar at the end.
-s DATE
Expand All @@ -837,7 +841,7 @@ OPTIONS
EOF
}

while getopts ":xnvhzs:" opt; do
while getopts ":xnvhzsa:" opt; do
case $opt in
x)
# enable bash debugging
Expand Down Expand Up @@ -868,6 +872,9 @@ while getopts ":xnvhzs:" opt; do
z)
DO_COMPRESS=false
;;
a)
ALLOW_PROCESS_STOP="-a"
;;
s)
SINCE_DATE="${OPTARG}"
# validate date expression
Expand Down
7 changes: 6 additions & 1 deletion show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,11 +1128,16 @@ def users(verbose):
@cli.command()
@click.option('--since', required=False, help="Collect logs and core files since given date")
@click.option('--verbose', is_flag=True, help="Enable verbose output")
def techsupport(since, verbose):
@click.option('--allow-process-stop', is_flag=True, help="Dump additional data which may require system interruption")
def techsupport(since, verbose, allow_process_stop):
"""Gather information for troubleshooting"""
cmd = "sudo generate_dump -v"
if allow_process_stop:
cmd += " -a"

if since:
cmd += " -s {}".format(since)

run_command(cmd, display_cmd=verbose)


Expand Down

0 comments on commit 6dd5d31

Please sign in to comment.