mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
confd: replace sysrepo-plugind + bootstrap + load with single daemon
On single-core Cortex-A7, the YANG bootstrap and config loading is the dominant boot bottleneck. The current sequence spawns three serial phases (bootstrap, sysrepo-plugind, load), each performing independent sr_connect()/sr_disconnect() cycles, and every sysrepoctl/sysrepocfg invocation is a fork+exec that rebuilds SHM from scratch. Replace all three with a single confd binary that does one sr_connect() and performs all datastore operations in-process: - Wipe stale /dev/shm/sr_* for a clean slate - sr_install_factory_config() from the generated JSON - Smart migration: compare config version via libjansson, only fork+exec the migrate script when versions actually differ - Load startup-config (or test-config) via lyd_parse_data() + sr_replace_config(), mirroring what sysrepocfg -I does internally - On failure: revert to factory-default, load failure-config, set login banners (Fail Secure mode) - On first boot: copy factory-default to running, export to file - dlopen plugins and enter event loop The bootstrap shell script is split: config generation (gen-hostname, gen-interfaces, etc.) stays in the new gen-config script, while all sysrepo operations move into the C daemon. The finit boot sequence collapses from 5 stanzas to 2 (gen-config -> confd). Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+11
-19
@@ -1,27 +1,19 @@
|
||||
#set DEBUG=1
|
||||
|
||||
# Phase 1: Generate factory/failure/test configs (shell)
|
||||
run name:bootstrap log:prio:user.notice norestart <usr/ixinit> \
|
||||
[S] /usr/libexec/confd/bootstrap \
|
||||
-- Bootstrapping YANG datastore
|
||||
[S] /usr/libexec/confd/gen-config \
|
||||
-- Generating factory configuration
|
||||
|
||||
run name:error :1 log:console norestart if:<run/bootstrap/failure> \
|
||||
[S] /usr/libexec/confd/error --
|
||||
|
||||
service name:confd log:prio:daemon.err <run/bootstrap/success> \
|
||||
[S12345] sysrepo-plugind -f -p /run/confd.pid -n -v warning \
|
||||
# Phase 2: Single daemon handles datastore init, config load, and plugins
|
||||
# log:prio:daemon.err
|
||||
service name:confd <run/bootstrap/success> env:/etc/default/confd \
|
||||
[S12345] confd -f -n -v warning -p /run/confd.pid \
|
||||
-F /etc/factory-config.cfg \
|
||||
-S /cfg/startup-config.cfg \
|
||||
-E /etc/failure-config.cfg \
|
||||
-t $CONFD_TIMEOUT \
|
||||
-- Configuration daemon
|
||||
|
||||
# Bootstrap system with startup-config
|
||||
run name:startup log:prio:user.notice norestart <pid/confd> env:/etc/default/confd \
|
||||
[S] /usr/libexec/confd/load -t $CONFD_TIMEOUT startup-config \
|
||||
-- Loading startup-config
|
||||
|
||||
# Run if loading startup-config fails for some reason
|
||||
run name:failure log:prio:user.crit norestart env:/etc/default/confd \
|
||||
if:<run/startup/failure> \
|
||||
[S] <pid/confd> /usr/libexec/confd/load -t $CONFD_TIMEOUT failure-config \
|
||||
-- Loading failure-config
|
||||
|
||||
run name:error :2 log:console norestart \
|
||||
if:<run/failure/failure> \
|
||||
[S] /usr/libexec/confd/error --
|
||||
|
||||
Reference in New Issue
Block a user