From bff35f0ef4d9fae10c8d79d282b1cbd8520b9ed6 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 22 Mar 2021 20:21:19 +0100 Subject: [PATCH] tools: run `vtysh -b` once for all-startup As noted by Donald: When FRR is starting all daemons (or restarting them all) FRR is reading in the configuration 1 time for each daemon specified to run. This is not a big deal if you have a very small configuration. But with large configurations FRR is taking long enough that watchfrr is not establishing connection to all the daemons and starting some over. Modify the code so that vtysh is only read in at the end of a all sequence. If we are restarting an individual daemon allow the read in of the whole config. Reported-by: Donald Sharp Signed-off-by: David Lamparter --- tools/frrcommon.sh.in | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/frrcommon.sh.in b/tools/frrcommon.sh.in index 9a144b2b06..3f7e784ed8 100644 --- a/tools/frrcommon.sh.in +++ b/tools/frrcommon.sh.in @@ -146,6 +146,10 @@ daemon_prep() { daemon_start() { local dmninst daemon inst args instopt wrap bin + + all=false + [ "$1" = "--all" ] && { all=true; shift; } + daemon_inst "$1" ulimit -n $MAX_FDS > /dev/null 2> /dev/null @@ -162,7 +166,11 @@ daemon_start() { if eval "$all_wrap $wrap $bin $nsopt -d $frr_global_options $instopt $args"; then log_success_msg "Started $dmninst" - vtysh_b "$daemon" + if $all; then + debug "Skipping startup of vtysh until all have started" + else + vtysh_b "$daemon" + fi else log_failure_msg "Failed to start $dmninst!" fi @@ -234,8 +242,9 @@ print_status() { all_start() { daemon_list daemons for dmninst in $daemons; do - daemon_start "$dmninst" + daemon_start --all "$dmninst" done + vtysh_b } all_stop() { -- 2.39.5