Skip to content

Commit 871769f

Browse files
qiluo-msftdprital
authored andcommitted
Reapply "We should check service enabled instead exists (#24754)" (#24794) (#25037)
#### Why I did it If teamd feature is disabled, ``` sudo config feature state teamd disabled ``` swss service should not wait on team container at all. Currently there is a process ``` python3 /usr/bin/docker-wait-any -s swss -d syncd teamd ``` However, a thread inside /usr/bin/docker-wait-any is actually crashed, and the behavior is same as ignoring teamd. It still keep the whole system working. The root fix should check service enabled instead exists, so it will not wait-any on teamd at all. After this PR, ``` python3 /usr/bin/docker-wait-any -s swss -d syncd ``` ##### Work item tracking - Microsoft ADO **(number only)**: - Fixing #24730 Signed-off-by: dprital <[email protected]>
1 parent d4891a1 commit 871769f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

files/scripts/swss.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,12 @@ function check_ports_present()
584584
return 1
585585
}
586586

587-
function check_service_exists()
587+
function check_service_enabled()
588588
{
589-
systemctl list-units --full -all 2>/dev/null | grep -Fq $1
590-
if [[ $? -eq 0 ]]; then
589+
if systemctl is-enabled "$1" >/dev/null 2>&1; then
591590
echo true
592-
return
593591
else
594592
echo false
595-
return
596593
fi
597594
}
598595

@@ -601,7 +598,7 @@ function check_service_exists()
601598
DEPENDENT=""
602599
MULTI_INST_DEPENDENT=""
603600

604-
if [[ $(check_service_exists radv) == "true" ]]; then
601+
if [[ $(check_service_enabled radv) == "true" ]]; then
605602
DEPENDENT="$DEPENDENT radv"
606603
fi
607604

@@ -622,7 +619,7 @@ check_add_bgp_dependency
622619
check_ports_present
623620
PORTS_PRESENT=$?
624621

625-
if [[ $PORTS_PRESENT == 0 ]] && [[ $(check_service_exists teamd) == "true" ]]; then
622+
if [[ $PORTS_PRESENT == 0 ]] && [[ $(check_service_enabled "teamd${DEV:+@$DEV}") == "true" ]]; then
626623
MULTI_INST_DEPENDENT="teamd"
627624
fi
628625

0 commit comments

Comments
 (0)