Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GCU bug when backend service modifying config #2295

Merged
merged 3 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions generic_config_updater/change_applier.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ class ChangeApplier:

def __init__(self):
self.config_db = get_config_db()
self.backend_tables = [
"BUFFER_PG",
"BUFFER_PROFILE",
"FLEX_COUNTER_TABLE"
Copy link
Contributor

@qiluo-msft qiluo-msft Aug 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FLEX_COUNTER_TABLE

Which process will modify FLEX_COUNTER_TABLE? #Closed

Copy link
Contributor Author

@wen587 wen587 Aug 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it is being modified after load_minigraph, but not sure if other config changes would modify this table.

Maybe flex_counter_manager https://github.com/sonic-net/sonic-swss/blob/master/orchagent/flex_counter/flex_counter_manager.cpp#L112?

admin@vlab-01:~$ redis-cli monitor | grep " \[4 "  | grep 'HSET\|HMSET'
...
1652252491.657340 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|PORT" "FLEX_COUNTER_STATUS" "enable"
1652252491.665481 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|RIF" "FLEX_COUNTER_STATUS" "enable"
1652252491.673144 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|QUEUE" "FLEX_COUNTER_STATUS" "enable"
1652252491.677734 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|PFCWD" "FLEX_COUNTER_STATUS" "enable"
1652252491.689264 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|PG_WATERMARK" "FLEX_COUNTER_STATUS" "enable"
1652252491.692459 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|PG_DROP" "FLEX_COUNTER_STATUS" "enable"
1652252491.695281 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|QUEUE_WATERMARK" "FLEX_COUNTER_STATUS" "enable"
1652252491.699036 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|BUFFER_POOL_WATERMARK" "FLEX_COUNTER_STATUS" "enable"
1652252491.703090 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|PORT_BUFFER_DROP" "FLEX_COUNTER_STATUS" "enable"
1652252491.706964 [4 127.0.0.1:48348] "HMSET" "FLEX_COUNTER_TABLE|ACL" "FLEX_COUNTER_DELAY_STATUS" "false" "FLEX_COUNTER_STATUS" "enable" "POLL_INTERVAL" "10000"

]
if (not ChangeApplier.updater_conf) and os.path.exists(UPDATER_CONF_FILE):
with open(UPDATER_CONF_FILE, "r") as s:
ChangeApplier.updater_conf = json.load(s)
Expand Down Expand Up @@ -142,6 +147,8 @@ def apply(self, change):
ret = self._services_validate(run_data, upd_data, upd_keys)
if not ret:
run_data = self._get_running_config()
self.remove_backend_tables_from_config(upd_data)
self.remove_backend_tables_from_config(run_data)
if upd_data != run_data:
self._report_mismatch(run_data, upd_data)
ret = -1
Expand All @@ -150,6 +157,11 @@ def apply(self, change):
return ret


def remove_backend_tables_from_config(self, data):
for key in self.backend_tables:
data.pop(key, None)


def _get_running_config(self):
(_, fname) = tempfile.mkstemp(suffix="_changeApplier")
os.system("sonic-cfggen -d --print-data > {}".format(fname))
Expand Down
2 changes: 2 additions & 0 deletions generic_config_updater/generic_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def apply(self, patch):
# Validate config updated successfully
self.logger.log_notice("Verifying patch updates are reflected on ConfigDB.")
new_config = self.config_wrapper.get_config_db_as_json()
self.changeapplier.remove_backend_tables_from_config(target_config)
self.changeapplier.remove_backend_tables_from_config(new_config)
if not(self.patch_wrapper.verify_same_json(target_config, new_config)):
raise GenericConfigUpdaterError(f"After applying patch to config, there are still some parts not updated")

Expand Down