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 <nusiddiq@redhat.com>
This commit is contained in:
Numan Siddique 2017-04-20 21:32:57 +05:30
parent 43048c5be9
commit 367a03284a
11 changed files with 171 additions and 0 deletions

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,3 @@
---
features:
- Add openvswitch ovn support to docker containers.