From c5f5cdae7bd9ac44ea02b8208caae2d616f686e5 Mon Sep 17 00:00:00 2001 From: yozhao101 <56170650+yozhao101@users.noreply.github.com> Date: Fri, 2 Apr 2021 08:05:46 -0700 Subject: [PATCH] [container_checker] Exclude the 'always_disabled' container from expected running container list (#7217) Signed-off-by: Yong Zhao yozhao@microsoft.com Why I did it Since we introduced a new value always_disabled for the state field in FEATURE table, the expected running container list should exclude the always_diabled containers. This bug was found by nightly test and posted at here: issue. This PR fixes #7210. How I did it I added a logic condition to decide whether the value of state field of a container was always_disabled or not. How to verify it I verified this on the device str-dx010-acs-1. Which release branch to backport (provide reason below if selected) 201811 201911 202006 [ x] 202012 --- files/image_config/monit/container_checker | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/image_config/monit/container_checker b/files/image_config/monit/container_checker index abfbb34430bb..88c288fccd65 100755 --- a/files/image_config/monit/container_checker +++ b/files/image_config/monit/container_checker @@ -48,11 +48,11 @@ def get_command_result(command): def get_expected_running_containers(): """ @summary: This function will get the expected running containers by following the rule: - The 'state' field of container in 'FEATURE' table should not be 'disabled'. Then - if the device has Multi-ASIC, this function will get container list by determining the + The 'state' field of container in 'FEATURE' table should not be 'disabled' or 'always_disabled'. + If the device has Multi-ASIC, this function will get container list by determining the value of field 'has_global_scope', the number of ASICs and the value of field - 'has_per_asic_scope'. If the device has single ASIC, the container name was put into - the list. + 'has_per_asic_scope'. + If the device has single ASIC, the container name was put into the list. @return: A set which contains the expected running containers. """ config_db = swsssdk.ConfigDBConnector() @@ -62,7 +62,7 @@ def get_expected_running_containers(): expected_running_containers = set() for container_name in feature_table.keys(): - if feature_table[container_name]["state"] != "disabled": + if feature_table[container_name]["state"] not in ["disabled", "always_disabled"]: if multi_asic.is_multi_asic(): if feature_table[container_name]["has_global_scope"] == "True": expected_running_containers.add(container_name)