Skip to content

Commit fe6f0f6

Browse files
authored
[code sync] Merge code from sonic-net/sonic-buildimage:202511 to 202512 (#2175)
```<br>* b174c71 - (HEAD -> 202512) Merge branch '202511' of https://github.com/sonic-net/sonic-buildimage into 202512 (2026-04-14) [Sonic Automation] * 66766f5 - (head/202511) [rsyslog] Fix Trixie restart delay with conditional restart (#26576) (2026-04-14) [mssonicbld] * 8b612d2 - Revert "[platform/broadcom]: Remove static warmboot mount from docker-syncd-b…" (#26730) (2026-04-13) [Liping Xu]<br>```
2 parents 59e0fdf + b174c71 commit fe6f0f6

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

files/image_config/rsyslog/rsyslog-config.sh

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,34 @@ if [ -z "$syslog_counter" ]; then
4040
syslog_counter="false"
4141
fi
4242

43+
# Generate config to a temp file so we can compare before restarting.
44+
# On Debian 13 (Trixie), rsyslog.service has systemd sandboxing directives
45+
# (PrivateTmp, ProtectSystem, etc.) that add ~4 seconds of overhead per
46+
# restart due to namespace setup/teardown. Skipping the restart when the
47+
# config is unchanged avoids this delay on warm/fast reboot and config_reload
48+
# where nothing actually changed.
49+
#
50+
# When the config IS unchanged we still send SIGHUP so rsyslog re-opens its
51+
# log files (needed after log rotation or /var/log remounts).
52+
#
53+
# See: https://github.com/sonic-net/sonic-buildimage/issues/25382
54+
55+
TMPFILE=$(mktemp /tmp/rsyslog.conf.XXXXXX)
56+
trap 'rm -f "$TMPFILE"' EXIT
57+
4358
sonic-cfggen -d -t /usr/share/sonic/templates/rsyslog.conf.j2 \
4459
-a "{\"udp_server_ip\": \"$udp_server_ip\", \"hostname\": \"$hostname\", \"docker0_ip\": \"$docker0_ip\", \"forward_with_osversion\": \"$syslog_with_osversion\", \"os_version\": \"$os_version\", \"syslog_counter\": \"$syslog_counter\"}" \
45-
> /etc/rsyslog.conf
60+
> "$TMPFILE"
4661

47-
systemctl restart rsyslog
62+
if [ ! -f /etc/rsyslog.conf ] || ! cmp -s "$TMPFILE" /etc/rsyslog.conf; then
63+
# Config changed (or first boot) — install and restart
64+
if cp "$TMPFILE" /etc/rsyslog.conf; then
65+
systemctl restart rsyslog
66+
else
67+
echo "Failed to update /etc/rsyslog.conf; not restarting rsyslog" >&2
68+
exit 1
69+
fi
70+
else
71+
# Config unchanged — just signal rsyslog to re-open log files
72+
systemctl kill -s HUP rsyslog
73+
fi

platform/broadcom/docker-syncd-brcm-legacy-th-rpc.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ $(DOCKER_SYNCD_BRCM_LEGACY_TH_RPC)_VERSION = 1.0.0+rpc
2222
$(DOCKER_SYNCD_BRCM_LEGACY_TH_RPC)_PACKAGE_NAME = syncd-legacy-th
2323
$(DOCKER_SYNCD_BRCM_LEGACY_TH_RPC)_RUN_OPT += --privileged -t
2424
$(DOCKER_SYNCD_BRCM_LEGACY_TH_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
25+
$(DOCKER_SYNCD_BRCM_LEGACY_TH_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot
2526
$(DOCKER_SYNCD_BRCM_LEGACY_TH_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd
2627
$(DOCKER_SYNCD_BRCM_LEGACY_TH_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
2728

platform/broadcom/docker-syncd-brcm-legacy-th.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ $(DOCKER_SYNCD_LEGACY_TH_BASE)_CONTAINER_NAME = syncd
4242
$(DOCKER_SYNCD_LEGACY_TH_BASE)_RUN_OPT += --privileged -t
4343
$(DOCKER_SYNCD_LEGACY_TH_BASE)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
4444
$(DOCKER_SYNCD_LEGACY_TH_BASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
45+
$(DOCKER_SYNCD_LEGACY_TH_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot
4546

4647
$(DOCKER_SYNCD_LEGACY_TH_BASE)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd
4748
$(DOCKER_SYNCD_LEGACY_TH_BASE)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh

0 commit comments

Comments
 (0)