Skip to content

Commit be1866f

Browse files
authored
Fix GCU bug when backend service modifying config (sonic-net#2295)
What I did Fixes sonic-net#11576 How I did it Add a workaround to only compare config without backend service impact. How to verify it Manual test on specific platform and check operation success.
1 parent bcf36eb commit be1866f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

generic_config_updater/change_applier.py

+12
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ class ChangeApplier:
7171

7272
def __init__(self):
7373
self.config_db = get_config_db()
74+
self.backend_tables = [
75+
"BUFFER_PG",
76+
"BUFFER_PROFILE",
77+
"FLEX_COUNTER_TABLE"
78+
]
7479
if (not ChangeApplier.updater_conf) and os.path.exists(UPDATER_CONF_FILE):
7580
with open(UPDATER_CONF_FILE, "r") as s:
7681
ChangeApplier.updater_conf = json.load(s)
@@ -142,6 +147,8 @@ def apply(self, change):
142147
ret = self._services_validate(run_data, upd_data, upd_keys)
143148
if not ret:
144149
run_data = self._get_running_config()
150+
self.remove_backend_tables_from_config(upd_data)
151+
self.remove_backend_tables_from_config(run_data)
145152
if upd_data != run_data:
146153
self._report_mismatch(run_data, upd_data)
147154
ret = -1
@@ -150,6 +157,11 @@ def apply(self, change):
150157
return ret
151158

152159

160+
def remove_backend_tables_from_config(self, data):
161+
for key in self.backend_tables:
162+
data.pop(key, None)
163+
164+
153165
def _get_running_config(self):
154166
(_, fname) = tempfile.mkstemp(suffix="_changeApplier")
155167
os.system("sonic-cfggen -d --print-data > {}".format(fname))

generic_config_updater/generic_updater.py

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def apply(self, patch):
7777
# Validate config updated successfully
7878
self.logger.log_notice("Verifying patch updates are reflected on ConfigDB.")
7979
new_config = self.config_wrapper.get_config_db_as_json()
80+
self.changeapplier.remove_backend_tables_from_config(target_config)
81+
self.changeapplier.remove_backend_tables_from_config(new_config)
8082
if not(self.patch_wrapper.verify_same_json(target_config, new_config)):
8183
raise GenericConfigUpdaterError(f"After applying patch to config, there are still some parts not updated")
8284

0 commit comments

Comments
 (0)