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

[Multi Asic] support of swss.rec and sairedis.rec for multi asic #6310

Merged
merged 4 commits into from
Jan 22, 2021

Conversation

arlakshm
Copy link
Contributor

@arlakshm arlakshm commented Dec 28, 2020

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan [email protected]

- Why I did it
This PR has the changes to support having different swss.rec and sairedis.rec for each asic.
The logrotate script is updated as well

- How I did it

- How to verify it
The following tests are done to verify
Verification logs multi asic

  • Check the record files are created
 admin@sonic:/var/log/swss$ ls -l
total 29532
-rw-r--r-- 1 root root 4497346 Dec 29 23:12 sairedis.asic0.rec
-rw-r--r-- 1 root root 3236040 Dec 29 23:12 sairedis.asic1.rec
-rw-r--r-- 1 root root 1938290 Dec 29 23:12 sairedis.asic2.rec
-rw-r--r-- 1 root root 2009720 Dec 29 23:12 sairedis.asic3.rec
-rw-r--r-- 1 root root 3089764 Dec 29 23:12 sairedis.asic4.rec
-rw-r--r-- 1 root root 3090256 Dec 29 23:12 sairedis.asic5.rec
-rw-r--r-- 1 root root 2746843 Dec 29 23:12 swss.asic0.rec
-rw-r--r-- 1 root root 1813896 Dec 29 23:12 swss.asic1.rec
-rw-r--r-- 1 root root 2110988 Dec 29 23:12 swss.asic2.rec
-rw-r--r-- 1 root root 2148698 Dec 29 23:12 swss.asic3.rec
-rw-r--r-- 1 root root 1766758 Dec 29 23:12 swss.asic4.rec
-rw-r--r-- 1 root root 1766644 Dec 29 23:12 swss.asic5.rec
  • logrotate manually
    admin@sonic:/var/log/swss$ sudo /usr/sbin/logrotate /etc/logrotate.conf /dev/null 2>&1

  • Verify the files are rotated

admin@sonic:/var/log/swss$ ls -l
total 29544
-rw-r--r-- 1 root root       0 Dec 29 23:13 sairedis.asic0.rec
-rw-r--r-- 1 root root 4497346 Dec 29 23:12 sairedis.asic0.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 sairedis.asic1.rec
-rw-r--r-- 1 root root 3236040 Dec 29 23:12 sairedis.asic1.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 sairedis.asic2.rec
-rw-r--r-- 1 root root 1938290 Dec 29 23:12 sairedis.asic2.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 sairedis.asic3.rec
-rw-r--r-- 1 root root 2009720 Dec 29 23:12 sairedis.asic3.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 sairedis.asic4.rec
-rw-r--r-- 1 root root 3089764 Dec 29 23:12 sairedis.asic4.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 sairedis.asic5.rec
-rw-r--r-- 1 root root 3090256 Dec 29 23:12 sairedis.asic5.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 swss.asic0.rec
-rw-r--r-- 1 root root 2746843 Dec 29 23:12 swss.asic0.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 swss.asic1.rec
-rw-r--r-- 1 root root 1813896 Dec 29 23:12 swss.asic1.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 swss.asic2.rec
-rw-r--r-- 1 root root 2110988 Dec 29 23:12 swss.asic2.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 swss.asic3.rec
-rw-r--r-- 1 root root 2148698 Dec 29 23:12 swss.asic3.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 swss.asic4.rec
-rw-r--r-- 1 root root 1766758 Dec 29 23:12 swss.asic4.rec.1
-rw-r--r-- 1 root root       0 Dec 29 23:13 swss.asic5.rec
-rw-r--r-- 1 root root 1766644 Dec 29 23:12 swss.asic5.rec.1
  • Check the syslogs
admin@sonic:/var/log/swss$ sudo grep -i "Sending SIGHUP to OA" /var/log/syslog
Dec 29 23:13:14.409308 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:sairedis.asic0.rec
Dec 29 23:13:14.699731 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:sairedis.asic1.rec
Dec 29 23:13:14.988207 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:sairedis.asic2.rec
Dec 29 23:13:15.277998 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:sairedis.asic3.rec
Dec 29 23:13:15.572765 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:sairedis.asic4.rec
Dec 29 23:13:15.861483 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:sairedis.asic5.rec
Dec 29 23:13:16.149143 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:swss.asic0.rec
Dec 29 23:13:16.438341 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:swss.asic1.rec
Dec 29 23:13:16.729833 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:swss.asic2.rec
Dec 29 23:13:17.019212 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:swss.asic3.rec
Dec 29 23:13:17.317649 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:swss.asic4.rec
Dec 29 23:13:17.616700 sonic INFO logrotate: Sending SIGHUP to OA log_file_name:swss.asic5.rec

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <[email protected]>
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <[email protected]>
@arlakshm arlakshm marked this pull request as ready for review December 29, 2020 04:32
@arlakshm
Copy link
Contributor Author

retest vsimage please

/var/log/swss/sairedis.rec
/var/log/swss/swss.rec
/var/log/swss/sairedis.*.rec
/var/log/swss/swss.*.rec
Copy link
Collaborator

