Skip to content

Commit

Permalink
[Mellanox] Don't start & stop pmon when config reload (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenxs authored and jleveque committed Sep 26, 2019
1 parent bf79c95 commit cbf19f6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ def log_error(msg):
syslog.syslog(syslog.LOG_ERR, msg)
syslog.closelog()

#
# Load asic_type for further use
#

try:
version_info = sonic_device_util.get_sonic_version_info()
asic_type = version_info['asic_type']
except KeyError, TypeError:
raise click.Abort()

#
# Helper functions
#
Expand Down Expand Up @@ -314,13 +324,16 @@ def _abort_if_false(ctx, param, value):
ctx.abort()

def _stop_services():
# on Mellanox platform pmon is stopped by syncd
services_to_stop = [
'swss',
'lldp',
'pmon',
'bgp',
'hostcfgd',
]
if asic_type == 'mellanox' and 'pmon' in services_to_stop:
services_to_stop.remove('pmon')

for service in services_to_stop:
try:
Expand Down Expand Up @@ -358,6 +371,7 @@ def _reset_failed_services():
raise

def _restart_services():
# on Mellanox platform pmon is started by syncd
services_to_restart = [
'hostname-config',
'interfaces-config',
Expand All @@ -369,6 +383,8 @@ def _restart_services():
'lldp',
'hostcfgd',
]
if asic_type == 'mellanox' and 'pmon' in services_to_restart:
services_to_restart.remove('pmon')

for service in services_to_restart:
try:
Expand Down Expand Up @@ -1350,8 +1366,7 @@ def asymmetric(ctx, interface_name, status):
def platform():
"""Platform-related configuration tasks"""

version_info = sonic_device_util.get_sonic_version_info()
if (version_info and version_info.get('asic_type') == 'mellanox'):
if asic_type == 'mellanox':
platform.add_command(mlnx.mlnx)

#
Expand Down

0 comments on commit cbf19f6

Please sign in to comment.