From: Michael Polenchuk Date: Fri, 28 Sep 2018 12:02:30 +0000 (+0400) Subject: [ha] Run OpenDaylight in cluster mode X-Git-Tag: opnfv-8.0.0~119^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F21%2F63021%2F5;p=fuel.git [ha] Run OpenDaylight in cluster mode Change-Id: Id75fbee34a6cfc6e7fc60df053cccaaff21cb15a Signed-off-by: Michael Polenchuk --- diff --git a/mcp/patches/docker/0002-OPNFV-package-installation-Ubuntu-user.patch b/mcp/patches/docker/0002-OPNFV-package-installation-Ubuntu-user.patch index e0526c577..eb9daeb9e 100644 --- a/mcp/patches/docker/0002-OPNFV-package-installation-Ubuntu-user.patch +++ b/mcp/patches/docker/0002-OPNFV-package-installation-Ubuntu-user.patch @@ -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' \ diff --git a/mcp/reclass/classes/cluster/mcp-common-ha/openstack_init.yml.j2 b/mcp/reclass/classes/cluster/mcp-common-ha/openstack_init.yml.j2 index 7322378eb..bb76fdb10 100644 --- a/mcp/reclass/classes/cluster/mcp-common-ha/openstack_init.yml.j2 +++ b/mcp/reclass/classes/cluster/mcp-common-ha/openstack_init.yml.j2 @@ -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 diff --git a/mcp/reclass/classes/cluster/mcp-odl-ha/infra/config.yml b/mcp/reclass/classes/cluster/mcp-odl-ha/infra/config.yml.j2 similarity index 54% rename from mcp/reclass/classes/cluster/mcp-odl-ha/infra/config.yml rename to mcp/reclass/classes/cluster/mcp-odl-ha/infra/config.yml.j2 index f72993f89..950c49355 100644 --- a/mcp/reclass/classes/cluster/mcp-odl-ha/infra/config.yml +++ b/mcp/reclass/classes/cluster/mcp-odl-ha/infra/config.yml.j2 @@ -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 %} diff --git a/mcp/reclass/classes/cluster/mcp-odl-ha/infra/kvm.yml.j2 b/mcp/reclass/classes/cluster/mcp-odl-ha/infra/kvm.yml.j2 index 09a490669..ef874cdb5 100644 --- a/mcp/reclass/classes/cluster/mcp-odl-ha/infra/kvm.yml.j2 +++ b/mcp/reclass/classes/cluster/mcp-odl-ha/infra/kvm.yml.j2 @@ -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 %} diff --git a/mcp/reclass/classes/cluster/mcp-odl-ha/opendaylight/control.yml.j2 b/mcp/reclass/classes/cluster/mcp-odl-ha/opendaylight/control.yml.j2 index 685cd9ec1..107965e99 100644 --- a/mcp/reclass/classes/cluster/mcp-odl-ha/opendaylight/control.yml.j2 +++ b/mcp/reclass/classes/cluster/mcp-odl-ha/opendaylight/control.yml.j2 @@ -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 %} diff --git a/mcp/reclass/classes/cluster/mcp-odl-ha/openstack/init.yml.j2 b/mcp/reclass/classes/cluster/mcp-odl-ha/openstack/init.yml.j2 index 6301e737a..1dd02bb8a 100644 --- a/mcp/reclass/classes/cluster/mcp-odl-ha/openstack/init.yml.j2 +++ b/mcp/reclass/classes/cluster/mcp-odl-ha/openstack/init.yml.j2 @@ -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 %} diff --git a/mcp/reclass/classes/cluster/mcp-odl-noha/init.yml b/mcp/reclass/classes/cluster/mcp-odl-noha/init.yml index e0c642a9f..64b2a16f9 100644 --- a/mcp/reclass/classes/cluster/mcp-odl-noha/init.yml +++ b/mcp/reclass/classes/cluster/mcp-odl-noha/init.yml @@ -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} diff --git a/mcp/reclass/classes/cluster/mcp-odl-noha/openstack/init.yml b/mcp/reclass/classes/cluster/mcp-odl-noha/openstack/init.yml index a3918b231..87c41b048 100644 --- a/mcp/reclass/classes/cluster/mcp-odl-noha/openstack/init.yml +++ b/mcp/reclass/classes/cluster/mcp-odl-noha/openstack/init.yml @@ -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 index 000000000..69e1d84fd --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/metadata/service/server/cluster.yml @@ -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 diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja index 9874f60cf..f8d49643b 100644 --- a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja @@ -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, diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls index 1ae23d61a..e4ebecf87 100644 --- a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls @@ -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: