Skip to content

Commit

Permalink
Update container_checker for multi-asic devices when state is 'always…
Browse files Browse the repository at this point in the history
…_enabled' (#10067)

* Update container_checker for multi-asic devices 

Update container_checker for multi-asic devices to add database containers in always_running_containers. 
Previous change was made for single-asic, and that database containers were not considered as feature when writing to state_db.

* Update container_checker

Update an indent
  • Loading branch information
wenyiz2021 authored Feb 24, 2022
1 parent 72477bc commit 2d0b063
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions files/image_config/monit/container_checker
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_expected_running_containers():

expected_running_containers = set()
always_running_containers = set()

for container_name in feature_table.keys():
if feature_table[container_name]["state"] not in ["disabled", "always_disabled"]:
if multi_asic.is_multi_asic():
Expand All @@ -51,14 +51,20 @@ def get_expected_running_containers():
num_asics = multi_asic.get_num_asics()
for asic_id in range(num_asics):
expected_running_containers.add(container_name + str(asic_id))
elif feature_table[container_name]["state"] == 'always_enabled':
always_running_containers.add(container_name)
else:
expected_running_containers.add(container_name)

if feature_table[container_name]["state"] == 'always_enabled':
if multi_asic.is_multi_asic():
if feature_table[container_name]["has_global_scope"] == "True":
always_running_containers.add(container_name)
if feature_table[container_name]["has_per_asic_scope"] == "True":
num_asics = multi_asic.get_num_asics()
for asic_id in range(num_asics):
always_running_containers.add(container_name + str(asic_id))
else:
always_running_containers.add(container_name)
return expected_running_containers, always_running_containers


def get_current_running_from_DB(always_running_containers):
"""
@summary: This function will get the current running container list
Expand Down

0 comments on commit 2d0b063

Please sign in to comment.