-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[VOQ][saidump] Install rdbtools into the docker base related containers. #16466
Changes from 3 commits
af63bf5
c8f5996
1a414d5
f2215ec
65fc011
aaac734
add5b59
af75a3c
a4fc033
8640e46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
function debug() | ||
{ | ||
/usr/bin/logger "$1" | ||
} | ||
|
||
save_saidump_by_rdb() { | ||
DEV=$1 # ASIC index to operate on | ||
|
||
if [ "$DEV" ]; then | ||
debug "saidump.sh: [1] sonic-db-cli -n asic$DEV SAVE." | ||
sonic-db-cli -n asic$DEV SAVE > /dev/null | ||
else | ||
debug "saidump.sh: [1] sonic-db-cli SAVE." | ||
sonic-db-cli SAVE > /dev/null | ||
fi | ||
|
||
debug "saidump.sh: [2] Move dump.rdb to /var/run/redis$DEV/ in container database$DEV." | ||
docker exec database$DEV sh -c "mv /var/lib/redis/dump.rdb /var/run/redis$DEV/" | ||
debug "saidump.sh: [3] Run rdb command to convert the dump files into JSON files." | ||
docker exec syncd$DEV sh -c "rdb --command json /var/run/redis$DEV/dump.rdb | tee /var/run/redis$DEV/dump.json > /dev/null" | ||
debug "saidump.sh: [4] Run saidump -r to update the JSON files' format as same as the saidump before. Then we can get the saidump's result in standard output." | ||
docker exec syncd$DEV sh -c "saidump -r /var/run/redis$DEV/dump.json -m 100" | ||
debug "saidump.sh: [5] Clear temporary files." | ||
sudo rm -f /var/run/redis$DEV/dump.rdb | ||
sudo rm -f /var/run/redis$DEV/dump.json | ||
} | ||
|
||
NUM_ASICS=`python -c 'from sonic_py_common.multi_asic import get_num_asics; print(get_num_asics())'` | ||
|
||
if (( $# == 0 && $NUM_ASICS == 1 )); then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The command "show techsupport" calls "sudo generate_dump -v -t 5".
So, finally, remove all sudo for concise. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @arlakshm , please review, thanks. |
||
save_saidump_by_rdb | ||
#validate if the argument is an integer | ||
elif [[ "$1" =~ [0-9]+ ]] && (( $# == 1 && $1 >= 0 && $1 < $NUM_ASICS )) ; then | ||
save_saidump_by_rdb $1 | ||
else | ||
echo "The number of ASICS is $NUM_ASICS." | ||
echo "Usage:" | ||
echo "saidump.sh <ASIC Index> or NULL" | ||
echo " <ASIC Index> should be 0 ~ NUM_ASICS." | ||
echo " E.g. \"saidump.sh 1\" is OK when NUMASICS is 2." | ||
echo " NULL" | ||
echo " E.g. \"saidump.sh\" is OK when NUMASICS is 1." | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move this file to syncd/scripts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Lguohan, there is an issue that's hard for putting saidump.sh in the syncd docker. Because the below command is not available inside the syncd docker due to the isolation between docker containers. I.e., the dump.rdb generated by the Redis save is invisible in the syncd container. So, one reasonable solution is to be leaving it in the host. The host has access to operate the dump.rdb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lguohan , please help to review it again. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the explanation. I feel we should still move this saidump.sh to syncd docker, to address the problem you listed, it is better to mount a shared folder between database docker and syncd docker, so that you can see the rdb file in syncd docker once dumped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your comments! I will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i should have be more clear. when i say syncd docker, i really means sairedis repo, so that saidump.sh will be part of the sairedis package.