diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-10-27 21:54:23 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-10-27 21:56:20 +0200 |
commit | 64994acb6f106626f94743a3e47057f613a0d2fb (patch) | |
tree | 10b4d2a7602cd787b196ff89bf5a3ef0b251ad0d /src/conf_mode | |
parent | aabcd6ced2fc668e1b0ea31c9c4f0d62c3f5d8a5 (diff) | |
download | vyos-1x-64994acb6f106626f94743a3e47057f613a0d2fb.tar.gz vyos-1x-64994acb6f106626f94743a3e47057f613a0d2fb.zip |
vrrp: T3944: reload daemon instead of restart when already running
This prevents a failover from MASTER -> BACKUP when changing any MASTER related
configuration.
(cherry picked from commit 2c82c9acbde2ccca9c7bb5e646a45fd646463afe)
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/vrrp.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/conf_mode/vrrp.py b/src/conf_mode/vrrp.py index c906bdfcd..ad38adaec 100755 --- a/src/conf_mode/vrrp.py +++ b/src/conf_mode/vrrp.py @@ -28,6 +28,7 @@ from vyos.template import render from vyos.template import is_ipv4 from vyos.template import is_ipv6 from vyos.util import call +from vyos.util import is_systemd_service_running from vyos.xml import defaults from vyos import ConfigError from vyos import airbag @@ -146,7 +147,12 @@ def apply(vrrp): call(f'systemctl stop {service_name}') return None - call(f'systemctl restart {service_name}') + # XXX: T3944 - reload keepalived configuration if service is already running + # to not cause any service disruption when applying changes. + if is_systemd_service_running(service_name): + call(f'systemctl reload {service_name}') + else: + call(f'systemctl restart {service_name}') return None if __name__ == '__main__': |