@@ -920,6 +920,7 @@ save_platform_info() {
920
920
# filename: the full path of the file to save
921
921
# base_dir: the directory in $TARDIR/ to stage the file
922
922
# do_gzip: (OPTIONAL) true or false. Should the output be gzipped
923
+ # do_tar_append: (OPTIONAL) true or false. Should the output be added to final tar archive
923
924
# Returns:
924
925
# None
925
926
# ##############################################################################
@@ -930,13 +931,16 @@ save_file() {
930
931
local orig_path=$1
931
932
local supp_dir=$2
932
933
local gz_path=" $TARDIR /$supp_dir /$( basename $orig_path ) "
934
+ local tar_path=" ${BASE} /$supp_dir /$( basename $orig_path ) "
933
935
local do_gzip=${3:- true}
936
+ local do_tar_append=${4:- false}
934
937
if [ ! -d " $TARDIR /$supp_dir " ]; then
935
938
$MKDIR $V -p " $TARDIR /$supp_dir "
936
939
fi
937
940
938
941
if $do_gzip ; then
939
942
gz_path=" ${gz_path} .gz"
943
+ tar_path=" ${tar_path} .gz"
940
944
if $NOOP ; then
941
945
echo " gzip -c $orig_path > $gz_path "
942
946
else
@@ -950,6 +954,12 @@ save_file() {
950
954
fi
951
955
fi
952
956
957
+ if $do_tar_append ; then
958
+ ($TAR $V -rhf $TARFILE -C $DUMPDIR " $tar_path " \
959
+ || abort " ${EXT_PROCFS_SAVE_FAILED} " " tar append operation failed. Aborting to prevent data loss." ) \
960
+ && $RM $V -f " $gz_path "
961
+ fi
962
+
953
963
end_t=$( date +%s%3N)
954
964
echo " [ save_file:$orig_path ] : $(( $end_t - $start_t )) msec" >> $TECHSUPPORT_TIME_INFO
955
965
}
@@ -1139,9 +1149,9 @@ collect_mellanox_dfw_dumps() {
1139
1149
${CMD_PREFIX} save_symlink ${file} sai_sdk_dump log
1140
1150
else
1141
1151
if [ ! -z " ${file##* .gz} " ]; then
1142
- ${CMD_PREFIX} save_file ${file} sai_sdk_dump true
1152
+ ${CMD_PREFIX} save_file ${file} sai_sdk_dump true true
1143
1153
else
1144
- ${CMD_PREFIX} save_file ${file} sai_sdk_dump false
1154
+ ${CMD_PREFIX} save_file ${file} sai_sdk_dump false true
1145
1155
fi
1146
1156
fi
1147
1157
done
@@ -1734,7 +1744,7 @@ main() {
1734
1744
$RM $V -rf $TARDIR /etc/alternatives $TARDIR /etc/passwd* \
1735
1745
$TARDIR /etc/shadow* $TARDIR /etc/group* $TARDIR /etc/gshadow* \
1736
1746
$TARDIR /etc/ssh* $TARDIR /etc/mlnx $TARDIR /etc/mft \
1737
- $TARDIR /etc/ssl/certs/ $TARDIR /etc/ssl/private/*
1747
+ $TARDIR /etc/ssl/certs/* $TARDIR /etc/ssl/private/*
1738
1748
rm_list=$( find -L $TARDIR -type f \( -iname \* .cer -o -iname \* .crt -o \
1739
1749
-iname \* .pem -o -iname \* .key -o -iname \* snmpd.conf\* -o -iname \* get_creds\* \) )
1740
1750
if [ ! -z " $rm_list " ]
@@ -1747,6 +1757,8 @@ main() {
1747
1757
save_warmboot_files &
1748
1758
wait
1749
1759
1760
+ save_to_tar
1761
+
1750
1762
save_sai_failure_dump
1751
1763
1752
1764
if [[ " $asic " = " mellanox" ]]; then
@@ -1761,9 +1773,7 @@ main() {
1761
1773
# ##############################################################################
1762
1774
finalize () {
1763
1775
# Save techsupport timing profile info
1764
- save_file $TECHSUPPORT_TIME_INFO log false
1765
-
1766
- save_to_tar
1776
+ save_file $TECHSUPPORT_TIME_INFO log false true
1767
1777
1768
1778
if $DO_COMPRESS ; then
1769
1779
RC=0
0 commit comments