Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2135,7 +2135,16 @@ def load_minigraph(db, no_service_restart, traffic_shift_away, override_config,
# get the device type
device_type = _get_device_type()
if device_type != 'MgmtToRRouter' and device_type != 'MgmtTsToR' and device_type != 'BmcMgmtToRRouter' and device_type != 'EPMS':
clicommon.run_command(['pfcwd', 'start_default'], display_cmd=True)
start_pfcwd = True
if override_config and config_to_check:
# If pfcwd is disabled in the golden config, skip starting pfcwd
# This is needed for platform which doesn't support lossless traffic.
device_metadata = config_to_check.get('DEVICE_METADATA', {})
default_pfcwd_status = device_metadata.get('localhost', {}).get('default_pfcwd_status')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if 'default_pfcwd_status' is None, next step will still start pfcwd

Copy link
Copy Markdown
Contributor Author

@sdszhang sdszhang May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If default_pfcwd_status is not defined in golden config, it falls back to current default behavior.

Current behavior is to run 'pfcwd start_default' directly without any check. so it will be called even if default_pfcwd_status is None. Although, it's unlikely to happen. This PR prefers to keep the behavior unchanged. We can change this behavior in the future if we see some issue or use cases.

With this PR, the only behavior change is when default_pfcwd_status in 'init_cfg.json' is enable or None, but golden config is disable. In this case, old behavior was to do pfcwd start_default, new behavior is to skip it.

if default_pfcwd_status == 'disable':
start_pfcwd = False
if start_pfcwd:
clicommon.run_command(['pfcwd', 'start_default'], display_cmd=True)

# Write latest db version string into db
db_migrator = '/usr/local/bin/db_migrator.py'
Expand Down
Loading