sonic-buildimage icon indicating copy to clipboard operation
sonic-buildimage copied to clipboard

Add support for platform topology configuration service

Open anamehra opened this issue 3 years ago • 2 comments

This service invokes the platform plugin for platform specific topology
configuration.
The path for platform plugin script is:
/usr/share/sonic/device/$PLATFORM/plugins/config-topology.sh
If the platform plugin is not available, this service does nothing.

Signed-off-by: anamehra [email protected]

Why I did it

For the chassis, the platform requires to generate the chassis topology from the available inventory. Based on the inventory config files for the platform and ASICs are generated. Some configs are global as well as ASIC specific. This needs to be done on both RP and LC and requires the availability of database-chassis and database services. Adding this systemd dependency in platform side service unit files causes first boot issues as the database service is not known when rc.local starts the platform service. Secondly, sonic-systemd-generator generates the dependency on multi-instance services during boot based on num_asics and for that Sonic systemd generator needs to know about the platform services. For example, if a service defines: After=database.service sonic systemd generator creates the dependency for the global database and all namespace database instances After=database.service [email protected] [email protected]

This is not possible if the service is added as a platform-side service.

How I did it

Added a common service that defines the dependency on Sonic build side to handle the above limitations. The service calls a platform plugin, if present. If the platform plugin is not available, the service exits as successful and will do nothing for the platform.

How to verify it

  1. Load the image with changes.
  2. check systemctl status config-topology.service logs
  3. Validated that the services starts after database services and before config-setup service.

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

  • [ ] 201811
  • [ ] 201911
  • [ ] 202006
  • [ ] 202012
  • [ ] 202106
  • [ ] 202111
  • [x] 202205

Description for the changelog

Link to config_db schema for YANG module changes

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

anamehra avatar Sep 13 '22 23:09 anamehra

Hi @abdosi , FYI-

anamehra avatar Sep 13 '22 23:09 anamehra

Can we elaborate the advantage/reason of adding this? Thanks.

rlhui avatar Nov 02 '22 18:11 rlhui

Can we elaborate the advantage/reason of adding this? Thanks.

@anamehra , reminder on this, thanks

rlhui avatar Nov 23 '22 00:11 rlhui

@anamehra - all tests are failing

rlhui avatar Nov 23 '22 00:11 rlhui

Can we elaborate the advantage/reason of adding this? Thanks.

@anamehra , reminder on this, thanks

Hi @rlhui , I added more details after the chassis group discussion.

anamehra avatar Nov 23 '22 00:11 anamehra

@abdosi , the logs from the build are lost, could you please rerun the checks?

anamehra avatar Nov 23 '22 00:11 anamehra

/azp run Azure.sonic-buildimage

abdosi avatar Nov 30 '22 01:11 abdosi

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Nov 30 '22 01:11 azure-pipelines[bot]

Hi @SuvarnaMeenakshi , I have added explicit dependency in config-setup.service to prevent application service s from starting when config-topology fails. Please review.

anamehra avatar Jan 11 '23 22:01 anamehra

@SuvarnaMeenakshi can you please review and sign-off for this PR ? There is some fix in systemd-generator also.

abdosi avatar Jan 19 '23 21:01 abdosi

@SuvarnaMeenakshi can you please review again

abdosi avatar Jan 31 '23 19:01 abdosi

Cherry-pick PR to 202205: https://github.com/sonic-net/sonic-buildimage/pull/13605

mssonicbld avatar Feb 02 '23 19:02 mssonicbld

@anamehra @rlhui why is this change not needed for 202211 branch?

yxieca avatar Feb 02 '23 19:02 yxieca