From d676c91a67684a7efb317d58429c49db7c562473 Mon Sep 17 00:00:00 2001 From: Michael Polenchuk Date: Wed, 12 Jul 2017 12:29:30 +0400 Subject: Apply reclass patches before salt master init Change-Id: I7bb984880e98b7bdec9aa0b3895a3be9fd75cac0 Signed-off-by: Michael Polenchuk --- mcp/patches/0001-opendaylight-reclass-system.patch | 96 +++++++++++++++++++++ .../0002-opendaylight-formula-neutron.patch | 92 ++++++++++++++++++++ mcp/patches/1a2c7f23.diff | 99 ---------------------- mcp/patches/1f59df54.diff | 98 --------------------- mcp/patches/patch.sh | 5 +- mcp/patches/patches.list | 4 +- mcp/reclass/classes/service/.keep | 0 mcp/reclass/classes/system | 2 +- mcp/scripts/salt.sh | 15 ++-- 9 files changed, 200 insertions(+), 211 deletions(-) create mode 100644 mcp/patches/0001-opendaylight-reclass-system.patch create mode 100644 mcp/patches/0002-opendaylight-formula-neutron.patch delete mode 100644 mcp/patches/1a2c7f23.diff delete mode 100644 mcp/patches/1f59df54.diff create mode 100644 mcp/reclass/classes/service/.keep diff --git a/mcp/patches/0001-opendaylight-reclass-system.patch b/mcp/patches/0001-opendaylight-reclass-system.patch new file mode 100644 index 000000000..dc7c08fdd --- /dev/null +++ b/mcp/patches/0001-opendaylight-reclass-system.patch @@ -0,0 +1,96 @@ +From: Michael Polenchuk +Date: Thu, 29 Jun 2017 12:22:42 +0400 +Subject: [PATCH] Bring in opendaylight support + +Change-Id: I3efec9a8b586a6c75b1c1635ad2a7024d73d9ad2 + +diff --git a/neutron/control/opendaylight/cluster.yml b/neutron/control/opendaylight/cluster.yml +new file mode 100644 +index 0000000..4133650 +--- /dev/null ++++ b/neutron/control/opendaylight/cluster.yml +@@ -0,0 +1,19 @@ ++classes: ++- service.keepalived.cluster.single ++- service.haproxy.proxy.single ++- service.neutron.control.cluster ++- system.haproxy.proxy.listen.openstack.neutron ++- system.neutron.control.openvswitch.cluster ++parameters: ++ neutron: ++ server: ++ backend: ++ engine: opendaylight ++ host: ${_param:opendaylight_service_host} ++ rest_api_port: 8282 ++ user: admin ++ password: admin ++ ovsdb_connection: tcp:127.0.0.1:6639 ++ mechanism: ++ ovs: ++ driver: opendaylight_v2 +diff --git a/neutron/control/opendaylight/single.yml b/neutron/control/opendaylight/single.yml +new file mode 100644 +index 0000000..19af585 +--- /dev/null ++++ b/neutron/control/opendaylight/single.yml +@@ -0,0 +1,16 @@ ++classes: ++- service.neutron.control.single ++- system.neutron.control.openvswitch.single ++parameters: ++ neutron: ++ server: ++ backend: ++ engine: opendaylight ++ host: ${_param:opendaylight_service_host} ++ rest_api_port: 8282 ++ user: admin ++ password: admin ++ ovsdb_connection: tcp:127.0.0.1:6639 ++ mechanism: ++ ovs: ++ driver: opendaylight_v2 +diff --git a/neutron/gateway/opendaylight/single.yml b/neutron/gateway/opendaylight/single.yml +new file mode 100644 +index 0000000..29c8d95 +--- /dev/null ++++ b/neutron/gateway/opendaylight/single.yml +@@ -0,0 +1,8 @@ ++classes: ++- service.neutron.gateway.single ++parameters: ++ neutron: ++ gateway: ++ backend: ++ engine: opendaylight ++ ovsdb_connection: tcp:127.0.0.1:6639 +diff --git a/opendaylight/server/single.yml b/opendaylight/server/single.yml +new file mode 100644 +index 0000000..3d11872 +--- /dev/null ++++ b/opendaylight/server/single.yml +@@ -0,0 +1,2 @@ ++classes: ++- service.opendaylight.server.single +diff --git a/reclass/storage/system/opendaylight_control_single.yml b/reclass/storage/system/opendaylight_control_single.yml +new file mode 100644 +index 0000000..890ff59 +--- /dev/null ++++ b/reclass/storage/system/opendaylight_control_single.yml +@@ -0,0 +1,15 @@ ++parameters: ++ _param: ++ opendaylight_control_hostname: odl01 ++ reclass: ++ storage: ++ node: ++ opendaylight_control_node01: ++ name: ${_param:opendaylight_control_hostname} ++ domain: ${_param:cluster_domain} ++ classes: ++ - cluster.${_param:cluster_name}.opendaylight.control ++ params: ++ salt_master_host: ${_param:reclass_config_master} ++ linux_system_codename: ${_param:linux_system_codename} ++ single_address: ${_param:opendaylight_service_host} diff --git a/mcp/patches/0002-opendaylight-formula-neutron.patch b/mcp/patches/0002-opendaylight-formula-neutron.patch new file mode 100644 index 000000000..fa175e1fa --- /dev/null +++ b/mcp/patches/0002-opendaylight-formula-neutron.patch @@ -0,0 +1,92 @@ +From: Michael Polenchuk +Date: Thu, 29 Jun 2017 12:05:25 +0400 +Subject: [PATCH] Bring in opendaylight support + +Change-Id: Ie9073fafccba336f94b1996bd85c98d7a7f5060b + +diff --git a/neutron/files/ocata/ml2_conf.ini b/neutron/files/ocata/ml2_conf.ini +index 0d48951..347eb15 100644 +--- a/neutron/files/ocata/ml2_conf.ini ++++ b/neutron/files/ocata/ml2_conf.ini +@@ -269,3 +269,11 @@ enable_security_group = True + # Use ipset to speed-up the iptables based security groups. Enabling ipset + # support requires that ipset is installed on L2 agent node. (boolean value) + #enable_ipset = true ++ ++{%- if server.backend.engine == "opendaylight" %} ++[ml2_odl] ++port_binding_controller = network-topology ++url = http://{{ server.backend.host }}:{{ server.backend.rest_api_port }}/controller/nb/v2/neutron ++username = {{ server.backend.user }} ++password = {{ server.backend.password }} ++{%- endif %} +diff --git a/neutron/files/ocata/neutron-generic.conf.Debian b/neutron/files/ocata/neutron-generic.conf.Debian +index 5b7058d..bc438b9 100644 +--- a/neutron/files/ocata/neutron-generic.conf.Debian ++++ b/neutron/files/ocata/neutron-generic.conf.Debian +@@ -33,7 +33,7 @@ state_path = /var/lib/neutron + #auth_strategy = keystone + auth_strategy = keystone + +-{% if neutron.backend.engine == "ml2" %} ++{% if neutron.backend.engine in ["ml2", "opendaylight"] %} + + core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin + +diff --git a/neutron/files/ocata/neutron-server b/neutron/files/ocata/neutron-server +index 54f6ceb..1682ee0 100644 +--- a/neutron/files/ocata/neutron-server ++++ b/neutron/files/ocata/neutron-server +@@ -7,7 +7,7 @@ + # neutron.conf + #NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" + +-{%- if server.backend.engine == "ml2" %} ++{%- if server.backend.engine in ["ml2", "opendaylight"] %} + NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/ml2/ml2_conf.ini" + {%- endif %} + +diff --git a/neutron/files/ocata/neutron-server.conf.Debian b/neutron/files/ocata/neutron-server.conf.Debian +index e320ca4..d6de235 100644 +--- a/neutron/files/ocata/neutron-server.conf.Debian ++++ b/neutron/files/ocata/neutron-server.conf.Debian +@@ -39,7 +39,7 @@ api_extensions_path = extensions:/usr/lib/python2.7/dist-packages/neutron_plugin + core_plugin = neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2 + + service_plugins = neutron_plugin_contrail.plugins.opencontrail.loadbalancer.v2.plugin.LoadBalancerPluginV2 +-{% elif server.backend.engine == "ml2" %} ++{% elif server.backend.engine in ["ml2", "opendaylight"] %} + + core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin + +@@ -831,7 +831,7 @@ allow_headers = {{ server.cors.allow_headers }} + # Deprecated group/name - [DEFAULT]/sql_connection + # Deprecated group/name - [DATABASE]/sql_connection + # Deprecated group/name - [sql]/connection +-{% if server.backend.engine == "ml2" %} ++{% if server.backend.engine in ["ml2", "opendaylight"] %} + connection = {{ server.database.engine }}+pymysql://{{ server.database.user }}:{{ server.database.password }}@{{ server.database.host }}/{{ server.database.name }}?charset=utf8 + {% else %} + connection = sqlite:////var/lib/neutron/neutron.sqlite +@@ -2194,3 +2194,8 @@ service_provider = LOADBALANCERV2:Opencontrail:neutron_plugin_contrail.plugins.o + {% include "neutron/files/"+server.version+"/ContrailPlugin.ini" %} + + {% endif %} ++ ++{%- if server.backend.engine == "opendaylight" %} ++[ovs] ++ovsdb_connection = {{ server.backend.ovsdb_connection }} ++{%- endif %} +diff --git a/neutron/server.sls b/neutron/server.sls +index 0b3a6be..7a6bd23 100644 +--- a/neutron/server.sls ++++ b/neutron/server.sls +@@ -64,7 +64,7 @@ neutron_server_service: + + {%- endif %} + +-{% if server.backend.engine == "ml2" %} ++{% if server.backend.engine in ["ml2", "opendaylight"] %} + + /etc/neutron/plugins/ml2/ml2_conf.ini: + file.managed: diff --git a/mcp/patches/1a2c7f23.diff b/mcp/patches/1a2c7f23.diff deleted file mode 100644 index 27ef9161e..000000000 --- a/mcp/patches/1a2c7f23.diff +++ /dev/null @@ -1,99 +0,0 @@ -From 1a2c7f23229050b1694565c5e2ee13146001eb18 Mon Sep 17 00:00:00 2001 -From: Michael Polenchuk -Date: Thu, 29 Jun 2017 12:05:25 +0400 -Subject: [PATCH] Bring in opendaylight support - -Change-Id: Ie9073fafccba336f94b1996bd85c98d7a7f5060b ---- - -diff --git a/neutron/files/ocata/ml2_conf.ini b/neutron/files/ocata/ml2_conf.ini -index 0d48951..347eb15 100644 ---- a/neutron/files/ocata/ml2_conf.ini -+++ b/neutron/files/ocata/ml2_conf.ini -@@ -269,3 +269,11 @@ - # Use ipset to speed-up the iptables based security groups. Enabling ipset - # support requires that ipset is installed on L2 agent node. (boolean value) - #enable_ipset = true -+ -+{%- if server.backend.engine == "opendaylight" %} -+[ml2_odl] -+port_binding_controller = network-topology -+url = http://{{ server.backend.host }}:{{ server.backend.rest_api_port }}/controller/nb/v2/neutron -+username = {{ server.backend.user }} -+password = {{ server.backend.password }} -+{%- endif %} -diff --git a/neutron/files/ocata/neutron-generic.conf.Debian b/neutron/files/ocata/neutron-generic.conf.Debian -index 5b7058d..bc438b9 100644 ---- a/neutron/files/ocata/neutron-generic.conf.Debian -+++ b/neutron/files/ocata/neutron-generic.conf.Debian -@@ -33,7 +33,7 @@ - #auth_strategy = keystone - auth_strategy = keystone - --{% if neutron.backend.engine == "ml2" %} -+{% if neutron.backend.engine in ["ml2", "opendaylight"] %} - - core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin - -diff --git a/neutron/files/ocata/neutron-server b/neutron/files/ocata/neutron-server -index 54f6ceb..1682ee0 100644 ---- a/neutron/files/ocata/neutron-server -+++ b/neutron/files/ocata/neutron-server -@@ -7,10 +7,10 @@ - # neutron.conf - #NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" - --{%- if server.backend.engine == "ml2" %} -+{%- if server.backend.engine in ["ml2", "opendaylight"] %} - NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/ml2/ml2_conf.ini" - {%- endif %} - - {%- if server.backend.engine == "contrail" %} - NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/opencontrail/ContrailPlugin.ini" --{%- endif %} -\ No newline at end of file -+{%- endif %} -diff --git a/neutron/files/ocata/neutron-server.conf.Debian b/neutron/files/ocata/neutron-server.conf.Debian -index e320ca4..d6de235 100644 ---- a/neutron/files/ocata/neutron-server.conf.Debian -+++ b/neutron/files/ocata/neutron-server.conf.Debian -@@ -39,7 +39,7 @@ - core_plugin = neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2 - - service_plugins = neutron_plugin_contrail.plugins.opencontrail.loadbalancer.v2.plugin.LoadBalancerPluginV2 --{% elif server.backend.engine == "ml2" %} -+{% elif server.backend.engine in ["ml2", "opendaylight"] %} - - core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin - -@@ -831,7 +831,7 @@ - # Deprecated group/name - [DEFAULT]/sql_connection - # Deprecated group/name - [DATABASE]/sql_connection - # Deprecated group/name - [sql]/connection --{% if server.backend.engine == "ml2" %} -+{% if server.backend.engine in ["ml2", "opendaylight"] %} - connection = {{ server.database.engine }}+pymysql://{{ server.database.user }}:{{ server.database.password }}@{{ server.database.host }}/{{ server.database.name }}?charset=utf8 - {% else %} - connection = sqlite:////var/lib/neutron/neutron.sqlite -@@ -2194,3 +2194,8 @@ - {% include "neutron/files/"+server.version+"/ContrailPlugin.ini" %} - - {% endif %} -+ -+{%- if server.backend.engine == "opendaylight" %} -+[ovs] -+ovsdb_connection = {{ server.backend.ovsdb_connection }} -+{%- endif %} -diff --git a/neutron/server.sls b/neutron/server.sls -index 0b3a6be..7a6bd23 100644 ---- a/neutron/server.sls -+++ b/neutron/server.sls -@@ -64,7 +64,7 @@ - - {%- endif %} - --{% if server.backend.engine == "ml2" %} -+{% if server.backend.engine in ["ml2", "opendaylight"] %} - - /etc/neutron/plugins/ml2/ml2_conf.ini: - file.managed: diff --git a/mcp/patches/1f59df54.diff b/mcp/patches/1f59df54.diff deleted file mode 100644 index 9d1c6fe4d..000000000 --- a/mcp/patches/1f59df54.diff +++ /dev/null @@ -1,98 +0,0 @@ -From 1f59df548f3e1461cc0ebf70c29a89205385eb20 Mon Sep 17 00:00:00 2001 -From: Michael Polenchuk -Date: Thu, 29 Jun 2017 12:22:42 +0400 -Subject: [PATCH] Bring in opendaylight support - -Change-Id: I3efec9a8b586a6c75b1c1635ad2a7024d73d9ad2 ---- - -diff --git a/neutron/control/opendaylight/cluster.yml b/neutron/control/opendaylight/cluster.yml -new file mode 100644 -index 0000000..4133650 ---- /dev/null -+++ b/neutron/control/opendaylight/cluster.yml -@@ -0,0 +1,19 @@ -+classes: -+- service.keepalived.cluster.single -+- service.haproxy.proxy.single -+- service.neutron.control.cluster -+- system.haproxy.proxy.listen.openstack.neutron -+- system.neutron.control.openvswitch.cluster -+parameters: -+ neutron: -+ server: -+ backend: -+ engine: opendaylight -+ host: ${_param:opendaylight_service_host} -+ rest_api_port: 8282 -+ user: admin -+ password: admin -+ ovsdb_connection: tcp:127.0.0.1:6639 -+ mechanism: -+ ovs: -+ driver: opendaylight_v2 -diff --git a/neutron/control/opendaylight/single.yml b/neutron/control/opendaylight/single.yml -new file mode 100644 -index 0000000..19af585 ---- /dev/null -+++ b/neutron/control/opendaylight/single.yml -@@ -0,0 +1,16 @@ -+classes: -+- service.neutron.control.single -+- system.neutron.control.openvswitch.single -+parameters: -+ neutron: -+ server: -+ backend: -+ engine: opendaylight -+ host: ${_param:opendaylight_service_host} -+ rest_api_port: 8282 -+ user: admin -+ password: admin -+ ovsdb_connection: tcp:127.0.0.1:6639 -+ mechanism: -+ ovs: -+ driver: opendaylight_v2 -diff --git a/neutron/gateway/opendaylight/single.yml b/neutron/gateway/opendaylight/single.yml -new file mode 100644 -index 0000000..29c8d95 ---- /dev/null -+++ b/neutron/gateway/opendaylight/single.yml -@@ -0,0 +1,8 @@ -+classes: -+- service.neutron.gateway.single -+parameters: -+ neutron: -+ gateway: -+ backend: -+ engine: opendaylight -+ ovsdb_connection: tcp:127.0.0.1:6639 -diff --git a/opendaylight/server/single.yml b/opendaylight/server/single.yml -new file mode 100644 -index 0000000..3d11872 ---- /dev/null -+++ b/opendaylight/server/single.yml -@@ -0,0 +1,2 @@ -+classes: -+- service.opendaylight.server.single -diff --git a/reclass/storage/system/opendaylight_control_single.yml b/reclass/storage/system/opendaylight_control_single.yml -new file mode 100644 -index 0000000..890ff59 ---- /dev/null -+++ b/reclass/storage/system/opendaylight_control_single.yml -@@ -0,0 +1,15 @@ -+parameters: -+ _param: -+ opendaylight_control_hostname: odl01 -+ reclass: -+ storage: -+ node: -+ opendaylight_control_node01: -+ name: ${_param:opendaylight_control_hostname} -+ domain: ${_param:cluster_domain} -+ classes: -+ - cluster.${_param:cluster_name}.opendaylight.control -+ params: -+ salt_master_host: ${_param:reclass_config_master} -+ linux_system_codename: ${_param:linux_system_codename} -+ single_address: ${_param:opendaylight_service_host} diff --git a/mcp/patches/patch.sh b/mcp/patches/patch.sh index 9f9cdea0e..d7db73591 100755 --- a/mcp/patches/patch.sh +++ b/mcp/patches/patch.sh @@ -1,8 +1,7 @@ -#!/bin/sh +#!/bin/bash if [ -r "$1" ]; then while IFS=': ' read -r p_dest p_file; do - patch -d $p_dest -p1 < /root/fuel/mcp/patches/$p_file + [[ "${p_dest}" =~ $2 ]] && patch -fd "${p_dest}" -p1 < "/root/fuel/mcp/patches/${p_file}" done < $1 fi - diff --git a/mcp/patches/patches.list b/mcp/patches/patches.list index a36bc06a1..0a84657d2 100644 --- a/mcp/patches/patches.list +++ b/mcp/patches/patches.list @@ -1,2 +1,2 @@ -/srv/salt/env/prd: 1a2c7f23.diff -/srv/salt/reclass/classes/system: 1f59df54.diff +/usr/share/salt-formulas/env: 0002-opendaylight-formula-neutron.patch +/srv/salt/reclass/classes/system: 0001-opendaylight-reclass-system.patch diff --git a/mcp/reclass/classes/service/.keep b/mcp/reclass/classes/service/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/mcp/reclass/classes/system b/mcp/reclass/classes/system index d2e5ecd5c..18f5a999f 160000 --- a/mcp/reclass/classes/system +++ b/mcp/reclass/classes/system @@ -1 +1 @@ -Subproject commit d2e5ecd5ca54243b18b40f7e2805374e338b7dec +Subproject commit 18f5a999f03e50de311ef8831ba51b001af3e92c diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh index c87645024..605da89ee 100755 --- a/mcp/scripts/salt.sh +++ b/mcp/scripts/salt.sh @@ -17,21 +17,20 @@ ssh ${SSH_OPTS} ubuntu@${SALT_MASTER} bash -s << SALT_INSTALL_END git clone --depth=1 --recurse-submodules https://git.opnfv.org/fuel ln -s /root/fuel/mcp/reclass /srv/salt/reclass + mkdir -p /usr/share/salt-formulas/reclass + cp -r /root/fuel/mcp/metadata/service /usr/share/salt-formulas/reclass + cd /srv/salt/reclass/classes/service && ln -s /usr/share/salt-formulas/reclass/service/opendaylight + cd /root/fuel/mcp/patches && ./patch.sh patches.list reclass + cd /srv/salt/scripts MASTER_HOSTNAME=cfg01.${CLUSTER_DOMAIN} DISTRIB_REVISION=nightly ./salt-master-init.sh salt-key -Ay - cp -r /root/fuel/mcp/metadata/service /usr/share/salt-formulas/reclass cp -r /root/fuel/mcp/salt-formulas/* /usr/share/salt-formulas/env - cd /srv/salt/reclass/classes/service && ln -s /usr/share/salt-formulas/reclass/service/opendaylight - - cd /root/fuel/mcp/patches && ./patch.sh patches.list - - salt '*' saltutil.refresh_pillar - salt '*' saltutil.sync_all + cd /root/fuel/mcp/patches && ./patch.sh patches.list formulas salt-call state.apply salt - salt '*' state.apply salt || salt '*' state.apply salt + salt '*' state.apply salt | fgrep -q 'No response' && salt '*' state.apply salt salt -C 'I@salt:master' state.sls linux salt -C '* and not cfg01*' state.sls linux -- cgit 1.2.3-korg