diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-02-16 16:53:29 +0200 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-02-17 11:33:56 +0200 |
| commit | 2414c156cc21bfe51b65f8726f186c55b533bb97 (patch) | |
| tree | 815f9d77ce7ade89371695252aeb1d7af5580890 /src/migration-scripts | |
| parent | 82461ce7856aaf91d1b8a85ca45080e26783fc5e (diff) | |
| download | vyos-1x-2414c156cc21bfe51b65f8726f186c55b533bb97.tar.gz vyos-1x-2414c156cc21bfe51b65f8726f186c55b533bb97.zip | |
vpp: T8268: Unify CPU settings into a single 'cpu-cores' node under 'resource-allocation'
Replace legacy VPP CPU settings (main-core, skip-cores, workers, corelist-workers) with a single resource-allocation cpu-cores option.
CPU assignment is now handled automatically: two cores are reserved for the system, the VPP main thread is placed on the first available core, and the remaining allocated cores are used as workers.
This simplifies configuration and ensures consistent CPU allocation.
Diffstat (limited to 'src/migration-scripts')
| -rw-r--r-- | src/migration-scripts/vpp/7-to-8 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/migration-scripts/vpp/7-to-8 b/src/migration-scripts/vpp/7-to-8 index fa105a6b5..0b2f81b4c 100644 --- a/src/migration-scripts/vpp/7-to-8 +++ b/src/migration-scripts/vpp/7-to-8 @@ -20,6 +20,8 @@ # Drop settings for nat workers (T8254) # # Delete 'ipsec' node and all settings and replace it with single 'ipsec-acceleration' flag (T8262) +# +# Unify CPU settings into a single 'cpu-cores' node under 'resource-allocation' (T8268) from vyos.configtree import ConfigTree @@ -71,6 +73,38 @@ def _migrate_vpp_ipsec(config: ConfigTree) -> None: config.set(base + ['ipsec-acceleration']) config.delete(base + ['ipsec']) +def _migrate_vpp_cpu(config: ConfigTree) -> None: + settings_path = ['vpp', 'settings'] + cpu_path = settings_path + ['cpu'] + + if not config.exists(cpu_path): + # Nothing to do + return + + # get number of configured workers + workers = 0 + + if config.exists(cpu_path + ['workers']): + workers += int(config.return_value(cpu_path + ['workers'])) + # add main-core to total workers + workers += 1 + + if config.exists(cpu_path + ['corelist-workers']): + def _count_range(item: str) -> int: + if '-' in item: + start, end = map(int, item.split('-')) + return end - start + 1 + return 1 + + tmp = config.return_values(cpu_path + ['corelist-workers']) + workers = sum(_count_range(item) for item in tmp) + 1 # + main core + + # set 'resource-allocation cpu-cores' + if workers: + config.set(settings_path + ['resource-allocation', 'cpu-cores'], value=str(workers)) + + config.delete(cpu_path) + def migrate(config: ConfigTree) -> None: if not config.exists(['vpp']): @@ -81,3 +115,4 @@ def migrate(config: ConfigTree) -> None: _migrate_vpp_log(config) _migrate_vpp_nat44(config) _migrate_vpp_ipsec(config) + _migrate_vpp_cpu(config) |
