From 367a03284aa75df910872ea41ddf9a2ba0f69eed Mon Sep 17 00:00:00 2001 From: Numan Siddique Date: Thu, 20 Apr 2017 21:32:57 +0530 Subject: [PATCH] Support OVN docker images This patch adds kolla images for - ovn-northd - ovn-controller - ovsdb-server for Northbound DB - ovsdb-server for Southbound DB Change-Id: I97f82395cb14108bdff57543e4847a5ece17fe69 Implements: blueprint ovn-controller-neutron Signed-off-by: Numan Siddique --- docker/ovn/ovn-base/Dockerfile.j2 | 26 ++++++++++++++++++ docker/ovn/ovn-base/extend_start.sh | 10 +++++++ docker/ovn/ovn-controller/Dockerfile.j2 | 22 +++++++++++++++ docker/ovn/ovn-nb-db-server/Dockerfile.j2 | 27 +++++++++++++++++++ docker/ovn/ovn-nb-db-server/extend_start.sh | 6 +++++ .../ovn-nb-db-server/start_nb_db_server.sh | 11 ++++++++ docker/ovn/ovn-northd/Dockerfile.j2 | 22 +++++++++++++++ docker/ovn/ovn-sb-db-server/Dockerfile.j2 | 27 +++++++++++++++++++ docker/ovn/ovn-sb-db-server/extend_start.sh | 6 +++++ .../ovn-sb-db-server/start_sb_db_server.sh | 11 ++++++++ .../add-openvswitch-ovn-2855384c9720161e.yaml | 3 +++ 11 files changed, 171 insertions(+) create mode 100644 docker/ovn/ovn-base/Dockerfile.j2 create mode 100644 docker/ovn/ovn-base/extend_start.sh create mode 100644 docker/ovn/ovn-controller/Dockerfile.j2 create mode 100644 docker/ovn/ovn-nb-db-server/Dockerfile.j2 create mode 100644 docker/ovn/ovn-nb-db-server/extend_start.sh create mode 100755 docker/ovn/ovn-nb-db-server/start_nb_db_server.sh create mode 100644 docker/ovn/ovn-northd/Dockerfile.j2 create mode 100644 docker/ovn/ovn-sb-db-server/Dockerfile.j2 create mode 100644 docker/ovn/ovn-sb-db-server/extend_start.sh create mode 100755 docker/ovn/ovn-sb-db-server/start_sb_db_server.sh create mode 100644 releasenotes/notes/add-openvswitch-ovn-2855384c9720161e.yaml diff --git a/docker/ovn/ovn-base/Dockerfile.j2 b/docker/ovn/ovn-base/Dockerfile.j2 new file mode 100644 index 0000000000..cb095d66be --- /dev/null +++ b/docker/ovn/ovn-base/Dockerfile.j2 @@ -0,0 +1,26 @@ +FROM {{ namespace }}/{{ image_prefix }}openvswitch-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block ovn_base_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} + {% set ovn_base_packages = [ + 'openvswitch-ovn-common', + ] %} + +{% elif base_distro in ['debian', 'ubuntu'] %} + {% set ovn_base_packages = [ + 'ovn-common', + ] %} + +{% endif %} +{{ macros.install_packages(ovn_base_packages | customizable("packages")) }} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start + +RUN touch /usr/local/bin/kolla_ovn_extend_start \ + && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_ovn_extend_start + +{% block ovn_base_footer %}{% endblock %} diff --git a/docker/ovn/ovn-base/extend_start.sh b/docker/ovn/ovn-base/extend_start.sh new file mode 100644 index 0000000000..089c8f6ae1 --- /dev/null +++ b/docker/ovn/ovn-base/extend_start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/openvswitch" ]]; then + mkdir -p /var/log/kolla/openvswitch +fi +if [[ $(stat -c %a /var/log/kolla/openvswitch) != "755" ]]; then + chmod 755 /var/log/kolla/openvswitch +fi + +. /usr/local/bin/kolla_ovn_extend_start diff --git a/docker/ovn/ovn-controller/Dockerfile.j2 b/docker/ovn/ovn-controller/Dockerfile.j2 new file mode 100644 index 0000000000..d22ae8ab5f --- /dev/null +++ b/docker/ovn/ovn-controller/Dockerfile.j2 @@ -0,0 +1,22 @@ +FROM {{ namespace }}/{{ image_prefix }}ovn-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block ovn_controller_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} + {% set ovn_controller_packages = [ + 'openvswitch-ovn-host' + ] %} + +{% elif base_distro in ['debian', 'ubuntu'] %} + {% set ovn_controller_packages = [ + 'ovn-host' + ] %} + +{% endif %} +{{ macros.install_packages(ovn_controller_packages | customizable("packages")) }} + +{% block ovn_controller_footer %}{% endblock %} +{% block footer %}{% endblock %} diff --git a/docker/ovn/ovn-nb-db-server/Dockerfile.j2 b/docker/ovn/ovn-nb-db-server/Dockerfile.j2 new file mode 100644 index 0000000000..a20b134660 --- /dev/null +++ b/docker/ovn/ovn-nb-db-server/Dockerfile.j2 @@ -0,0 +1,27 @@ +FROM {{ namespace }}/{{ image_prefix }}ovn-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block ovn_nb_db_server_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} + {% set ovn_nb_db_server_packages = [ + 'openvswitch-ovn-central', + ] %} + +{% elif base_distro in ['debian', 'ubuntu'] %} + {% set ovn_nb_db_server_packages = [ + 'ovn-central', + ] %} + +{% endif %} +{{ macros.install_packages(ovn_nb_db_server_packages | customizable("packages")) }} + +COPY extend_start.sh /usr/local/bin/kolla_ovn_extend_start +COPY start_nb_db_server.sh /usr/local/bin/start-nb-db-server +RUN chmod 755 /usr/local/bin/kolla_ovn_extend_start \ + /usr/local/bin/start-nb-db-server + +{% block ovn_nb_db_server_footer %}{% endblock %} +{% block footer %}{% endblock %} diff --git a/docker/ovn/ovn-nb-db-server/extend_start.sh b/docker/ovn/ovn-nb-db-server/extend_start.sh new file mode 100644 index 0000000000..dffc85c1fe --- /dev/null +++ b/docker/ovn/ovn-nb-db-server/extend_start.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +mkdir -p "/run/openvswitch" +if [[ ! -e "/var/lib/openvswitch/ovnnb.db" ]]; then + ovsdb-tool create "/var/lib/openvswitch/ovnnb.db" "/usr/share/openvswitch/ovn-nb.ovsschema" +fi diff --git a/docker/ovn/ovn-nb-db-server/start_nb_db_server.sh b/docker/ovn/ovn-nb-db-server/start_nb_db_server.sh new file mode 100755 index 0000000000..5c5767d1c0 --- /dev/null +++ b/docker/ovn/ovn-nb-db-server/start_nb_db_server.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +ovsdb_ip=$1 +ovnnb_port=$2 +if [ -e $ovnnb_port ]; then + ovnnb_port=6641 +fi + +/usr/sbin/ovsdb-server /var/lib/openvswitch/ovnnb.db -vconsole:emer -vsyslog:err -vfile:info \ +--remote=punix:/run/openvswitch/ovnnb_db.sock --remote=ptcp:$ovnnb_port:$ovsdb_ip \ +--unixctl=/run/openvswitch/ovnnb_db.ctl --log-file=/var/log/kolla/openvswitch/ovsdb-server-nb.log diff --git a/docker/ovn/ovn-northd/Dockerfile.j2 b/docker/ovn/ovn-northd/Dockerfile.j2 new file mode 100644 index 0000000000..2f865ba879 --- /dev/null +++ b/docker/ovn/ovn-northd/Dockerfile.j2 @@ -0,0 +1,22 @@ +FROM {{ namespace }}/{{ image_prefix }}ovn-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block ovn_northd_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} + {% set ovn_northd_packages = [ + 'openvswitch-ovn-central', + ] %} + +{% elif base_distro in ['debian', 'ubuntu'] %} + {% set ovn_northd_packages = [ + 'ovn-central', + ] %} + +{% endif %} +{{ macros.install_packages(ovn_northd_packages | customizable("packages")) }} + +{% block ovn_northd_footer %}{% endblock %} +{% block footer %}{% endblock %} diff --git a/docker/ovn/ovn-sb-db-server/Dockerfile.j2 b/docker/ovn/ovn-sb-db-server/Dockerfile.j2 new file mode 100644 index 0000000000..427c3d54e8 --- /dev/null +++ b/docker/ovn/ovn-sb-db-server/Dockerfile.j2 @@ -0,0 +1,27 @@ +FROM {{ namespace }}/{{ image_prefix }}ovn-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block ovn_sb_db_server_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} + {% set ovn_sb_db_server_packages = [ + 'openvswitch-ovn-central', + ] %} + +{% elif base_distro in ['debian', 'ubuntu'] %} + {% set ovn_sb_db_server_packages = [ + 'ovn-central', + ] %} + +{% endif %} +{{ macros.install_packages(ovn_sb_db_server_packages | customizable("packages")) }} + +COPY extend_start.sh /usr/local/bin/kolla_ovn_extend_start +COPY start_sb_db_server.sh /usr/local/bin/start-sb-db-server +RUN chmod 755 /usr/local/bin/kolla_ovn_extend_start \ + /usr/local/bin/start-sb-db-server + +{% block ovn_sb_db_server_footer %}{% endblock %} +{% block footer %}{% endblock %} diff --git a/docker/ovn/ovn-sb-db-server/extend_start.sh b/docker/ovn/ovn-sb-db-server/extend_start.sh new file mode 100644 index 0000000000..688e37a0e9 --- /dev/null +++ b/docker/ovn/ovn-sb-db-server/extend_start.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +mkdir -p "/run/openvswitch" +if [[ ! -e "/var/lib/openvswitch/ovnsb.db" ]]; then + ovsdb-tool create "/var/lib/openvswitch/ovnsb.db" "/usr/share/openvswitch/ovn-sb.ovsschema" +fi diff --git a/docker/ovn/ovn-sb-db-server/start_sb_db_server.sh b/docker/ovn/ovn-sb-db-server/start_sb_db_server.sh new file mode 100755 index 0000000000..2f9cda77a1 --- /dev/null +++ b/docker/ovn/ovn-sb-db-server/start_sb_db_server.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +ovnsb_db_ip=$1 +ovnsb_port=$2 +if [ -e $ovnsb_port ]; then + ovnsb_port=6642 +fi + +/usr/sbin/ovsdb-server /var/lib/openvswitch/ovnsb.db -vconsole:emer -vsyslog:err -vfile:info \ +--remote=punix:/run/openvswitch/ovnsb_db.sock --remote=ptcp:$ovnsb_port:$ovnsb_db_ip \ +--unixctl=/run/openvswitch/ovnsb_db.ctl --log-file=/var/log/kolla/openvswitch/ovsdb-server-sb.log diff --git a/releasenotes/notes/add-openvswitch-ovn-2855384c9720161e.yaml b/releasenotes/notes/add-openvswitch-ovn-2855384c9720161e.yaml new file mode 100644 index 0000000000..708842089c --- /dev/null +++ b/releasenotes/notes/add-openvswitch-ovn-2855384c9720161e.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add openvswitch ovn support to docker containers.