Skip to content

Commit

Permalink
Do not start pfcwd for M0 devices (sonic-net#726)
Browse files Browse the repository at this point in the history
* Do not start pfcwd for M0 devices

Signed-off-by: Neetha John <nejo@microsoft.com>

* Avoid exiting for device type error

Signed-off-by: Neetha John <nejo@microsoft.com>
  • Loading branch information
neethajohn authored and yxieca committed Nov 7, 2019
1 parent 2c0af8a commit e4a5e4c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
Expand Down

0 comments on commit e4a5e4c

Please sign in to comment.