@@ -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
}
@@ -1134,9 +1144,9 @@ collect_mellanox_dfw_dumps() {
1134
1144
${CMD_PREFIX} save_symlink ${file} sai_sdk_dump log
1135
1145
else
1136
1146
if [ ! -z " ${file##* .gz} " ]; then
1137
- ${CMD_PREFIX} save_file ${file} sai_sdk_dump true
1147
+ ${CMD_PREFIX} save_file ${file} sai_sdk_dump true true
1138
1148
else
1139
- ${CMD_PREFIX} save_file ${file} sai_sdk_dump false
1149
+ ${CMD_PREFIX} save_file ${file} sai_sdk_dump false true
1140
1150
fi
1141
1151
fi
1142
1152
done
@@ -1697,7 +1707,7 @@ main() {
1697
1707
$RM $V -rf $TARDIR /etc/alternatives $TARDIR /etc/passwd* \
1698
1708
$TARDIR /etc/shadow* $TARDIR /etc/group* $TARDIR /etc/gshadow* \
1699
1709
$TARDIR /etc/ssh* $TARDIR /etc/mlnx $TARDIR /etc/mft \
1700
- $TARDIR /etc/ssl/certs/ $TARDIR /etc/ssl/private/*
1710
+ $TARDIR /etc/ssl/certs/* $TARDIR /etc/ssl/private/*
1701
1711
rm_list=$( find -L $TARDIR -type f \( -iname \* .cer -o -iname \* .crt -o \
1702
1712
-iname \* .pem -o -iname \* .key -o -iname \* snmpd.conf\* -o -iname \* get_creds\* \) )
1703
1713
if [ ! -z " $rm_list " ]
@@ -1710,6 +1720,8 @@ main() {
1710
1720
save_warmboot_files &
1711
1721
wait
1712
1722
1723
+ save_to_tar
1724
+
1713
1725
if [[ " $asic " = " mellanox" ]]; then
1714
1726
collect_mellanox_dfw_dumps
1715
1727
fi
@@ -1722,9 +1734,7 @@ main() {
1722
1734
# ##############################################################################
1723
1735
finalize () {
1724
1736
# Save techsupport timing profile info
1725
- save_file $TECHSUPPORT_TIME_INFO log false
1726
-
1727
- save_to_tar
1737
+ save_file $TECHSUPPORT_TIME_INFO log false true
1728
1738
1729
1739
if $DO_COMPRESS ; then
1730
1740
RC=0
0 commit comments