From 0971e7eed66a252861b2a4617c4f82edcd838902 Mon Sep 17 00:00:00 2001 From: Fang Fenghua <449171342@qq.com> Date: Thu, 11 Jun 2015 20:40:41 +0800 Subject: 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 Change-Id: I70e3807be32c9a07346d316e7856421ecf468b9a --- docker/common/openvswitch/ovs-db-server/start.sh | 16 ++++++++++++++++ docker/common/openvswitch/ovs-vswitchd/start.sh | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 docker/common/openvswitch/ovs-db-server/start.sh create mode 100755 docker/common/openvswitch/ovs-vswitchd/start.sh (limited to 'docker/common') diff --git a/docker/common/openvswitch/ovs-db-server/start.sh b/docker/common/openvswitch/ovs-db-server/start.sh new file mode 100755 index 000000000..a2b4d6c8f --- /dev/null +++ b/docker/common/openvswitch/ovs-db-server/start.sh @@ -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}" diff --git a/docker/common/openvswitch/ovs-vswitchd/start.sh b/docker/common/openvswitch/ovs-vswitchd/start.sh new file mode 100755 index 000000000..5ed1fbe75 --- /dev/null +++ b/docker/common/openvswitch/ovs-vswitchd/start.sh @@ -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}" -- cgit v1.2.3