Skip to content

Commit 39892f0

Browse files
author
Hui Kang
committed
Add OVS 2.7.0
- instruction for loading compiled kernel module - ovn related command Signed-off-by: Hui Kang <[email protected]>
1 parent fede885 commit 39892f0

File tree

8 files changed

+185
-7
lines changed

8 files changed

+185
-7
lines changed

2.7.0/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM socketplane/busybox:latest
2+
MAINTAINER The SocketPlane Team <[email protected]>
3+
ENV OVS_VERSION 2.7.0
4+
ENV SUPERVISOR_STDOUT_VERSION 0.1.1
5+
# Configure supervisord
6+
RUN mkdir -p /var/log/supervisor/
7+
ADD supervisord.conf /etc/
8+
# Install supervisor_stdout
9+
WORKDIR /opt
10+
RUN mkdir -p /var/log/supervisor/
11+
RUN mkdir -p /etc/openvswitch
12+
RUN wget https://pypi.python.org/packages/source/s/supervisor-stdout/supervisor-stdout-$SUPERVISOR_STDOUT_VERSION.tar.gz --no-check-certificate && \
13+
tar -xzvf supervisor-stdout-0.1.1.tar.gz && \
14+
mv supervisor-stdout-$SUPERVISOR_STDOUT_VERSION supervisor-stdout && \
15+
rm supervisor-stdout-0.1.1.tar.gz && \
16+
cd supervisor-stdout && \
17+
python setup.py install -q
18+
# Get Open vSwitch
19+
WORKDIR /
20+
RUN wget https://s3-us-west-2.amazonaws.com/docker-ovs/openvswitch-$OVS_VERSION.tar.gz --no-check-certificate && \
21+
tar -xzvf openvswitch-$OVS_VERSION.tar.gz && \
22+
mv openvswitch-$OVS_VERSION openvswitch && \
23+
cp -r openvswitch/* / && \
24+
rm -r openvswitch && \
25+
rm openvswitch-$OVS_VERSION.tar.gz
26+
27+
ADD configure-ovs.sh /usr/local/share/openvswitch/
28+
# Create the database
29+
RUN ovsdb-tool create /etc/openvswitch/conf.db /usr/local/share/openvswitch/vswitch.ovsschema
30+
# Put the OVS Python modules on the Python Path
31+
RUN cp -r /usr/local/share/openvswitch/python/ovs /usr/lib/python2.7/site-packages/ovs
32+
CMD ["/usr/bin/supervisord"]

2.7.0/configure-ovs.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
ovs_version=$(ovs-vsctl -V | grep ovs-vsctl | awk '{print $4}')
3+
ovs_db_version=$(ovsdb-tool schema-version /usr/local/share/openvswitch/vswitch.ovsschema)
4+
5+
# give ovsdb-server and vswitchd some space...
6+
sleep 3
7+
# begin configuring
8+
ovs-vsctl --no-wait -- init
9+
ovs-vsctl --no-wait -- set Open_vSwitch . db-version="${ovs_db_version}"
10+
ovs-vsctl --no-wait -- set Open_vSwitch . ovs-version="${ovs_version}"
11+
ovs-vsctl --no-wait -- set Open_vSwitch . system-type="docker-ovs"
12+
ovs-vsctl --no-wait -- set Open_vSwitch . system-version="0.1"
13+
ovs-vsctl --no-wait -- set Open_vSwitch . external-ids:system-id=`cat /proc/sys/kernel/random/uuid`
14+
ovs-vsctl --no-wait -- set-manager ptcp:6640
15+
ovs-appctl -t ovsdb-server ovsdb-server/add-remote db:Open_vSwitch,Open_vSwitch,manager_options

2.7.0/supervisord.conf

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[unix_http_server]
2+
file = /var/run/supervisor.sock
3+
4+
[inet_http_server]
5+
port = 9001
6+
7+
[supervisord]
8+
nodaemon=true
9+
logfile = /var/log/supervisor/supervisord.log
10+
logfile_maxbytes = 200KB
11+
logfile_backups = 1
12+
pidfile = /var/run/supervisord.pid
13+
childlogdir = /var/log/supervisor
14+
15+
[rpcinterface:supervisor]
16+
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
17+
18+
[supervisorctl]
19+
serverurl = unix:///var/run/supervisor.sock
20+
21+
[program:ovsdb-server]
22+
command=/usr/local/sbin/ovsdb-server /etc/openvswitch/conf.db -v --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=ptcp:6640 --pidfile=ovsdb-server.pid
23+
priority=10
24+
startsec=10
25+
stderr_events_enabled=true
26+
stdout_events_enabled=true
27+
28+
[program:ovs-vswitchd]
29+
command=/usr/local/sbin/ovs-vswitchd -v --pidfile
30+
priority=20
31+
startsec=10
32+
stderr_events_enabled=true
33+
stdout_events_enabled=true
34+
35+
[program:ovsdb-server-vtep]
36+
command=/usr/local/sbin/ovsdb-server /etc/openvswitch/conf.db /etc/openvswitch/vtep.db -v --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=ptcp:6640 --pidfile=ovsdb-server.pid --log-file
37+
autostart=false
38+
priority=10
39+
startsec=10
40+
stderr_events_enabled=true
41+
stdout_events_enabled=true
42+
43+
[program:ovsdb-server-nb]
44+
command=/usr/local/sbin/ovsdb-server /etc/openvswitch/ovnnb_db.db -v --remote=punix:/usr/local/var/run/openvswitch/ovnnb_db.sock --remote=ptcp:6641 --pidfile=ovsdb-server-nb.pid --log-file
45+
autostart=false
46+
priority=30
47+
startsec=10
48+
stderr_events_enabled=true
49+
stdout_events_enabled=true
50+
51+
[program:ovsdb-server-sb]
52+
command=/usr/local/sbin/ovsdb-server /etc/openvswitch/ovnsb_db.db -v --remote=punix:/usr/local/var/run/openvswitch/ovnsb_db.sock --remote=ptcp:6642 --pidfile=ovsdb-server-sb.pid --log-file
53+
autostart=false
54+
priority=30
55+
startsec=10
56+
stderr_events_enabled=true
57+
stdout_events_enabled=true
58+
59+
[program:ovn-northd]
60+
command=/usr/local/bin/ovn-northd -v --ovnnb-db=unix:/usr/local/var/run/openvswitch/ovnnb_db.sock --ovnsb-db=unix:/usr/local/var/run/openvswitch/ovnsb_db.sock --pidfile=ovn-northd.pid --log-file
61+
autostart=false
62+
priority=30
63+
startsec=10
64+
stderr_events_enabled=true
65+
stdout_events_enabled=true
66+
67+
[program:ovn-controller]
68+
command=/usr/local/bin/ovn-controller -v --pidfile --log-file unix:/usr/local/var/run/openvswitch/db.sock
69+
autostart=false
70+
priority=30
71+
startsec=10
72+
stderr_events_enabled=true
73+
stdout_events_enabled=true
74+
75+
[program:ovs-vtep]
76+
command=/usr/local/share/openvswitch/scripts/ovs-vtep --pidfile=/usr/local/var/run/openvswitch/ovs-vtep.pid br-vtep
77+
autostart=false
78+
priority=30
79+
startsec=10
80+
stderr_events_enabled=true
81+
stdout_events_enabled=true
82+
83+
[program:configure-ovs]
84+
command=/usr/local/share/openvswitch/configure-ovs.sh
85+
priority=30
86+
startsecs=0
87+
exitcodes=0
88+
autorestart=false
89+
stderr_events_enabled=true
90+
stdout_events_enabled=true
91+
92+
[eventlistener:stdout]
93+
command = supervisor_stdout
94+
buffer_size = 100
95+
events = PROCESS_LOG
96+
result_handler = supervisor_stdout:event_handler

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM socketplane/busybox:latest
22
MAINTAINER The SocketPlane Team <[email protected]>
3-
ENV OVS_VERSION 2.4.0
3+
ENV OVS_VERSION 2.7.0
44
ENV SUPERVISOR_STDOUT_VERSION 0.1.1
55
# Configure supervisord
66
RUN mkdir -p /var/log/supervisor/
@@ -22,7 +22,7 @@ RUN wget https://s3-us-west-2.amazonaws.com/docker-ovs/openvswitch-$OVS_VERSION.
2222
mv openvswitch-$OVS_VERSION openvswitch &&\
2323
cp -r openvswitch/* / &&\
2424
rm -r openvswitch &&\
25-
rm openvswitch-$OVS_VERSION.tar.gz
25+
rm openvswitch-$OVS_VERSION.tar.gz
2626
ADD configure-ovs.sh /usr/local/share/openvswitch/
2727
# Create the database
2828
RUN ovsdb-tool create /etc/openvswitch/conf.db /usr/local/share/openvswitch/vswitch.ovsschema

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ OVS_VERSIONS = \
2929
"2.3" \
3030
"2.3.1" \
3131
"2.3.2" \
32-
"2.4.0"
32+
"2.4.0" \
33+
"2.7.0"
3334

3435
all: reconfigure build
3536

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,26 @@ To run the container with the kernel module (assuming you have Linux Kernel 3.7+
2727

2828
modprobe openvswitch
2929
docker run -itd --cap-add NET_ADMIN socketplane/openvswitch
30-
30+
3131
While it's recommended to load the kernel module outside of the container, it is possible to load the kernel module from within:
3232

3333
cid=$(docker run -itd --cap-add NET_ADMIN --cap-add SYS_MODULE -v /lib/modules:/lib/modules socketplane/openvswitch)
3434
docker exec $cid modprobe openvswitch
3535
docker exec $cid supervisorctl restart ovs-vswitchd
3636

37+
To use openvswitch version 2.7.0+, you must load the kernel module compiled with
38+
the source
39+
40+
cid=$(docker run -itd --cap-add NET_ADMIN --cap-add SYS_MODULE -v /lib/modules:/lib/modules socketplane/openvswitch)
41+
docker exec $cid modprobe nf_nat_ipv6
42+
docker exec $cid modprobe gre
43+
docker exec $cid sh -c "insmod /usr/local/modules/*.ko"
44+
docker exec $cid supervisorctl restart ovs-vswitchd
45+
3746
> Note 1: You need the "tun" kernel module loaded to run in userspace mode
3847
> Note 2: Change the tag for a specific OVS version e.g socketplane/openvswitch:2.3.0
3948
40-
## Controlling The Processes
49+
## Controlling The Processes
4150

4251
The processes can be controlled using `supervisorctl`
4352

@@ -80,6 +89,9 @@ The follwing releases are supported:
8089
- 2.1.3
8190
- 2.3
8291
- 2.3.1
92+
- 2.3.2
93+
- 2.4.0
94+
- 2.7.0
8395

8496
### Creating bridges in Userspace Mode
8597

@@ -109,6 +121,29 @@ Example using `ovs-vsctl` and `vtep-ctl`:
109121
vtep-ctl add-port br-vtep eth0
110122
vtep-ctl set Physical_Switch br-vtep tunnel_ips=192.168.0.3
111123

124+
### OVN Support
125+
126+
OVN support is enabled on OVS verisons greater than 2.6.0
127+
128+
docker exec $cid ovsdb-tool create /etc/openvswitch/ovnnb_db.db /usr/local/share/openvswitch/ovn-nb.ovsschema
129+
docker exec $cid ovsdb-tool create /etc/openvswitch/ovnsb_db.db /usr/local/share/openvswitch/ovn-sb.ovsschema
130+
docker exec $cid ovsdb-tool create /etc/openvswitch/vtep.db /usr/local/share/openvswitch/vtep.ovsschema
131+
docker exec $cid supervisorctl start ovsdb-server-nb
132+
docker exec $cid supervisorctl start ovsdb-server-sb
133+
docker exec $cid supervisorctl start ovn-northd
134+
135+
docker exec $cid supervisorctl stop ovsdb-server
136+
docker exec $cid supervisorctl start ovsdb-server-vtep
137+
modprobe geneve
138+
ovs-vsctl set Open_vSwitch . external_ids:ovn-remote="tcp:127.0.0.1:6642" \
139+
external_ids:ovn-nb="tcp:127.0.0.1:6641" \
140+
external_ids:ovn-encap-ip=127.0.0.1 \
141+
external_ids:ovn-encap-type="geneve"
142+
143+
ovn-controller -v --pidfile --log-file unix:/usr/local/var/run/openvswitch/db.sock
144+
145+
ovn-sbctl show
146+
112147
## Building Containers
113148

114149
To build a container

configure-ovs.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ ovs-vsctl --no-wait -- set Open_vSwitch . system-version="0.1"
1313
ovs-vsctl --no-wait -- set Open_vSwitch . external-ids:system-id=`cat /proc/sys/kernel/random/uuid`
1414
ovs-vsctl --no-wait -- set-manager ptcp:6640
1515
ovs-appctl -t ovsdb-server ovsdb-server/add-remote db:Open_vSwitch,Open_vSwitch,manager_options
16-

latest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.0
1+
2.7.0

0 commit comments

Comments
 (0)