From 74010ff9869cb6e1232a4aa1a3b8de971c929040 Mon Sep 17 00:00:00 2001 From: Fang Fenghua <449171342@qq.com> Date: Sun, 10 May 2015 22:45:36 +0800 Subject: [PATCH] Add neutron-openvswitch-agent contianer Implements the neutron-openvswitch-agent plugin container. Co-Authored-By: Sam Yaple Partially Implements blueprint: openvswitch-container Change-Id: Ie0fa318541e16d730b7007d3620c7873e898ed4a --- .../neutron-openvswitch-agent/Dockerfile | 11 +++++ .../neutron/neutron-openvswitch-agent/build | 1 + .../neutron-openvswitch-agent/check.sh | 1 + .../neutron-openvswitch-agent/start.sh | 1 + .../neutron-openvswitch-agent/check.sh | 13 ++++++ .../neutron-openvswitch-agent/start.sh | 45 +++++++++++++++++++ docs/integration-guide.md | 2 + 7 files changed, 74 insertions(+) create mode 100644 docker/centos/binary/neutron/neutron-openvswitch-agent/Dockerfile create mode 120000 docker/centos/binary/neutron/neutron-openvswitch-agent/build create mode 120000 docker/centos/binary/neutron/neutron-openvswitch-agent/check.sh create mode 120000 docker/centos/binary/neutron/neutron-openvswitch-agent/start.sh create mode 100755 docker/common/neutron/neutron-openvswitch-agent/check.sh create mode 100755 docker/common/neutron/neutron-openvswitch-agent/start.sh diff --git a/docker/centos/binary/neutron/neutron-openvswitch-agent/Dockerfile b/docker/centos/binary/neutron/neutron-openvswitch-agent/Dockerfile new file mode 100644 index 0000000000..3dc05bd2d4 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-openvswitch-agent/Dockerfile @@ -0,0 +1,11 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# Install required packages +RUN yum install -y openstack-neutron-openvswitch \ + openvswitch \ + && yum clean all + +COPY check.sh start.sh / + +CMD ["/start.sh"] diff --git a/docker/centos/binary/neutron/neutron-openvswitch-agent/build b/docker/centos/binary/neutron/neutron-openvswitch-agent/build new file mode 120000 index 0000000000..ec19138031 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-openvswitch-agent/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-openvswitch-agent/check.sh b/docker/centos/binary/neutron/neutron-openvswitch-agent/check.sh new file mode 120000 index 0000000000..1a664032e6 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-openvswitch-agent/check.sh @@ -0,0 +1 @@ +../../../../common/neutron/neutron-openvswitch-agent/check.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-openvswitch-agent/start.sh b/docker/centos/binary/neutron/neutron-openvswitch-agent/start.sh new file mode 120000 index 0000000000..c14edb0adf --- /dev/null +++ b/docker/centos/binary/neutron/neutron-openvswitch-agent/start.sh @@ -0,0 +1 @@ +../../../../common/neutron/neutron-openvswitch-agent/start.sh \ No newline at end of file diff --git a/docker/common/neutron/neutron-openvswitch-agent/check.sh b/docker/common/neutron/neutron-openvswitch-agent/check.sh new file mode 100755 index 0000000000..087bf4fdbf --- /dev/null +++ b/docker/common/neutron/neutron-openvswitch-agent/check.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RES=0 + +check=$(/usr/bin/neutron agent-list | awk '/ vSwitch / {print $10}') +error="ERROR: Neutron OpenvSwitch agent is not alive." + +if [[ $check != ":-)" ]]; then + echo $error >&2 + RES=1 +fi + +exit $RES diff --git a/docker/common/neutron/neutron-openvswitch-agent/start.sh b/docker/common/neutron/neutron-openvswitch-agent/start.sh new file mode 100755 index 0000000000..8c4d1a0371 --- /dev/null +++ b/docker/common/neutron/neutron-openvswitch-agent/start.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-neutron.sh +. /opt/kolla/config-sudoers.sh + +: ${NEUTRON_FLAT_NETWORK_NAME:=physnet1} +: ${NEUTRON_FLAT_NETWORK_INTERFACE:=eth1} + +check_required_vars PUBLIC_IP NEUTRON_FLAT_NETWORK_NAME \ + NEUTRON_FLAT_NETWORK_INTERFACE + +if ! ovs-vsctl show |grep ${NEUTRON_FLAT_NETWORK_INTERFACE} > /dev/null; then + ovs-vsctl add-br ${NEUTRON_FLAT_NETWORK_INTERFACE} +fi + +cfg=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini + +# Configure ml2_conf.ini +if [[ ${TYPE_DRIVERS} =~ vxlan ]]; then + crudini --set $cfg \ + vxlan \ + local_ip \ + "${PUBLIC_IP}" +fi + +crudini --set $cfg \ + ovs \ + bridge_mappings \ + "${NEUTRON_FLAT_NETWORK_NAME}:${NEUTRON_FLAT_NETWORK_INTERFACE}" + +crudini --set $cfg \ + ovs \ + tenant_network_type \ + "${TENANT_NETWORK_TYPES}" + +if [[ ${TENANT_NETWORK_TYPES} =~ "vlan" ]];then + crudini --set $cfg \ + ovs \ + network_vlan_ranges \ + "${NEUTRON_VLAN_NETWORK_NAME}:${NEUTRON_NETWORK_VLAN_RANGES}" +fi + +exec /usr/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file $cfg diff --git a/docs/integration-guide.md b/docs/integration-guide.md index 0deb75dda1..c2bfe3c612 100755 --- a/docs/integration-guide.md +++ b/docs/integration-guide.md @@ -102,6 +102,8 @@ all containers. This allows a simple method of ensuring every type of node NEUTRON_SERVER_SERVICE_HOST=<$HOST_IP> - The IP address/hostname used to commuicate with the Neutron API NEUTRON_SHARED_SECRET= - The shared secret used between Neutron/Nova to secure metadata communication NEUTRON_API_PASTE_CONFIG= - Location of Neutron's API paste config file + NEUTRON_VLAN_NETWORK_NAME= - List of physical_network names with which vlan networks can be created + NEUTRON_NETWORK_VLAN_RANGES=<1:1> - Colon seperated range of addresses TYPE_DRIVERS= - List of network type driver entrypoints to be loaded TENANT_NETWORK_TYPES= - List of network_types to allocate as tenant networks MECHANISM_DRIVERS= - List of networking mechanism driver entrypoints to be loaded