Add openvswitch container

Add openvswitch containers. Openvswitch is seperated into two running
containers:
  ovs-db-server
  ovs-vswitchd

The db container is what everything interacts with. Neutron tells the db
its information, the vswitchd container reads this db and talks to the
kernel module.

The db does not need to be persistent since the plugin agent will
repopulate all the information each time it is restarted and the plugin
agent is required to be restarted when the ovs-vswitchd container is
stopped/started to ensure the ports are setup properly.

This container requires /run for the socket and /lib/modules:ro to load
the appropriate host kernel module.

This userspace tools and the kernel module do _not_ have to match
versions. Additionally, even though it is recommended that the userspace
tool be newer than the kernel version to take advantage of all the
features, it is not required.

Partially Implements blueprint: openvswitch-container

Co-Authored-By: Sam Yaple <sam@yaple.net>

Change-Id: I70e3807be32c9a07346d316e7856421ecf468b9a
This commit is contained in:
Fang Fenghua 2015-06-11 20:40:41 +08:00 committed by Sam Yaple
parent b87f16fac5
commit 0971e7eed6
10 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,5 @@
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openvswitch \
&& yum clean all

View File

@ -0,0 +1 @@
../../../../../../../tools/build-docker-image

View File

@ -0,0 +1,7 @@
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ovs-base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)
COPY ./start.sh /start.sh
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../../tools/build-docker-image

View File

@ -0,0 +1 @@
../../../../common/openvswitch/ovs-db-server/start.sh

View File

@ -0,0 +1,6 @@
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ovs-base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)
COPY ./start.sh /start.sh
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../../tools/build-docker-image

View File

@ -0,0 +1 @@
../../../../common/openvswitch/ovs-vswitchd/start.sh

View File

@ -0,0 +1,16 @@
#!/bin/bash
set -o errexit
LOG_FILE="/var/log/openvswitch/ovsdb-server.log"
DB_FILE="/etc/openvswitch/conf.db"
UNIXSOCK_DIR="/var/run/openvswitch"
UNIXSOCK="${UNIXSOCK_DIR}/db.sock"
mkdir -p "${UNIXSOCK_DIR}"
if [[ ! -e "${DB_FILE}" ]]; then
ovsdb-tool create "${DB_FILE}"
fi
exec ovsdb-server $DB_FILE -vconsole:emer -vsyslog:err -vfile:info --remote=punix:"${UNIXSOCK}" --log-file="${LOG_FILE}"

View File

@ -0,0 +1,14 @@
#!/bin/bash
set -o errexit
modprobe openvswitch
LOG_FILE="/var/log/openvswitch/ovs-vswitchd.log"
DB_FILE="/etc/openvswitch/conf.db"
UNIXSOCK_DIR="/var/run/openvswitch"
UNIXSOCK="${UNIXSOCK_DIR}/db.sock"
mkdir -p "${UNIXSOCK_DIR}"
exec ovs-vswitchd unix:"${UNIXSOCK}" -vconsole:emer -vsyslog:err -vfile:info --mlockall --log-file="${LOG_FILE}"