From ef82f00a39283bd87b1d1045b508a705d54dbf2f Mon Sep 17 00:00:00 2001 From: Neetha John Date: Wed, 24 Nov 2021 10:04:52 -0800 Subject: [PATCH] [load_minigraph] Delay pfcwd start until the buffer templates are rendered (#1937) Signed-off-by: Neetha John Fixes Azure/sonic-buildimage#9292 What I did Pfcwd was not getting started after executing load_minigraph after the changes done in #1508. This was because the PORT_QOS_MAP table is not yet present in config db (this gets populated only after the buffer templates are rendered) at the time we try to start pfcwd and hence the 'pfc_enable' field will always be empty and we skip writing PFC_WD table entries to config db. How I did it Delay pfcwd start until the buffer templates are rendered How to verify it Issue "config load_minigraph" with the changes and ensure that pfcwd is started on all active ports --- config/main.py | 10 +++++----- tests/config_test.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/main.py b/config/main.py index b9d560bdfe93..9d804b47d597 100644 --- a/config/main.py +++ b/config/main.py @@ -1515,11 +1515,6 @@ def load_minigraph(db, no_service_restart): clicommon.run_command(command, display_cmd=True) client.set(config_db.INIT_INDICATOR, 1) - # get the device type - device_type = _get_device_type() - if device_type != 'MgmtToRRouter' and device_type != 'MgmtTsToR' and device_type != 'EPMS': - clicommon.run_command("pfcwd start_default", display_cmd=True) - # Update SONiC environmnet file update_sonic_environment() @@ -1535,6 +1530,11 @@ def load_minigraph(db, no_service_restart): # generate QoS and Buffer configs clicommon.run_command("config qos reload --no-dynamic-buffer", display_cmd=True) + # get the device type + device_type = _get_device_type() + if device_type != 'MgmtToRRouter' and device_type != 'MgmtTsToR' and device_type != 'EPMS': + clicommon.run_command("pfcwd start_default", display_cmd=True) + # Write latest db version string into db db_migrator='/usr/local/bin/db_migrator.py' if os.path.isfile(db_migrator) and os.access(db_migrator, os.X_OK): diff --git a/tests/config_test.py b/tests/config_test.py index 9ea891687e27..28cea8c519b2 100644 --- a/tests/config_test.py +++ b/tests/config_test.py @@ -21,8 +21,8 @@ load_minigraph_command_output="""\ Stopping SONiC target ... Running command: /usr/local/bin/sonic-cfggen -H -m --write-to-db -Running command: pfcwd start_default Running command: config qos reload --no-dynamic-buffer +Running command: pfcwd start_default Restarting SONiC target ... Reloading Monit configuration ... Please note setting loaded from minigraph will be lost after system reboot. To preserve setting, run `config save`.