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

[gearbox] Add peer gbsyncd for swss if gearbox exists #10504

Merged
merged 3 commits into from
Apr 20, 2022

Conversation

jimmyzhai
Copy link
Contributor

@jimmyzhai jimmyzhai commented Apr 8, 2022

Why I did it

Fix #10501
Fix #9733

If having gearbox, we need

  • add gbsyncd as a peer since swss also has dependency on gbsyncd
  • add service gbsyncd to FEATURE table if it is missing

How I did it

How to verify it

  • Kill orchagent
admin@DUT:~$ docker ps | grep -E 'swss|syncd'
29d108cf328e   docker-gbsyncd-credo:latest          "/usr/bin/docker-ini…"   5 days ago   Up 5 minutes             gbsyncd
0da3a5c5b6b9   docker-syncd-brcm-dnx:latest         "/usr/local/bin/supe…"   5 days ago   Up 5 minutes             syncd
f1e699d0c8fa   docker-orchagent:latest              "/usr/bin/docker-ini…"   5 days ago   Up 5 minutes             swss
admin@DUT:~$ sudo killall orchagent

### Services stopped soon
admin@DUT:~$ docker ps | grep -E 'swss|syncd'
admin@DUT:~$

### Services auto-restart after a while 
admin@DUT:~$ docker ps | grep -E 'swss|syncd'
29d108cf328e   docker-gbsyncd-credo:latest          "/usr/bin/docker-ini…"   5 days ago   Up 17 seconds             gbsyncd
0da3a5c5b6b9   docker-syncd-brcm-dnx:latest         "/usr/local/bin/supe…"   5 days ago   Up 19 seconds             syncd
f1e699d0c8fa   docker-orchagent:latest              "/usr/bin/docker-ini…"   5 days ago   Up 21 seconds             swss
  • Kill syncd
admin@DUT:~$ docker ps | grep -E 'swss|syncd'
29d108cf328e   docker-gbsyncd-credo:latest          "/usr/bin/docker-ini…"   5 days ago   Up 12 hours             gbsyncd
0da3a5c5b6b9   docker-syncd-brcm-dnx:latest         "/usr/local/bin/supe…"   5 days ago   Up 12 hours             syncd
f1e699d0c8fa   docker-orchagent:latest              "/usr/bin/docker-ini…"   5 days ago   Up 12 hours             swss
admin@DUT:~$ ps ax |grep '/usr/bin/syncd'    
  14654 ?        S      0:00 /bin/bash /usr/bin/syncd.sh wait
  15126 pts/0    Sl     0:00 /usr/bin/dsserve /usr/bin/syncd --diag -u -s -p /etc/sai.d/sai.profile -x /usr/share/sonic/hwsku/context_config.json -g 0 -b /tmp/break_before_make_objects
  15181 pts/0    Sl   1490:43 /usr/bin/syncd --diag -u -s -p /etc/sai.d/sai.profile -x /usr/share/sonic/hwsku/context_config.json -g 0 -b /tmp/break_before_make_objects
  15365 pts/0    Sl     5:59 /usr/bin/syncd -s -p /etc/sai.d/psai.profile -x /usr/share/sonic/hwsku/context_config.json -g 1
 342396 pts/0    S+     0:00 grep /usr/bin/syncdps ax
### Kill syncd
admin@DUT:~$ sudo kill 15181
admin@DUT:~$ docker ps | grep -E 'swss|syncd'
admin@DUT:~$
admin@DUT:~$ docker ps | grep -E 'swss|syncd'
29d108cf328e   docker-gbsyncd-credo:latest          "/usr/bin/docker-ini…"   5 days ago   Up 21 seconds             gbsyncd
0da3a5c5b6b9   docker-syncd-brcm-dnx:latest         "/usr/local/bin/supe…"   5 days ago   Up 24 seconds             syncd
f1e699d0c8fa   docker-orchagent:latest              "/usr/bin/docker-ini…"   5 days ago   Up 27 seconds             swss 
  • Kill gbsyncd
