summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Barrette <paul.barrette@windriver.com>2013-06-03 17:02:27 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2013-06-03 18:07:39 -0400
commit8499649a5f08e0be26ea6ef8a3feea5d97e80fa7 (patch)
tree1011104df21888bf1f8b042e03665135ebcf518c
parent7c1e073e8cde367417ca59f37cb2f5af650eea6f (diff)
downloadmeta-virtualization-8499649a5f08e0be26ea6ef8a3feea5d97e80fa7.tar.gz
openvswitch: uprev to 1.10 and documentation update.
-Uprev to 1.10 -removed vswitch_test.sh -added openvswitch.txt. Signed-off-by: Paul Barrette <paul.barrette@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--docs/00-INDEX2
-rw-r--r--docs/openvswitch.txt96
-rwxr-xr-xdocs/vswitch_test.sh36
-rw-r--r--recipes-networking/openvswitch/openvswitch_1.10.0.bb102
4 files changed, 200 insertions, 36 deletions
diff --git a/docs/00-INDEX b/docs/00-INDEX
index 41d83a54..a2ffd99f 100644
--- a/docs/00-INDEX
+++ b/docs/00-INDEX
@@ -8,3 +8,5 @@ alphabetical order as well.
800-README 800-README
9 - info on the goals of meta-virtualization and this docs subdir 9 - info on the goals of meta-virtualization and this docs subdir
10 10
11openvswitch.txt
12 - example on how to setup openvswitch with qemu/kvm.
diff --git a/docs/openvswitch.txt b/docs/openvswitch.txt
new file mode 100644
index 00000000..4410d27e
--- /dev/null
+++ b/docs/openvswitch.txt
@@ -0,0 +1,96 @@
1Simple setup for connecting openvswitch to qemu/kvm
2===================================================
3This example brings up openvswitch using a private network.
4
5Preliminary notes
6=================
71. Make sure to build kernel support for openvswitch as a module. The
8openvswitch init scripts expect to load a module and upon success
9continue to setup the switch. If openvswitch is compiled
10statically, the init scripts not load the ovs-vswitchd daemon
11and none of the configured bridges will show up in the interfaces
12table (ifconfig). You can get around this limiation by running the
13following by hand:
14 # ovs-vswitchd --pidfile --detach
15
162. Verify that ovs-vswitchd is running before proceeding:
17 # /etc/init.d/openvswitch-switch status
18 ovsdb-server is running with pid 1867
19 ovs-vswitchd is running with pid 1877
20
213. A kernel and rootfs is required for qemu bring up.
22
23Qemu Setup
24==========
25The host requires a /etc/qemu-ifup script to setup the bridging and tap
26devices. Qemu will invoke this qemu-ifup script at startup. Here is
27an example script:
28$ cat /etc/qemu-fup
29 #!/bin/sh
30 # the tap is dynamically assigned and passed into this script
31 # as a parameter
32 TAP=$1
33
34 # Note: if booting over NFS, once the $ETH0 device is added to the bridge,
35 # your host will be unusable. In that case, setup networking
36 # init scripts appropriately and change the following to work
37 # with it.
38 ETH0="eth1"
39 NETMASK=255.255.255.0
40 IP=192.168.1.1
41 GATEWAY=
42 SWITCH=ovsbr0
43 if [ -n "$TAP" ];then
44 ifconfig $TAP up
45 ifconfig $SWITCH down &>/dev/null
46 ovs-vsctl del-br $SWITCH
47 ovs-vsctl add-br $SWITCH
48 ifconfig $ETH0 0.0.0.0
49 ifconfig $SWITCH $IP up netmask $NETMASK
50 #-- external access not required for this test.
51 #route add default gw $GATEWAY
52 ovs-vsctl add-port $SWITCH $ETH0
53 ovs-vsctl add-port $SWITCH $TAP
54 exit 0
55 else
56 echo "$0: No tap device"
57 exit 1
58 fi
59
60Start Qemu
61==========
62This example will bring up qemu with a tap network interface.
63Note: this command must be run as root due to the networking setup.
64
65 $ qemu-system-x86_64 -nographic -k en-us -m 1024 \
66 -net nic,macaddr=1a:46:0b:ca:bc:7a,model=virtio \
67 -net tap -enable-kvm\
68 -kernel /opt/dpdk-guest-kernel \
69 -append 'root=/dev/vda ro console=ttyS0' \
70 -drive file=/opt/intel-xeon-core-ovp-kvm-preempt-rt-dist.ext3,cache=none,if=virtio
71
72Once the guest OS is up and running, configure the quest network interface:
73 $ ifconfig eth0 192.168.1.10
74
75Ping the bridge:
76 $ ping 192.168.1.1
77
78From the host, view the bridged network:
79$ ovs-vsctl show
80c1212b96-ef49-4a8e-b598-09b05b854dd0
81 Bridge "ovsbr0"
82 Port "tap0"
83 Interface "tap0"
84 Port "eth1"
85 Interface "eth1"
86 Port "ovsbr0"
87 Interface "ovsbr0"
88 type: internal
89
90At this point, openvswitch is up and running. If you want external
91network access, you need to set a GATEWAY in the qemu-ifup script and
92make sure the external device is part of the bridge.
93
94Note:
95Proper setup will require a /etc/qemu-ifdown script to tear down the
96bridge and interfaces. (not provided here).
diff --git a/docs/vswitch_test.sh b/docs/vswitch_test.sh
deleted file mode 100755
index 63168e38..00000000
--- a/docs/vswitch_test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
1#!/bin/sh
2
3# runqemu defaults for the first "guest"
4#
5my_inet4="192.168.7.2"
6my_gw="192.168.7.1"
7
8# create a bridge
9#
10ovs-vsctl add-br br-int
11
12# Add a physical interface to your virtual bridge for connectivity off box.
13# If your rootfs is nfs mounted (on eth0), you will die after attaching it
14# to the bridge.
15#
16ovs-vsctl add-port br-int eth0
17
18# Zero out your eth0 interface and slap it on the bridge interface.
19#
20ifconfig eth0 0
21ifconfig br-int ${my_inet4} netmask 255.255.255.0
22
23# Change your default route. If you don't do this, nothing will
24# be reachable.
25#
26route add default gw ${my_gw} br-int
27
28(You can then check that the connection works.)
29
30# The bridge configuration is persistant, so if something goes wrong
31# and you reboot, it will still be messed up. Destroy the bridge,
32# then add a route, or reboot.
33#
34ovs-vsctl del-br br-int
35ifconfig eth0 ${my_inet4}
36route add default gw ${my_gw} eth0
diff --git a/recipes-networking/openvswitch/openvswitch_1.10.0.bb b/recipes-networking/openvswitch/openvswitch_1.10.0.bb
new file mode 100644
index 00000000..2e894540
--- /dev/null
+++ b/recipes-networking/openvswitch/openvswitch_1.10.0.bb
@@ -0,0 +1,102 @@
1SUMMARY = "OpenvSwitch"
2DESCRIPTION = "Open vSwitch is a production quality, multilayer virtual switch licensed under the open source Apache 2.0 license. It is designed to enable massive network automation through programmatic extension, while still supporting standard management interfaces and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag)"
3HOMEPAGE = "http://openvswitch.org/"
4SECTION = "networking"
5LICENSE = "Apache-2"
6
7DEPENDS += "bridge-utils openssl python perl"
8
9RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid \
10 python perl perl-module-strict ${PN}-switch ${PN}-controller"
11RDEPENDS_${PN}-controller = "${PN} lsb ${PN}-pki"
12RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen"
13RDEPENDS_${PN}-pki = "${PN}"
14RDEPENDS_${PN}-brcompat = "${PN} ${PN}-switch"
15RRECOMMENDS_${PN} += "kernel-module-openvswitch"
16
17PR = "r0"
18
19SRC_URI = "http://openvswitch.org/releases/openvswitch-${PV}.tar.gz \
20 file://openvswitch-switch \
21 file://openvswitch-switch-setup \
22 file://openvswitch-controller \
23 file://openvswitch-controller-setup \
24 "
25
26SRC_URI[md5sum] = "e9004202b0e10c0de9870f19d2044f11"
27SRC_URI[sha256sum] = "825730db82c7b46a142f057a43345590c299e66704ef7a88d9ed4ffd0c3d6b64"
28LIC_FILES_CHKSUM = "file://COPYING;md5=49eeb5acb1f5e510f12c44f176c42253"
29
30# Don't compile kernel modules by default since it heavily depends on
31# kernel version. Use the in-kernel module for now.
32# distro layers can enable with EXTRA_OECONF_pn_openvswitch += ""
33# EXTRA_OECONF = "--with-linux=${STAGING_KERNEL_DIR} KARCH=${TARGET_ARCH}"
34
35ALLOW_EMPTY_${PN}-pki = "1"
36PACKAGES =+ "${PN}-controller ${PN}-switch ${PN}-brcompat ${PN}-pki"
37
38FILES_${PN}-controller = "${sysconfdir}/init.d/openvswitch-controller \
39 ${sysconfdir}/default/openvswitch-controller \
40 ${sysconfdir}/openvswitch-controller \
41 ${bindir}/ovs-controller"
42
43FILES_${PN}-brcompat = "${sbindir}/ovs-brcompatd"
44
45FILES_${PN}-switch = "${sysconfdir}/init.d/openvswitch-switch \
46 ${sysconfdir}/default/openvswitch-switch \
47 "
48# silence a warning
49FILES_${PN} += "${datadir}/ovsdbmonitor"
50
51inherit autotools update-rc.d
52
53INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-controller"
54INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch"
55INITSCRIPT_PARAMS_${PN}-switch = "defaults 71"
56
57INITSCRIPT_NAME_${PN}-controller = "openvswitch-controller"
58INITSCRIPT_PARAMS_${PN}-controller = "defaults 72"
59
60do_install_append() {
61 install -d ${D}/${sysconfdir}/default/
62 install -m 660 ${WORKDIR}/openvswitch-switch-setup ${D}/${sysconfdir}/default/openvswitch-switch
63 install -d ${D}/${sysconfdir}/openvswitch-controller
64 install -m 660 ${WORKDIR}/openvswitch-controller-setup ${D}/${sysconfdir}/default/openvswitch-controller
65
66 install -d ${D}/${sysconfdir}/init.d/
67 install -m 755 ${WORKDIR}/openvswitch-controller ${D}/${sysconfdir}/init.d/openvswitch-controller
68 install -m 755 ${WORKDIR}/openvswitch-switch ${D}/${sysconfdir}/init.d/openvswitch-switch
69 true || rm -fr ${D}/${datadir}/${PN}/pki
70}
71
72pkg_postinst_${PN}-pki () {
73 # can't do this offline
74 if [ "x$D" != "x" ]; then
75 exit 1
76 fi
77 if test ! -d $D/${datadir}/${PN}/pki; then
78 ovs-pki init --dir=$D/${datadir}/${PN}/pki
79 fi
80}
81
82pkg_postinst_${PN}-controller () {
83 # can't do this offline
84 if [ "x$D" != "x" ]; then
85 exit 1
86 fi
87
88 cd $D/${sysconfdir}/openvswitch-controller
89 if ! test -e cacert.pem; then
90 ln -s $D/${datadir}/${PN}/pki/switchca/cacert.pem cacert.pem
91 fi
92 if ! test -e privkey.pem || ! test -e cert.pem; then
93 oldumask=$(umask)
94 umask 077
95 ovs-pki req+sign --dir=$D/${datadir}/${PN}/pki tmp controller >/dev/null
96 mv tmp-privkey.pem privkey.pem
97 mv tmp-cert.pem cert.pem
98 mv tmp-req.pem req.pem
99 chmod go+r cert.pem req.pem
100 umask $oldumask
101 fi
102}