[ha] Run OpenDaylight in cluster mode 21/63021/5
authorMichael Polenchuk <mpolenchuk@mirantis.com>
Fri, 28 Sep 2018 12:02:30 +0000 (16:02 +0400)
committerMichael Polenchuk <mpolenchuk@mirantis.com>
Mon, 22 Oct 2018 10:23:47 +0000 (14:23 +0400)
Change-Id: Id75fbee34a6cfc6e7fc60df053cccaaff21cb15a
Signed-off-by: Michael Polenchuk <mpolenchuk@mirantis.com>
mcp/patches/docker/0002-OPNFV-package-installation-Ubuntu-user.patch
mcp/reclass/classes/cluster/mcp-common-ha/openstack_init.yml.j2
mcp/reclass/classes/cluster/mcp-odl-ha/infra/config.yml.j2 [moved from mcp/reclass/classes/cluster/mcp-odl-ha/infra/config.yml with 54% similarity]
mcp/reclass/classes/cluster/mcp-odl-ha/infra/kvm.yml.j2
mcp/reclass/classes/cluster/mcp-odl-ha/opendaylight/control.yml.j2
mcp/reclass/classes/cluster/mcp-odl-ha/openstack/init.yml.j2
mcp/reclass/classes/cluster/mcp-odl-noha/init.yml
mcp/reclass/classes/cluster/mcp-odl-noha/openstack/init.yml
mcp/salt-formulas/salt-formula-opendaylight/metadata/service/server/cluster.yml [new file with mode: 0644]
mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja
mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls

index e0526c5..eb9daeb 100644 (file)
@@ -33,7 +33,7 @@ index 2c75586..d7d4c49 100644
      ARG RECLASS_BASE="/srv/salt/reclass"
      ENV RECLASS_BASE $RECLASS_BASE
 -    RUN echo "Layer python/salt module prerequisites, formulas" \
-+    RUN echo "Layer python/salt module prerequisites, formulas (27 Sep 2018)" \
++    RUN echo "Layer python/salt module prerequisites, formulas (22 Oct 2018)" \
        && mkdir -p /srv/salt \
        && curl -sSqL https://raw.githubusercontent.com/salt-formulas/salt-formulas-scripts/master/formula-fetch.sh -o /srv/salt/formula-fetch.sh \
        && bash -c 'source /srv/salt/formula-fetch.sh && setupPyEnv && fetchAll' \
index 7322378..bb76fdb 100644 (file)
@@ -110,16 +110,6 @@ parameters:
     openstack_compute_node01_hostname: cmp001
     openstack_compute_node02_hostname: cmp002
 
-    # opendaylight options
-{%- if conf.MCP_VCP %}
-    opendaylight_server_node01_hostname: odl01
-    opendaylight_server_node01_single_address: ${_param:opnfv_opendaylight_server_node01_single_address}
-{%- else %}
-    opendaylight_control_hostname: ${_param:openstack_control_node02_hostname}
-    opendaylight_server_node01_hostname: ${_param:opendaylight_control_hostname}
-    opendaylight_server_node01_single_address: ${_param:opnfv_openstack_control_node02_address}
-{%- endif %}
-
     openstack_region: RegionOne
     admin_email: root@localhost
     db_connection_recycle_time: 300
@@ -7,17 +7,26 @@
 ##############################################################################
 ---
 classes:
-  - system.reclass.storage.system.opendaylight_control_single
   - cluster.mcp-common-ha.infra.config
   - cluster.mcp-odl-ha.infra
 parameters:
+  _param:
+    opendaylight_server_node01_hostname: odl01
+    opendaylight_server_node02_hostname: odl02
+    opendaylight_server_node03_hostname: odl03
   reclass:
     storage:
       node:
-        opendaylight_control_node01:
+{%- for i in range(1, 4) %}
+        opendaylight_control_node0{{ i }}:
+          name: ${_param:opendaylight_server_node0{{ i }}_hostname}
+          domain: ${_param:cluster_domain}
           classes:
             - cluster.${_param:cluster_name}.opendaylight.control
           params:
-            linux_system_codename: xenial
-            single_address: ${_param:opendaylight_server_node01_single_address}
-            pxe_admin_address: ${_param:opnfv_opendaylight_server_node01_pxe_admin_address}
+            salt_master_host: ${_param:reclass_config_master}
+            linux_system_codename: ${_param:linux_system_codename}
+            single_address: ${_param:opendaylight_server_node0{{ i }}_address}
+            pxe_admin_address: ${_param:opnfv_opendaylight_server_node0{{ i }}_pxe_admin_address}
+            keepalived_vip_priority: 10{{ i }}
+{%- endfor %}
index 09a4906..ef874cd 100644 (file)
@@ -25,17 +25,19 @@ parameters:
       cluster:
         internal:
           node:
-            odl01:
-              name: ${_param:opendaylight_server_node01_hostname}
-              provider: ${_param:infra_kvm_node02_hostname}.${_param:cluster_domain}
+  {%- for i in range(1, 4) %}
+            odl0{{ i }}:
+              name: ${_param:opendaylight_server_node0{{ i }}_hostname}
+              provider: ${_param:infra_kvm_node0{{ i }}_hostname}.${_param:cluster_domain}
               image: ${_param:salt_control_xenial_image}
               size: opendaylight.server
-{%- if conf.nodes[nm.ctl01.idx].node.arch == 'aarch64' %}
+    {%- if conf.nodes[nm.ctl01.idx].node.arch == 'aarch64' %}
               machine: virt
               cpu_mode: host-passthrough
               loader:
                 readonly: 'yes'
                 type: pflash
                 path: /usr/share/AAVMF/AAVMF_CODE.fd
