Skip to content

Commit dbcc6fd

Browse files
authored
[config reload]: fix the condition for checking if system is starting (sonic-net#1766)
When systemd services finished, the systemd status could running or degraded. Therefore, compare system status with starting directly. Here is what is happening on kvm switch. Some services cannot be started. Then, the system state is in degraded state. ``` admin@ARISTA01T1:~$ systemctl is-system-running starting admin@ARISTA01T1:~$ systemctl is-system-running degraded ``` Signed-off-by: Guohan Lu <[email protected]>
1 parent 2c7cfaa commit dbcc6fd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

config/main.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from . import vxlan
4444
from . import plugins
4545
from .config_mgmt import ConfigMgmtDPB
46-
from . import mclag
46+
from . import mclag
4747

4848
# mock masic APIs for unit test
4949
try:
@@ -727,9 +727,9 @@ def _swss_ready():
727727
else:
728728
return False
729729

730-
def _system_running():
730+
def _is_system_starting():
731731
out = clicommon.run_command("sudo systemctl is-system-running", return_cmd=True)
732-
return out.strip() == "running"
732+
return out.strip() == "starting"
733733

734734
def interface_is_in_vlan(vlan_member_table, interface_name):
735735
""" Check if an interface is in a vlan """
@@ -1233,7 +1233,7 @@ def reload(db, filename, yes, load_sysinfo, no_service_restart, disable_arp_cach
12331233
<filename> : Names of configuration file(s) to load, separated by comma with no spaces in between
12341234
"""
12351235
if not force and not no_service_restart:
1236-
if not _system_running():
1236+
if _is_system_starting():
12371237
click.echo("System is not up. Retry later or use -f to avoid system checks")
12381238
return
12391239

@@ -1491,10 +1491,10 @@ def load_port_config(config_db, port_config_path):
14911491
# Validate if the input is an array
14921492
if not isinstance(port_config_input, list):
14931493
raise Exception("Bad format: port_config is not an array")
1494-
1494+
14951495
if len(port_config_input) == 0 or 'PORT' not in port_config_input[0]:
14961496
raise Exception("Bad format: PORT table not exists")
1497-
1497+
14981498
port_config = port_config_input[0]['PORT']
14991499

15001500
# Ensure all ports are exist

0 commit comments

Comments
 (0)