From 41bb18eb3c7bcf9a093eea2cec63ec7e96d98e22 Mon Sep 17 00:00:00 2001 From: Tamer Ahmed Date: Mon, 17 Aug 2020 15:48:04 -0700 Subject: [PATCH] [radv] Reduce Calls to SONiC Cfggen (#5178) Calls to sonic-cfggen is CPU expensive. This PR reduces calls to sonic-cfggen to one call during startup when starting radv service. singed-off-by: Tamer Ahmed --- dockers/docker-router-advertiser/docker-init.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dockers/docker-router-advertiser/docker-init.sh b/dockers/docker-router-advertiser/docker-init.sh index dbbc00d1f1ee..a38988186a94 100755 --- a/dockers/docker-router-advertiser/docker-init.sh +++ b/dockers/docker-router-advertiser/docker-init.sh @@ -1,13 +1,17 @@ #!/usr/bin/env bash mkdir -p /etc/supervisor/conf.d -sonic-cfggen -d -t /usr/share/sonic/templates/docker-router-advertiser.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf -# Generate /etc/radvd.conf config file -sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf +# Generate supervisord router advertiser config, /etc/radvd.conf config file, and +# the script that waits for pertinent interfaces to come up and make it executable +CFGGEN_PARAMS=" \ + -d \ + -t /usr/share/sonic/templates/docker-router-advertiser.supervisord.conf.j2,/etc/supervisor/conf.d/supervisord.conf \ + -t /usr/share/sonic/templates/radvd.conf.j2,/etc/radvd.conf \ + -t /usr/share/sonic/templates/wait_for_intf.sh.j2,/usr/bin/wait_for_intf.sh \ +" +sonic-cfggen $CFGGEN_PARAMS -# Generate the script that waits for pertinent interfaces to come up and make it executable -sonic-cfggen -d -t /usr/share/sonic/templates/wait_for_link.sh.j2 > /usr/bin/wait_for_link.sh -chmod +x /usr/bin/wait_for_link.sh +chmod +x /usr/bin/wait_for_intf.sh exec /usr/bin/supervisord