diff options
| author | Daniil Baturin <daniil@vyos.io> | 2025-12-23 15:06:31 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-23 15:06:31 +0000 |
| commit | 165841c13d6b57631b8c034c5b5c87d4d7f3469f (patch) | |
| tree | 9b1e529c6ad700a6f91801cbc99cc63a4117d111 /src/conf_mode | |
| parent | 583b29ba947d8c8ab4bdcd02b4af7d4d2bf80ca0 (diff) | |
| parent | 7997cc9f5b7446f5c0ca24e72dc4c35821fb1c69 (diff) | |
| download | vyos-1x-165841c13d6b57631b8c034c5b5c87d4d7f3469f.tar.gz vyos-1x-165841c13d6b57631b8c034c5b5c87d4d7f3469f.zip | |
Merge pull request #4904 from natali-rs1985/T8080
vpp: T8080: Fix handling of configuration system lock after vpp commit failure
Diffstat (limited to 'src/conf_mode')
| -rwxr-xr-x | src/conf_mode/vpp.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index b5aac3f2e..4cbfab6bc 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -39,9 +39,11 @@ from vyos.utils.kernel import check_kmod from vyos.utils.kernel import unload_kmod from vyos.utils.kernel import list_loaded_modules from vyos.utils.process import call +from vyos.utils.process import is_systemd_service_active from vyos.vpp import VPPControl from vyos.vpp import control_host +from vyos.vpp import VppNotRunningError from vyos.vpp.config_deps import deps_xconnect_dict from vyos.vpp.config_verify import ( verify_dev_driver, @@ -771,10 +773,14 @@ def apply(config): if 'settings' in config and 'interface' in config.get('settings'): # connect to VPP - # must be performed multiple attempts because API is not available - # immediately after the service restart try: - vpp_control = VPPControl(attempts=20, interval=500) + # Bail out early if VPP service is not running + if not is_systemd_service_active(f'{service_name}.service'): + raise VppNotRunningError( + 'VPP service is not running or failed to start' + ) + + vpp_control = VPPControl() # preconfigure LCP plugin if 'ignore_kernel_routes' in config.get('settings', {}).get('lcp', {}): @@ -877,7 +883,7 @@ def apply(config): bitmask |= 1 << wid vpp_control.set_nat_workers(bitmask) - except (VPPIOError, VPPValueError) as e: + except (VPPIOError, VPPValueError, VppNotRunningError) as e: # if cannot connect to VPP or an error occurred then # we need to stop vpp service and initialize interfaces call(f'systemctl stop {service_name}.service') |
