From e4a5e4ce1c3f55600ca3e6bcbffbd4bcaef4cbe6 Mon Sep 17 00:00:00 2001 From: Neetha John Date: Thu, 7 Nov 2019 13:26:22 -0800 Subject: [PATCH] Do not start pfcwd for M0 devices (#726) * Do not start pfcwd for M0 devices Signed-off-by: Neetha John * Avoid exiting for device type error Signed-off-by: Neetha John --- config/main.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/config/main.py b/config/main.py index 953bf65a9b97..98481e37b873 100755 --- a/config/main.py +++ b/config/main.py @@ -527,6 +527,16 @@ def load_minigraph(): """Reconfigure based on minigraph.""" log_info("'load_minigraph' executing...") + # get the device type + command = "{} -m -v DEVICE_METADATA.localhost.type".format(SONIC_CFGGEN_PATH) + proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + device_type, err = proc.communicate() + if err: + click.echo("Could not get the device type from minigraph, setting device type to Unknown") + device_type = 'Unknown' + else: + device_type = device_type.strip() + #Stop services before config push _stop_services() @@ -540,7 +550,8 @@ def load_minigraph(): command = "{} -H -m --write-to-db".format(SONIC_CFGGEN_PATH) run_command(command, display_cmd=True) client.set(config_db.INIT_INDICATOR, 1) - run_command('pfcwd start_default', display_cmd=True) + if device_type != 'MgmtToRRouter': + run_command('pfcwd start_default', display_cmd=True) if os.path.isfile('/etc/sonic/acl.json'): run_command("acl-loader update full /etc/sonic/acl.json", display_cmd=True) run_command("config qos reload", display_cmd=True)