diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2025-02-03 22:36:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-03 22:36:10 +0200 |
| commit | a649b1adaca050e0ce2c882689239ce286903a9c (patch) | |
| tree | 44394196a64aa4c18ba3a882862f6e4de8f0ac5a /src | |
| parent | 71875bead2fc01d8292a64d1dc2c153e2a30e80e (diff) | |
| parent | e5c5d6778883ab1e73f9e0face6ad9b660b2efec (diff) | |
| download | vyos-1x-a649b1adaca050e0ce2c882689239ce286903a9c.tar.gz vyos-1x-a649b1adaca050e0ce2c882689239ce286903a9c.zip | |
Merge pull request #5 from natali-rs1985/T7066
T7066: VPP CPU workers verification
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/vpp.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index 51eda0587..249467460 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -381,10 +381,22 @@ def verify(config): if 'cpu' in config['settings']: if ( 'corelist_workers' in config['settings']['cpu'] - and 'main_core' not in config['settings']['cpu'] - ): + or 'workers' in config['settings']['cpu'] + ) and 'main_core' not in config['settings']['cpu']: raise ConfigError('"cpu main-core" is required but not set!') + cpus = int(get_core_count()) + if 'workers' in config['settings']['cpu']: + # number of worker threads must be not more than + # available CPUs in the system - 2 (1 for main thread and at least 1 for system processes) + workers = int(config['settings']['cpu']['workers']) + available_workers = cpus - 2 + if workers > available_workers: + raise ConfigError( + f'The system does not have enough CPUs for {workers} VPP workers ' + f'(reduce to {available_workers} or less)' + ) + verify_memory(config['settings']) # Check if deleted interfaces are not xconnect memebrs @@ -428,6 +440,7 @@ def generate(config): def apply(config): + # Open persistent config # It is required for operations with interfaces persist_config = JSONStorage('vpp_conf') |
