diff options
| author | Nataliia S. <81954790+natali-rs1985@users.noreply.github.com> | 2025-02-04 11:33:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-04 11:33:32 +0200 |
| commit | 9be3a63f700acef43b7a84bd83b9bea0cdd0c481 (patch) | |
| tree | 1950a83f13711bad6e308c5e0bf0145980433072 /src/conf_mode | |
| parent | a445ecb65007ce478527f66b07138ea393de1098 (diff) | |
| parent | a649b1adaca050e0ce2c882689239ce286903a9c (diff) | |
| download | vyos-1x-9be3a63f700acef43b7a84bd83b9bea0cdd0c481.tar.gz vyos-1x-9be3a63f700acef43b7a84bd83b9bea0cdd0c481.zip | |
Merge branch 'current' into T7075
Diffstat (limited to 'src/conf_mode')
| -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 db135c53e..0b2d4cbe8 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -397,10 +397,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 @@ -444,6 +456,7 @@ def generate(config): def apply(config): + # Open persistent config # It is required for operations with interfaces persist_config = JSONStorage('vpp_conf') |
