Update container_checker for multi-asic devices when state is 'always_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
This commit is contained in:
wenyiz2021 2022-02-23 18:06:30 -08:00 committed by Arvindsrinivasan Lakshmi Narasimhan
parent 5419e5de71
commit 05e566ed45

View File

@ -51,14 +51,20 @@ def get_expected_running_containers():
num_asics = multi_asic.get_num_asics() num_asics = multi_asic.get_num_asics()
for asic_id in range(num_asics): for asic_id in range(num_asics):
expected_running_containers.add(container_name + str(asic_id)) expected_running_containers.add(container_name + str(asic_id))
elif feature_table[container_name]["state"] == 'always_enabled':
always_running_containers.add(container_name)
else: else:
expected_running_containers.add(container_name) 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 return expected_running_containers, always_running_containers
def get_current_running_from_DB(always_running_containers): def get_current_running_from_DB(always_running_containers):
""" """
@summary: This function will get the current running container list @summary: This function will get the current running container list