-{%- endif %}
+    {%- endif %}
+  {%- endfor %}
 {%- endif %}
index 685cd9e..107965e 100644 (file)
@@ -7,7 +7,7 @@
 ##############################################################################
 ---
 classes:
-  - service.opendaylight.server.single
+  - service.opendaylight.server.cluster
   - cluster.mcp-common-ha.openstack_interface_vcp_biport
 {%- if conf.MCP_VCP %}
   - cluster.mcp-odl-ha
@@ -28,3 +28,4 @@ parameters:
           - odl-aaa-authn
         netvirt:
           - odl-netvirt-openstack
+      seed_nodes_list: {%- for i in range(1, 4) %} ${_param:opendaylight_server_node0{{ i }}_address}{%- endfor %}
index 6301e73..1dd02bb 100644 (file)
@@ -10,18 +10,30 @@ classes:
   - cluster.mcp-common-ha.openstack_init
 parameters:
   _param:
+    neutron_tenant_network_types: "flat,vxlan"
+
     # opendaylight options
-    opendaylight_service_host: ${_param:opendaylight_server_node01_single_address}
+    opendaylight_service_host: ${_param:opnfv_opendaylight_server_address}
     opendaylight_rest_port: 8282
-
-    neutron_tenant_network_types: "flat,vxlan"
 {%- if conf.MCP_VCP %}
+    opendaylight_server_node01_hostname: odl01
+    opendaylight_server_node02_hostname: odl02
+    opendaylight_server_node03_hostname: odl03
+    opendaylight_server_node01_address: ${_param:opnfv_opendaylight_server_node01_address}
+    opendaylight_server_node02_address: ${_param:opnfv_opendaylight_server_node02_address}
+    opendaylight_server_node03_address: ${_param:opnfv_opendaylight_server_node03_address}
   linux:
     network:
       host:
-        odl01:
-          address: ${_param:opendaylight_service_host}
+  {%- for i in range(1, 4) %}
+        odl0{{ i }}:
+          address: ${_param:opendaylight_server_node0{{ i }}_address}
           names:
-            - ${_param:opendaylight_server_node01_hostname}
-            - ${_param:opendaylight_server_node01_hostname}.${_param:cluster_domain}
+            - ${_param:opendaylight_server_node0{{ i }}_hostname}
+            - ${_param:opendaylight_server_node0{{ i }}_hostname}.${_param:cluster_domain}
+  {%- endfor %}
+{%- else %}
+    opendaylight_control_hostname: ${_param:openstack_control_node02_hostname}
+    opendaylight_server_node01_hostname: ${_param:opendaylight_control_hostname}
+    opendaylight_server_node01_address: ${_param:opnfv_openstack_control_node02_address}
 {%- endif %}
index e0c642a..64b2a16 100644 (file)
@@ -13,4 +13,4 @@ classes:
 
 parameters:
   _param:
-    opendaylight_service_host: ${_param:opnfv_opendaylight_server_node01_single_address}
+    opendaylight_service_host: ${_param:opnfv_opendaylight_server_node01_address}
index a3918b2..87c41b0 100644 (file)
@@ -17,7 +17,7 @@ parameters:
     network:
       host:
         odl01:
-          address: ${_param:opnfv_opendaylight_server_node01_single_address}
+          address: ${_param:opnfv_opendaylight_server_node01_address}
           names:
             - odl01
             - odl01.${_param:cluster_domain}
diff --git a/mcp/salt-formulas/salt-formula-opendaylight/metadata/service/server/cluster.yml b/mcp/salt-formulas/salt-formula-opendaylight/metadata/service/server/cluster.yml
new file mode 100644 (file)
index 0000000..69e1d84
--- /dev/null
@@ -0,0 +1,41 @@
+##############################################################################
+# Copyright (c) 2018 Mirantis Inc. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+---
+applications:
+  - opendaylight
+classes:
+  - service.keepalived.cluster.single
+parameters:
+  _param:
+    opendaylight_version: fluorine
+    keepalived_vip_virtual_router_id: 199
+    keepalived_vip_address: ${_param:opendaylight_service_host}
+    keepalived_vip_password: ${_param:opnfv_main_password}
+    keepalived_vip_interface: ${_param:single_nic}
+  opendaylight:
+    server:
+      enabled: 'True'
+      version: ${_param:opendaylight_version}
+      repo: 'odl-team/${_param:opendaylight_version}'
+      cluster_enabled: true
+      logging:
+        engine: syslog
+  keepalived:
+    cluster:
+      vrrp_scripts:
+        check_port:
+          args:
+            - ${_param:opendaylight_rest_port}
+            - TCP
+            - 4
+          interval: 15
+          rise: 3
+          fall: 1
+      instance:
+        VIP:
+          track_script: check_port
index 9874f60..f8d4964 100644 (file)
@@ -13,9 +13,8 @@
       'odl_bind_ip': '0.0.0.0',
       'repo': 'odl-team/oxygen',
       'log_levels': {},
-      'enable_ha': false,
-      'ha_node_ips': [],
-      'ha_node_index': 0,
+      'cluster_enabled': false,
+      'seed_nodes_list': [],
       'stats_polling_enabled': false,
       'dhcp': {
         'enabled': false,
index 1ae23d6..e4ebecf 100644 (file)
@@ -69,6 +69,14 @@ opendaylight_service_mask:
   - prereq:
     - pkg: opendaylight
 
+{%- if server.cluster_enabled %}
+configure_cluster:
+  cmd.run:
+  - name: /opt/opendaylight/bin/configure-cluster-ipdetect.sh {{ server.seed_nodes_list }}
+  - require:
+    - pkg: opendaylight
+{%- endif %}
+
 opendaylight:
   pkg.installed:
   - require: