Skip to content

Commit 66b41e5

Browse files
authored
[fast/warm-reboot] Improve retry mechanism to check if SAI_OBJECT_TYPE_ACL_ENTRY entries are in redis (#3548)
* [fast/warm-reboot] Improve retry mechanism to check if SAI_OBJECT_TYPE_ACL_ENTRY entries are in redis Signed-off-by: Andriy Yurkiv <ayurkiv@nvidia.com> * Change log severity Signed-off-by: Andriy Yurkiv <ayurkiv@nvidia.com> --------- Signed-off-by: Andriy Yurkiv <ayurkiv@nvidia.com>
1 parent 94ec710 commit 66b41e5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

scripts/fast-reboot

+11-5
Original file line numberDiff line numberDiff line change
@@ -304,17 +304,23 @@ function check_mirror_session_acls()
304304
ACL_ND="missing"
305305
start_time=${SECONDS}
306306
elapsed_time=$((${SECONDS} - ${start_time}))
307+
retry_count=0
307308
while [[ ${elapsed_time} -lt 10 ]]; do
308309
CHECK_ACL_ENTRIES=0
310+
retry_count=$((retry_count + 1))
309311
ACL_OUTPUT=$(sonic-db-cli ASIC_DB KEYS "*" | grep SAI_OBJECT_TYPE_ACL_ENTRY) || CHECK_ACL_ENTRIES=$?
310312
if [[ ${CHECK_ACL_ENTRIES} -ne 0 ]]; then
311-
error "Failed to retrieve SAI_OBJECT_TYPE_ACL_ENTRY from redis"
312-
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
313+
debug "Failed to retrieve SAI_OBJECT_TYPE_ACL_ENTRY from redis, retrying... (Attempt: ${retry_count})"
314+
sleep 0.1
315+
elapsed_time=$((${SECONDS} - ${start_time}))
316+
continue
313317
fi
314318
ACL_ENTRIES=( ${ACL_OUTPUT} )
315319
if [[ ${#ACL_ENTRIES[@]} -eq 0 ]]; then
316-
error "NO SAI_OBJECT_TYPE_ACL_ENTRY objects found"
317-
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
320+
debug "NO SAI_OBJECT_TYPE_ACL_ENTRY objects found, retrying... (Attempt: ${retry_count})"
321+
sleep 0.1
322+
elapsed_time=$((${SECONDS} - ${start_time}))
323+
continue
318324
fi
319325
for ACL_ENTRY in ${ACL_ENTRIES[@]}; do
320326
ACL_PRIORITY=$(sonic-db-cli ASIC_DB HGET ${ACL_ENTRY} SAI_ACL_ENTRY_ATTR_PRIORITY)
@@ -332,7 +338,7 @@ function check_mirror_session_acls()
332338
elapsed_time=$((${SECONDS} - ${start_time}))
333339
done
334340
if [[ "${ACL_ARP}" != "found" || "${ACL_ND}" != "found" ]]; then
335-
debug "Failed to program mirror session ACLs on ASIC. ACLs: ARP=${ACL_ARP} ND=${ACL_ND}"
341+
error "Failed to program mirror session ACLs on ASIC. ACLs: ARP=${ACL_ARP} ND=${ACL_ND}"
336342
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
337343
fi
338344
debug "Mirror session ACLs (arp, nd) programmed to ASIC successfully"

0 commit comments

Comments
 (0)