Choose a reason for hiding this comment

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

will this work for single asic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in the latest commit

pgrep -x orchagent | xargs /bin/kill -HUP 2>/dev/null || true
# for multi asic platforms, there are multiple orchagents
# send the SIGHUP only to the orchagent the which needs log file rotation
if [ $(pgrep -x orchagent | wc -l) -gt 0 ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

if somehow only one orchagent starts in the multi-asic platform, this logic could do wrong classification. why not use the num_asic variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there is only on orchagent, the else block will take care of sending SIGHUP to the orchagent.

I tried using the using the num_asic by sourcing the asic.conf file source doesn't seem to work in this logrotate script.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to use the asic.conf in the latest commit

if [ $(pgrep -x orchagent | wc -l) -gt 0 ]; then
log_file=$1
log_file_name=${log_file#/var/log/swss/}
pgrep -xa orchagent | grep $log_file_name | awk '{ print $1; }' | xargs /bin/kill -HUP 2>/dev/null || true
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does the pgrep -xa orchagent looks like on a multi-asic platform? can you provide output?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

admin@sonic:/var/log/swss$ pgrep -xa orchagent
11710 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 03:00.0 -f swss.asic0.rec -j sairedis.asic0.rec -m 00:be:75:3a:ef:50
12159 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 04:00.0 -f swss.asic1.rec -j sairedis.asic1.rec -m 00:be:75:3a:ef:50
12168 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 08:00.0 -f swss.asic4.rec -j sairedis.asic4.rec -m 02:42:f0:7f:01:06
12169 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 09:00.0 -f swss.asic5.rec -j sairedis.asic5.rec -m 02:42:f0:7f:01:02
12205 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 05:00.0 -f swss.asic2.rec -j sairedis.asic2.rec -m 00:be:75:3a:ef:50
12236 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 06:00.0 -f swss.asic3.rec -j sairedis.asic3.rec -m 00:be:75:3a:ef:50

@arlakshm
Copy link
Contributor Author

Verification logs Single Asic

  • check record files are created
admin@vlab-01:/var/log/swss$ ls -l
total 8016
-rw-r--r-- 1 root root 4144152 Dec 29 22:59 sairedis.rec
-rw-r--r-- 1 root root 4061342 Dec 29 22:59 swss.rec
  • logrotate manually
    admin@vlab-01:/var/log/swss$ /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&1
  • check logfiles are rotated
admin@vlab-01:/var/log/swss$ ls -l
total 8020
-rw-r--r-- 1 root root       0 Dec 29 23:00 sairedis.rec
-rw-r--r-- 1 root root 4144152 Dec 29 22:59 sairedis.rec.1
-rw-r--r-- 1 root root    1328 Dec 29 23:00 swss.rec
-rw-r--r-- 1 root root 4061424 Dec 29 23:00 swss.rec.1
  • check syslog
  admin@vlab-01:/var/log/swss$ sudo grep -i "Sending SIGHUP to OA" /var/log/syslog
Dec 29 23:00:01.429946 vlab-01 INFO logrotate: Sending SIGHUP to OA
Dec 29 23:00:01.479333 vlab-01 INFO logrotate: Sending SIGHUP to OA
admin@vlab-01:/var/log/swss$

logger -p syslog.info -t "logrotate" "Sending SIGHUP to OA log_file_name:$log_file_name"
pgrep -xa orchagent | grep $log_file_name | awk '{ print $1; }' | xargs /bin/kill -HUP 2>/dev/null || true
else
logger -p syslog.info -t "logrotate" "Sending SIGHUP to OA"
Copy link
Contributor

Choose a reason for hiding this comment

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

one minor comment i think for consistency if we can keep same syslog message format for both single and multi-asic.
Display file name for both.

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <[email protected]>
@arlakshm
Copy link
Contributor Author

retest

@arlakshm
Copy link
Contributor Author

retest this please

@arlakshm
Copy link
Contributor Author

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arlakshm arlakshm merged commit 0e12ca8 into sonic-net:master Jan 22, 2021
abdosi pushed a commit that referenced this pull request Jan 28, 2021
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan [email protected]

- Why I did it
This PR has the changes to support having different swss.rec and sairedis.rec for each asic.
The logrotate script is updated as well

- How I did it

Update the orchagent.sh script to use the logfile name options in these PRs(sonic-net/sonic-swss#1546 and sonic-net/sonic-sairedis#747)
In multi asic platforms the record files will be different for each asic, with the format swss.asic{x}.rec and sairedis.asic{x}.rec

Update the logrotate script for multiasic platform .
yxieca pushed a commit that referenced this pull request Feb 23, 2021
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan [email protected]

- Why I did it
This PR has the changes to support having different swss.rec and sairedis.rec for each asic.
The logrotate script is updated as well

- How I did it

Update the orchagent.sh script to use the logfile name options in these PRs(sonic-net/sonic-swss#1546 and sonic-net/sonic-sairedis#747)
In multi asic platforms the record files will be different for each asic, with the format swss.asic{x}.rec and sairedis.asic{x}.rec

Update the logrotate script for multiasic platform .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants