From 4507f24da4f15ceade879abcbdb4a4e5e758b6fd Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 23 Sep 2020 14:18:13 +0200 Subject: [PATCH] TT#79100 Add corosync/pacemaker support This conditionalizes the heartbeat checks and adds corosync/pacemaker checks. Change-Id: I6af7a84025951c37bd90c8ba3fd37da0467ba8db (cherry picked from commit 2947010649db53171af0f3c0da93d30d121e6fb8) --- templates/411_process-ngcp-pro.yaml.tt2 | 34 +++++++++++++++++-- templates/510_init-daemons-ngcp.yaml.tt2 | 16 ++++++--- templates/822_network-ports-ngcp-pro.yaml.tt2 | 16 ++++++++- 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/templates/411_process-ngcp-pro.yaml.tt2 b/templates/411_process-ngcp-pro.yaml.tt2 index 475c16e..88d833b 100644 --- a/templates/411_process-ngcp-pro.yaml.tt2 +++ b/templates/411_process-ngcp-pro.yaml.tt2 @@ -13,10 +13,40 @@ process: # We have to use a truncated process name because that's the COMM limit # on Linux (15 characters). ngcp-hb-watchdo: - running: true + running: [% ha.gcs == 'heartbeat-2' || ha.crm == 'heartbeat-2' && heartbeat.hb_watchdog.enable == 'yes' ? 'true' : 'false' %] heartbeat: - running: true + running: [% ha.gcs == 'heartbeat-2' || ha.crm == 'heartbeat-2' ? 'true' : 'false' %] + + corosync: + running: [% ha.gcs == 'corosync' ? 'true' : 'false' %] + + pacemakerd: + running: [% ha.crm == 'pacemaker' ? 'true' : 'false' %] + + pacemaker-based: + running: [% ha.crm == 'pacemaker' ? 'true' : 'false' %] + + # We have to use a truncated process name because that's the COMM limit + # on Linux (15 characters). + pacemaker-fence: + running: [% ha.crm == 'pacemaker' ? 'true' : 'false' %] + + pacemaker-execd: + running: [% ha.crm == 'pacemaker' ? 'true' : 'false' %] + + pacemaker-attrd: + running: [% ha.crm == 'pacemaker' ? 'true' : 'false' %] + + # We have to use a truncated process name because that's the COMM limit + # on Linux (15 characters). + pacemaker-sched: + running: [% ha.crm == 'pacemaker' ? 'true' : 'false' %] + + # We have to use a truncated process name because that's the COMM limit + # on Linux (15 characters). + pacemaker-contr: + running: [% ha.crm == 'pacemaker' ? 'true' : 'false' %] influxdb-relay: running: true diff --git a/templates/510_init-daemons-ngcp.yaml.tt2 b/templates/510_init-daemons-ngcp.yaml.tt2 index 1d452b2..c6fb3ac 100644 --- a/templates/510_init-daemons-ngcp.yaml.tt2 +++ b/templates/510_init-daemons-ngcp.yaml.tt2 @@ -14,6 +14,10 @@ service: enabled: [% general.process_handler == 'none' && asterisk.enable == "yes" ? 'true' : 'false' %] running: {{if and [% is_proxy && asterisk.enable == "yes" ? 1 : 0 %] .Vars.NODE_ACTIVE}} true {{else}} false {{end}} + corosync: + enabled: [% ha.gcs == 'corosync' ? 'true' : 'false' %] + running: [% ha.gcs == 'corosync' ? 'true' : 'false' %] + coturn.service: enabled: [% is_rtp && turnserver.enable == 'yes' ? 'true' : 'false' %] running: [% is_rtp && turnserver.enable == 'yes' ? 'true' : 'false' %] @@ -27,8 +31,8 @@ service: running: [% is_lb && haproxy.enable == "yes" && general.ngcp_type == 'carrier' ? 'true' : 'false' %] ngcp-hb-watchdog.service: - enabled: [% heartbeat.hb_watchdog.enable == 'yes' ? 'true' : 'false' %] - running: [% heartbeat.hb_watchdog.enable == 'yes' ? 'true' : 'false' %] + enabled: [% ha.gcs == 'heartbeat-2' || ha.crm == 'heartbeat-2' && heartbeat.hb_watchdog.enable == 'yes' ? 'true' : 'false' %] + running: [% ha.gcs == 'heartbeat-2' || ha.crm == 'heartbeat-2' && heartbeat.hb_watchdog.enable == 'yes' ? 'true' : 'false' %] kamailio-lb.service: enabled: [% general.process_handler == 'none' && kamailio.lb.start == "yes" ? 'true' : 'false' %] @@ -74,6 +78,10 @@ service: enabled: [% (is_mgmt || is_lb || is_li_dist) && nginx.enable == 'yes' ? 'true' : 'false' %] running: [% (is_mgmt || is_lb || is_li_dist) && nginx.enable == 'yes' ? 'true' : 'false' %] + pacemaker.service: + enabled: [% ha.crm == 'pacemaker' ? 'true' : 'false' %] + running: [% ha.crm == 'pacemaker' ? 'true' : 'false' %] + prosody.service: enabled: [% general.process_handler == 'none' && prosody.enable == 'yes' ? 'true' : 'false' %] running: {{if and [% is_proxy && prosody.enable == "yes" ? 1 : 0 %] .Vars.NODE_ACTIVE}} true {{else}} false {{end}} @@ -142,7 +150,7 @@ service: [% IF general.ngcp_type != 'spce' -%] heartbeat.service: - enabled: true - running: true + enabled: [% ha.gcs == 'heartbeat-2' || ha.crm == 'heartbeat-2' ? 'true' : 'false' %] + running: [% ha.gcs == 'heartbeat-2' || ha.crm == 'heartbeat-2' ? 'true' : 'false' %] [% END -%] diff --git a/templates/822_network-ports-ngcp-pro.yaml.tt2 b/templates/822_network-ports-ngcp-pro.yaml.tt2 index 7047150..fff8d15 100644 --- a/templates/822_network-ports-ngcp-pro.yaml.tt2 +++ b/templates/822_network-ports-ngcp-pro.yaml.tt2 @@ -1,3 +1,12 @@ +[% + hostname = ngcp.get_hostname(); + peername = ngcp.get_peername(hostname); + + argv.type = 'ha_int'; + argv.host = hostname; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_iface'; + host_ha_iface = out; +-%] port: # Monit tcp:2812: @@ -14,7 +23,12 @@ port: listening: true ip: ["127.0.0.1"] + # Corosync + udp:5405: + listening: [% ha.gcs == 'corosync' ? 'true' : 'false' %] + ip: ["[% hosts.$hostname.$host_ha_iface.ip %]"] + # Heartbeat udp:[% heartbeat.port ? heartbeat.port : '694' %]: - listening: true + listening: [% ha.gcs == 'heartbeat-2' || ha.crm == 'heartbeat-2' ? 'true' : 'false' %] ip: ["0.0.0.0"]