diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2026-02-17 16:05:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-17 16:05:48 +0200 |
| commit | 9785f396ba1e82b6b359e42af7da03828b4ff6ed (patch) | |
| tree | 3ca807b3c1210e871fca08c10f167be751c16e7c /src/migration-scripts | |
| parent | 33752c9a41f2e79c1ef3884188968d0f48bc79d8 (diff) | |
| parent | 2414c156cc21bfe51b65f8726f186c55b533bb97 (diff) | |
| download | vyos-1x-9785f396ba1e82b6b359e42af7da03828b4ff6ed.tar.gz vyos-1x-9785f396ba1e82b6b359e42af7da03828b4ff6ed.zip | |
Merge pull request #4993 from natali-rs1985/T8268
vpp: T8268: Unify CPU settings into a single 'cpu-cores' node under 'resource-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) |
