Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[show_tech] modify generate_dump to includes BERT data and also the platform specified hw-mgmt info #3676

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,42 @@ save_proc() {
chmod ugo+rw -R $DUMPDIR/$BASE/proc
}

###############################################################################
# Given list of proc files, saves proc files to tar.
# Globals:
# V
# TARDIR
# MKDIR
# CP
# DUMPDIR
# TAR
# RM
# BASE
# TARFILE
# NOOP
# Arguments:
# *procfiles: variable-length list of proc file paths to save
# Returns:
# None
###############################################################################
save_proc() {
trap 'handle_error $? $LINENO' ERR
local procfiles="$@"
$MKDIR $V -p $TARDIR/proc
for f in $procfiles
do
if $NOOP; then
if [ -e $f ]; then
echo "$CP $V -r $f $TARDIR/proc"
fi
else
( [ -e $f ] && $CP $V -r $f $TARDIR/proc ) || echo "$f not found" > $TARDIR/$f
fi
done

chmod ugo+rw -R $DUMPDIR/$BASE/proc
}

###############################################################################
# Dump io stats for processes
# Globals:
Expand Down Expand Up @@ -1454,6 +1490,7 @@ collect_marvell() {
###############################################################################
collect_broadcom() {
trap 'handle_error $? $LINENO' ERR
local timeout_cmd="timeout --foreground ${TIMEOUT_MIN}m"
local platform=$(show platform summary --json | python -c 'import sys, json; \
print(json.load(sys.stdin)["platform"])')
local hwsku=$(show platform summary --json | python -c 'import sys, json; \
Expand Down Expand Up @@ -1582,6 +1619,25 @@ collect_broadcom() {

copy_from_masic_docker "syncd" "/var/log/diagrun.log" "/var/log/diagrun.log"
copy_from_masic_docker "syncd" "/var/log/bcm_diag_post" "/var/log/bcm_diag_post"

# run 'hw-management-generate-dump.sh' script and save the result file
HW_DUMP_FILE=/usr/bin/hw-management-generate-dump.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should also cleanup the duplicate code in vendor specific functions, otherwise it will cause duplicate execution and increase run time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore, looks like being done only for broadcom.
Should we move it to common code?
The code gets executed only when vendor provide the executable.

if [ -f "$HW_DUMP_FILE" ]; then
${CMD_PREFIX}${timeout_cmd} /usr/bin/hw-management-generate-dump.sh $ALLOW_PROCESS_STOP
ret=$?
if [ $ret -ne 0 ]; then
if [ $ret -eq $TIMEOUT_EXIT_CODE ]; then
echo "hw-management dump timedout after ${TIMEOUT_MIN} minutes."
else
echo "hw-management dump failed ..."
fi
else
save_file "/tmp/hw-mgmt-dump*" "hw-mgmt" false
rm -f /tmp/hw-mgmt-dump*
fi
else
echo "HW Mgmt dump script $HW_DUMP_FILE does not exist"
fi
}

###############################################################################
Expand Down Expand Up @@ -1790,6 +1846,12 @@ save_log_files() {
file_list="${file_list} ${file_list_2}"
fi

# save log files creation info
files_ts_info=/tmp/files.timestamp.info
ls --time-style='+%d-%m-%Y %H:%M:%S' -last /var/log/* > $files_ts_info
save_file $files_ts_info "log" true
rm -f $files_ts_info

# gzip up all log files individually before placing them in the incremental tarball
for file in $file_list; do
dest_dir="log"
Expand Down Expand Up @@ -2056,6 +2118,11 @@ main() {
echo "[ Capture Proc State ] : $(($end_t-$start_t)) msec" >> $TECHSUPPORT_TIME_INFO
wait

# capture /sys info - include acpi info
save_sys /sys/firmware/acpi/tables &
end_t2=$(date +%s%3N)
echo "[ Capture Sys info ] : $(($end_t2-$end_t)) msec" >> $TECHSUPPORT_TIME_INFO

# Save all the processes within each docker
save_cmd "show services" services.summary &

Expand Down
Loading