admin@str2-a7280cr3-4:~$ docker ps | grep -E 'swss|syncd'
29d108cf328e   docker-gbsyncd-credo:latest          "/usr/bin/docker-ini…"   5 days ago   Up 6 minutes             gbsyncd
0da3a5c5b6b9   docker-syncd-brcm-dnx:latest         "/usr/local/bin/supe…"   5 days ago   Up 6 minutes             syncd
f1e699d0c8fa   docker-orchagent:latest              "/usr/bin/docker-ini…"   5 days ago   Up 6 minutes             swss
admin@DUT:~$ ps ax |grep '/usr/bin/syncd'  
 346899 ?        S      0:00 /bin/bash /usr/bin/syncd.sh wait
 347462 pts/0    Sl     0:00 /usr/bin/dsserve /usr/bin/syncd --diag -u -s -p /etc/sai.d/sai.profile -x /usr/share/sonic/hwsku/context_config.json -g 0 -b /tmp/break_before_make_objects
 347498 pts/0    Sl    12:52 /usr/bin/syncd --diag -u -s -p /etc/sai.d/sai.profile -x /usr/share/sonic/hwsku/context_config.json -g 0 -b /tmp/break_before_make_objects
 347724 pts/0    Sl     0:15 /usr/bin/syncd -s -p /etc/sai.d/psai.profile -x /usr/share/sonic/hwsku/context_config.json -g 1
 356699 pts/0    S+     0:00 grep /usr/bin/syncd
### kill gbsyncd
admin@DUT:~$ sudo kill 347724
admin@DUT:~$ 
admin@DUT:~$ docker ps | grep -E 'swss|syncd'
admin@DUT:~$
admin@DUT:~$ docker ps | grep -E 'swss|syncd'
29d108cf328e   docker-gbsyncd-credo:latest          "/usr/bin/docker-ini…"   5 days ago   Up 48 seconds             gbsyncd
0da3a5c5b6b9   docker-syncd-brcm-dnx:latest         "/usr/local/bin/supe…"   5 days ago   Up 50 seconds             syncd
f1e699d0c8fa   docker-orchagent:latest              "/usr/bin/docker-ini…"   5 days ago   Up 52 seconds             swss

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

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

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

@jimmyzhai jimmyzhai requested a review from lguohan as a code owner April 8, 2022 06:51
abdosi
abdosi previously approved these changes Apr 8, 2022
@lguohan
Copy link
Collaborator

lguohan commented Apr 9, 2022

can you document how is this change tested?

@lguohan
Copy link
Collaborator

lguohan commented Apr 20, 2022

can you kill asic sync or gbsync and will all three docker restarted?

@jimmyzhai
Copy link
Contributor Author

can you kill asic sync or gbsync and will all three docker restarted?

Added tests for them

@jimmyzhai jimmyzhai merged commit 128d762 into sonic-net:master Apr 20, 2022
# Add gbsyncd to FEATURE table, if not in. It did have same config as syncd.
if [ -z $($SONIC_DB_CLI CONFIG_DB HGET 'FEATURE|gbsyncd' state) ]; then
local CMD="local r=redis.call('DUMP', KEYS[1]); redis.call('RESTORE', KEYS[2], 0, r)"
$SONIC_DB_CLI CONFIG_DB EVAL "$CMD" 2 'FEATURE|syncd' 'FEATURE|gbsyncd'
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @jimmyzhai , @abdosi ,
shouldn't sonic-db-cli here query the global feature list but not the namespace.
This code adds the feature in namespace but the global feature list does not have the gbsyncd entry.
This does not fix the container_checker requirement which looks into the global feature table.

Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Docker syncd/gbsyncd is per-namespace. Should we have syncd/gbsyncd entry at per-namespace feature table?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure which code use the per-namespace entry for features but container_checker script only looks into global namespace for feture state and generates the per-namespace instance name based on the feature name from a global list. So I think gbsyncd also needs to be added to global list.
"show feature state" list the feature from global space and I do not see any namespace option for this CLI.
@abdosi , please comment. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

Feature table entry is present both in global and namespace config db. Idea is the entry value will always be same and consistent across global and State DB.

When user enable/disable feature state using cli hostcfgd update value both global and namespace specific db's.
And when we do show commands we get the db value from global DB's and display them.

@jimmyzhai I agree with @anamehra can we update global Feature Table also when we are are doing for namespace so that table is consistent ?

Also with this change we will not need this #10834

cc @arlakshm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix gbsyncd and swss inter dependency Syslog error for Unexpected running containers: gbsyncd
4 participants