summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-10-27 21:54:23 +0200
committerChristian Poessinger <christian@poessinger.com>2021-10-27 21:54:23 +0200
commit2c82c9acbde2ccca9c7bb5e646a45fd646463afe (patch)
treef05b09a1ea9cf3b394bcc7a125b7bcaef281694c /src/conf_mode
parenta522971938611eb2c630257449369ecf03156d47 (diff)
downloadvyos-1x-2c82c9acbde2ccca9c7bb5e646a45fd646463afe.tar.gz
vyos-1x-2c82c9acbde2ccca9c7bb5e646a45fd646463afe.zip
vrrp: T3944: reload daemon instead of restart when already running
This prevents a failover from MASTER -> BACKUP when changing any MASTER related configuration.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/vrrp.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/conf_mode/vrrp.py b/src/conf_mode/vrrp.py
index e8f1c1f99..c72efc61f 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
@@ -139,7 +140,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__':