Mail archive
alpine-devel

[alpine-devel] [PATCH] /testing/openvswitch - version bump to 2.01 + revised init scripts

From: Stuart Cardall <developer_at_it-offshore.co.uk>
Date: Wed, 12 Mar 2014 17:36:50 +0000

** This is a clean patch against Master **

Version bump to 2.0.1

Init scripts improved to start ovsdb-server & ovs-vswitchd before
networking comes up. ovs-dbserver is now a hard dependency for
ovs-vswitchd to keep them in sync & prevent a hanging boot process.

LXC Guests now autostart correctly on reboots. MACVLAN interfaces
work out of the box with LXC. To use VETH interfaces with LXC do
*NOT* set 'lxc.network.link' in /var/lib/lxc/guest/config - the
VETH must be added manually with:

ovs-vsctl --may-exist add-br $BRIDGE
ovs-vsctl --may-exist add-port $BRIDGE $PORT

I removed ovs-controller as it's not needed to run openvswitch &
is no longer part of the current git. ovs-monitor will be
removed from a default installation in the next release as it is
poorly maintained & nobody really uses it.

I've tested openvswitch 2.0.1 & have it bridging VETH across NAT
& bridging MACVLAN interfaces internally without any problems.
Bonding should also work.
---
 testing/openvswitch/APKBUILD                       | 84 +++++++++++-----------
 testing/openvswitch/openvswitch.post-install       | 26 +++++--
 testing/openvswitch/openvswitch.post-upgrade       | 26 +++++--
 testing/openvswitch/ovs-controller.confd           |  6 --
 testing/openvswitch/ovs-controller.initd           | 23 ------
 testing/openvswitch/ovs-modules.initd              | 25 +++++++
 testing/openvswitch/ovs-vswitchd.initd             |  5 +-
 testing/openvswitch/ovsdb-server.confd             |  8 +--
 testing/openvswitch/ovsdb-server.initd             |  7 +-
 testing/openvswitch/remove-test-atomic-8byte.patch | 31 ++++++++
 10 files changed, 157 insertions(+), 84 deletions(-)
 delete mode 100644 testing/openvswitch/ovs-controller.confd
 delete mode 100644 testing/openvswitch/ovs-controller.initd
 create mode 100644 testing/openvswitch/ovs-modules.initd
 create mode 100644 testing/openvswitch/remove-test-atomic-8byte.patch
diff --git a/testing/openvswitch/APKBUILD b/testing/openvswitch/APKBUILD
index f4bbfdc..8354780 100644
--- a/testing/openvswitch/APKBUILD
+++ b/testing/openvswitch/APKBUILD
_at_@ -1,9 +1,9 @@
-# Contributor: William Pitcock <nenolod_at_dereferenced.org>
-# Maintainer: William Pitcock <nenolod_at_dereferenced.org>
+# Contributor: Stuart Cardall <developer_at_it-offshore.co.uk>
+# Maintainer: Stuart Cardall <developer_at_it-offshore.co.uk>
 pkgname=openvswitch
-pkgver=1.11.0
-pkgrel=1
-pkgdesc="an open virtual switch"
+pkgver=2.0.1
+pkgrel=0
+pkgdesc="A production quality, multilayer virtual switch - includes Kernel Modules for best performance."
 url="http://openvswitch.org/"
 arch="all"
 license="GPL"
_at_@ -13,34 +13,40 @@ depends_monitor="py-twisted py-twisted-web2 py-qt"
 makedepends="perl $depends_dev $depends_monitor"
 install="openvswitch.post-install openvswitch.post-upgrade"
 subpackages="$pkgname-doc $pkgname-monitor"
-source="http://openvswitch.org/releases/openvswitch-$pkgver.tar.gz
+source="http://openvswitch.org/releases/$pkgname-$pkgver.tar.gz
 	ovsdb-server.initd
 	ovsdb-server.confd
-	ovs-controller.initd
-	ovs-controller.confd
 	ovs-vswitchd.initd
-	ovs-vswitchd.confd"
+	ovs-vswitchd.confd
+	ovs-modules.initd"
+
+_builddir="$srcdir"/$pkgname-$pkgver
 
-_builddir="$srcdir"/openvswitch-$pkgver
 prepare() {
 	local i
-	cd "$_builddir"
-	for i in $source; do
-		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
-		esac
-	done
+        cd "$_builddir"
+	#patch not needed after v2.0.1 https://www.mail-archive.com/dev_at_openvswitch.org/msg25840.html
+	patch -p1 -i ../../remove-test-atomic-8byte.patch || return 1
+
+        for i in $source; do
+                case $i in
+                *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+                esac
+        done
 }
 
 build() {
 	cd "$_builddir"
+	./boot.sh \
+	./configure # must be run twice to generate & update makefile or build fails
 	./configure --prefix=/usr \
 		--sysconfdir=/etc \
 		--mandir=/usr/share/man \
 		--infodir=/usr/share/info \
 		--localstatedir=/var \
+		--enable-ndebug \
 		|| return 1
-	make || return 1
+	make CONFIG_DEBUG_SECTION_MISMATCH=y || return 1
 }
 
 monitor() {
_at_@ -53,34 +59,30 @@ package() {
 	cd "$_builddir"
 	make DESTDIR="$pkgdir" install || return 1
 	rm -f "$pkgdir"/usr/lib/*.la
+	rm -f "$pkgdir"/usr/lib/*.a
 
 	install -Dm755 "$srcdir"/ovsdb-server.initd "$pkgdir"/etc/init.d/ovsdb-server
-	install -Dm755 "$srcdir"/ovs-controller.initd "$pkgdir"/etc/init.d/ovs-controller
 	install -Dm755 "$srcdir"/ovs-vswitchd.initd "$pkgdir"/etc/init.d/ovs-vswitchd
-
+	install -Dm755 "$srcdir"/ovs-modules.initd "$pkgdir"/etc/init.d/ovs-modules
 	install -Dm644 "$srcdir"/ovsdb-server.confd "$pkgdir"/etc/conf.d/ovsdb-server
-	install -Dm644 "$srcdir"/ovs-controller.confd "$pkgdir"/etc/conf.d/ovs-controller
 	install -Dm644 "$srcdir"/ovs-vswitchd.confd "$pkgdir"/etc/conf.d/ovs-vswitchd
 }
 
-md5sums="81231a77dcd38181dbc1cb701e4fc9d0  openvswitch-1.11.0.tar.gz
-b9b6b23d349d5563d70a1c6d0a5b677c  ovsdb-server.initd
-9c2c1d774be02f2e69609bcc4f24a370  ovsdb-server.confd
-1315fb5ed8b70ceec97f76206fa14849  ovs-controller.initd
-0f5ce60dda512b29d4e20cb832e062d4  ovs-controller.confd
-92f26091d52353bf248e9bdc332ad418  ovs-vswitchd.initd
-2d1e0111ea62779f49e14d62678294b2  ovs-vswitchd.confd"
-sha256sums="007d7d3f2deabe5a3845d1045d23b6b1de174497a8e436091541221dd71833da  openvswitch-1.11.0.tar.gz
-2a9a3bd0277362fcdab62b7ea86ae2e488e099d9ed724dc27648136e5f5ed93c  ovsdb-server.initd
-15c508d134fed8cda13e2d394fc7c20b9868294a30e73a952ebffd31df129251  ovsdb-server.confd
-62eeaa3a5d53c2048201d894d5cd97df3b728a4e7cb5beb168a190c6cad111e0  ovs-controller.initd
-950996914d7991550ead5fcfb5b262c60b5f53df6796c111105baa2a89a39431  ovs-controller.confd
-ca809e55e4540b905aa2a1afea9624cd0a52c31d833db9ed2b57eb5a905f6058  ovs-vswitchd.initd
-cc189d5ca24708ff775a4de312df3f611c65714724b8901ec6527c9e3f22e14a  ovs-vswitchd.confd"
-sha512sums="9c338a9e376c845ae5f273030263dbae52fa268350d943e65987d6840d9647194f715e36517c829be32200f1064e13a585bd5b2acb9fa2a7f32199bd4be31459  openvswitch-1.11.0.tar.gz
-4d031347b146cf82812cb0fc1ead944d6e29a9a8bd2afe603c4003b6f8c9d2f9d0c5f7e2ebdad456e7f5af4b01c756203cd96cc44db7be266bf94ac9bba188ff  ovsdb-server.initd
-a9aab68cf5188ebdff520e8ae1bc90018fab13fea5cf7c36dda42a4acdeb842de8344191f2f52213ea173a73e647fe48e7bd29ce6974c9bf3880d0f91a3713aa  ovsdb-server.confd
-b48b9405c16dc117213071a32000f155c08cf7c4d28333090f7f5ba8871f7b4dddeec6908b34a97101a9d973dff69da773f0b941c92d330fd7cc3f282dfb0744  ovs-controller.initd
-e8f28b01a080d4ba11db7f17e61d4352241194e723fc198cc1c7ce60717be297025b892633599be3e1dc86dec525c1be41b9f22a5c06b8a4c267555195c92dc9  ovs-controller.confd
-d160ac8bf80e3b0e7cb7d434842950381b248e96bfdd00d9b6d0ae6c762dbbcd0f351739adf54e6b3f677e84a800ad62355d7f7771ff0a4965824744ea853f8f  ovs-vswitchd.initd
-346aea099f51707d2b4fc9fdc8c1502582723fb4e00c4d5d1624b0378c94dfb76674fa95e2af894f36169df52109dbe441ee6a45aa744584d9e4c74d15a46c1d  ovs-vswitchd.confd"
+md5sums="a2122b1c293c8d05dc0c673d42a9da08  openvswitch-2.0.1.tar.gz
+464eafc0e07aada01495470f5f816f36  ovsdb-server.initd
+f10a8ac784654bec359bda52779f16fe  ovsdb-server.confd
+003297c9ec93877508812332101c2bf5  ovs-vswitchd.initd
+2d1e0111ea62779f49e14d62678294b2  ovs-vswitchd.confd
+ae128e5c349710c0fb3849b2d3b3aa40  ovs-modules.initd"
+sha256sums="014907bcf2f98228dfa4472ea1547871d24b8fb8192dcfff3ead1af93c433a67  openvswitch-2.0.1.tar.gz
+b58a4bdab9ca035a9271067edadb19598985c55820f020d8aefe71b516a3e7f6  ovsdb-server.initd
+d0d8a6a7256f4cc47ab1b9f9f7657202388133bcfff3668e7c1d4adbcc572261  ovsdb-server.confd
+591d8c10080ba2fa2ddf5bf8da281d931421c95ff728f56fbaa10be7c3d8431c  ovs-vswitchd.initd
+cc189d5ca24708ff775a4de312df3f611c65714724b8901ec6527c9e3f22e14a  ovs-vswitchd.confd
+94f4dba5e2ddedb9c91911b02dbfc41a5114e8a5066a8db3ef4444ebb5400173  ovs-modules.initd"
+sha512sums="4207cac887c9e2dad234d1e2b70d5309e51b8d10dbe994f125ff9e967935f3674574651c9fb297cf59dbc355830f2947cd98e4f5d28aaf495b9b950a9f603eeb  openvswitch-2.0.1.tar.gz
+6d660c986666b3f3b052d5ff6a8555c8bf5234fee8c4740d70974b1ac00ee2a0711e931494556290e18fce820ce8f2d4a5f25e40e9c863da9b639c18c0515763  ovsdb-server.initd
+b1588d076bbfc7ef2dd46fce8e46186f40cbbc4667697f7ac13ddc68e34568fdab315fde47838de7f6d32916853190336cfe3735f672ad7cb624ae14dbff55a5  ovsdb-server.confd
+3d493047a6729b7e0742438de828a2530acbcdac9c1c410786bf1eefb5e9f09850fb479f45245f550d1077146d4545fb91a845ae79f673b6c1c2902220920e33  ovs-vswitchd.initd
+346aea099f51707d2b4fc9fdc8c1502582723fb4e00c4d5d1624b0378c94dfb76674fa95e2af894f36169df52109dbe441ee6a45aa744584d9e4c74d15a46c1d  ovs-vswitchd.confd
+e1f88ff11cd1d5a4025626acad49411e8a2d5d7caa20d0a63ef0422a9b1bb55b070843327d8bb209e1e915d2a3f1c3bcae911acf40e0a419bc6cce6250239232  ovs-modules.initd"
diff --git a/testing/openvswitch/openvswitch.post-install b/testing/openvswitch/openvswitch.post-install
index 2c3ea69..6dc42a2 100644
--- a/testing/openvswitch/openvswitch.post-install
+++ b/testing/openvswitch/openvswitch.post-install
_at_@ -1,11 +1,29 @@
 #!/bin/sh
 
+NORMAL="\033[1;0m"
+STRONG="\033[1;1m"
+RED="\033[1;31m"
+GREEN="\033[1;32m"
+
+print_red() {
+        local prompt="${RED}${STRONG}$1 ${NORMAL}"
+        printf "${prompt} %s\n"
+}
+
+print_green() {
+        local prompt="${GREEN}${STRONG}$1 ${NORMAL}"
+        printf "${prompt} %s\n"
+}
+
 db="/etc/openvswitch/conf.db"
 if [ -e "$db" ]; then
-	echo "Trying schema migration for $db..."
-	ovsdb-tool convert "$db" "/usr/share/openvswitch/vswitch.ovsschema"
+        print_red "\nStopping OVS Database\n"; rc-service ovsdb-server stop
+        print_green "\nTrying schema migration for $db..."
+        ovsdb-tool convert "$db" "/usr/share/openvswitch/vswitch.ovsschema"
+        print_green "\nStarting OVS Database\n"; rc-service ovsdb-server start
 else
-	echo "Creating new Open vSwitch database $db..."
-	ovsdb-tool create "$db" "/usr/share/openvswitch/vswitch.ovsschema"
+        print_green "\nCreating new Open vSwitch database $db...\n"
+        ovsdb-tool create "$db" "/usr/share/openvswitch/vswitch.ovsschema"
 fi
 
+
diff --git a/testing/openvswitch/openvswitch.post-upgrade b/testing/openvswitch/openvswitch.post-upgrade
index 2c3ea69..6dc42a2 100644
--- a/testing/openvswitch/openvswitch.post-upgrade
+++ b/testing/openvswitch/openvswitch.post-upgrade
_at_@ -1,11 +1,29 @@
 #!/bin/sh
 
+NORMAL="\033[1;0m"
+STRONG="\033[1;1m"
+RED="\033[1;31m"
+GREEN="\033[1;32m"
+
+print_red() {
+        local prompt="${RED}${STRONG}$1 ${NORMAL}"
+        printf "${prompt} %s\n"
+}
+
+print_green() {
+        local prompt="${GREEN}${STRONG}$1 ${NORMAL}"
+        printf "${prompt} %s\n"
+}
+
 db="/etc/openvswitch/conf.db"
 if [ -e "$db" ]; then
-	echo "Trying schema migration for $db..."
-	ovsdb-tool convert "$db" "/usr/share/openvswitch/vswitch.ovsschema"
+        print_red "\nStopping OVS Database\n"; rc-service ovsdb-server stop
+        print_green "\nTrying schema migration for $db..."
+        ovsdb-tool convert "$db" "/usr/share/openvswitch/vswitch.ovsschema"
+        print_green "\nStarting OVS Database\n"; rc-service ovsdb-server start
 else
-	echo "Creating new Open vSwitch database $db..."
-	ovsdb-tool create "$db" "/usr/share/openvswitch/vswitch.ovsschema"
+        print_green "\nCreating new Open vSwitch database $db...\n"
+        ovsdb-tool create "$db" "/usr/share/openvswitch/vswitch.ovsschema"
 fi
 
+
diff --git a/testing/openvswitch/ovs-controller.confd b/testing/openvswitch/ovs-controller.confd
deleted file mode 100644
index 86e6c1d..0000000
--- a/testing/openvswitch/ovs-controller.confd
+++ /dev/null
_at_@ -1,6 +0,0 @@
-# Space separated list of methods to listen for OpenFlow connections from switches
-# The default is "ptcp:" which starts ovs-controller listening on port 6633 on all interfaces.
-METHODS="ptcp:"
-
-# Additional options
-# OPTIONS=""
diff --git a/testing/openvswitch/ovs-controller.initd b/testing/openvswitch/ovs-controller.initd
deleted file mode 100644
index dea1f67..0000000
--- a/testing/openvswitch/ovs-controller.initd
+++ /dev/null
_at_@ -1,23 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/openvswitch/files/ovs-controller-r1,v 1.1 2013/04/08 19:37:58 dev-zero Exp $
-
-description="Open vSwitch OpenFlow controller"
-
-command="/usr/bin/ovs-controller"
-command_args="
-    --pidfile
-    --detach
-    --monitor
-    ${OPTIONS} ${METHODS}"
-pidfile="/var/run/openvswitch/ovs-controller.pid"
-
-depend() {
-    need net
-    use logger
-}
-
-start_pre() {
-	checkpath -d "/var/run/openvswitch" -m 0750
-}
diff --git a/testing/openvswitch/ovs-modules.initd b/testing/openvswitch/ovs-modules.initd
new file mode 100644
index 0000000..204348d
--- /dev/null
+++ b/testing/openvswitch/ovs-modules.initd
_at_@ -0,0 +1,25 @@
+#!/sbin/runscript
+
+MODULES="openvswitch"
+
+depend() {
+        before ovsdb-server
+}
+
+
+start() {
+        ebegin "Loading Openvswitch kernel modules"
+        for mod in $MODULES; do
+		modprobe -q $mod
+	done
+	eend $?
+}
+
+stop() {
+        ebegin "Unloading Openvswitch kernel modules"
+        for mod in $MODULES; do
+		rmmod $mod
+	done
+        eend $?
+}
+
diff --git a/testing/openvswitch/ovs-vswitchd.initd b/testing/openvswitch/ovs-vswitchd.initd
index 6bf8bfc..debdf61 100644
--- a/testing/openvswitch/ovs-vswitchd.initd
+++ b/testing/openvswitch/ovs-vswitchd.initd
_at_@ -14,7 +14,10 @@ command_args="
 pidfile="/var/run/openvswitch/ovs-vswitchd.pid"
 
 depend() {
-	use ovsdb-server logger
+        need localmount ovsdb-server
+        after bootmisc hwdrivers modules
+        before net
+    use logger
 }
 
 start_pre() {
diff --git a/testing/openvswitch/ovsdb-server.confd b/testing/openvswitch/ovsdb-server.confd
index 1299b82..97367b9 100644
--- a/testing/openvswitch/ovsdb-server.confd
+++ b/testing/openvswitch/ovsdb-server.confd
_at_@ -2,12 +2,12 @@
 DB_SOCKET="/var/run/openvswitch/db.sock"
 
 # Remote sockets are defined in the database by default
-REMOTE_DB="db:Open_vSwitch,manager_options"
+REMOTE_DB="db:Open_vSwitch,Open_vSwitch,manager_options"
 
 # All certificates and keys are stored in the database (if any)
-PRIVATE_KEY="db:SSL,private_key"
-CERTIFICATE="db:SSL,certificate"
-BOOTSTRAP_CA_CERT="db:SSL,ca_cert"
+PRIVATE_KEY="db:Open_vSwitch,SSL,private_key"
+CERTIFICATE="db:Open_vSwitch,SSL,certificate"
+BOOTSTRAP_CA_CERT="db:Open_vSwitch,SSL,ca_cert"
 
 # Alternative path for the database (default is /etc/openvswitch/conf.db)
 # DATABASE="/etc/openvswitch/conf.db"
diff --git a/testing/openvswitch/ovsdb-server.initd b/testing/openvswitch/ovsdb-server.initd
index 53c2744..e369da3 100644
--- a/testing/openvswitch/ovsdb-server.initd
+++ b/testing/openvswitch/ovsdb-server.initd
_at_@ -26,10 +26,15 @@ command_args="
 pidfile="/var/run/openvswitch/ovsdb-server.pid"
 
 depend() {
-	need localmount
+        need localmount ovsdb-server
+        after bootmisc hwdrivers modules
+        before net
     use logger
 }
 
+# ovsdb-server is a hard dependency for ovs-vswitchd (to keep them in sync) - to stop the db only:
+# /etc/init.d/ovsdb-server --nodeps stop |or| rc-service ovsdb-server -- --nodeps stop
+
 start_pre() {
 	checkpath -d "/var/run/openvswitch" -m 0750
 }
diff --git a/testing/openvswitch/remove-test-atomic-8byte.patch b/testing/openvswitch/remove-test-atomic-8byte.patch
new file mode 100644
index 0000000..dcff9b9
--- /dev/null
+++ b/testing/openvswitch/remove-test-atomic-8byte.patch
_at_@ -0,0 +1,31 @@
+--- openvswitch-2.0.0/tests/test-atomic.c
++++ openvswitch-2.0.0.alpine/tests/test-atomic.c
+_at_@ -83,22 +83,26 @@
+     TEST_ATOMIC_TYPE(atomic_uint, unsigned int);
+     TEST_ATOMIC_TYPE(atomic_long, long int);
+     TEST_ATOMIC_TYPE(atomic_ulong, unsigned long int);
++#if 0
+     TEST_ATOMIC_TYPE(atomic_llong, long long int);
+     TEST_ATOMIC_TYPE(atomic_ullong, unsigned long long int);
++#endif
+     TEST_ATOMIC_TYPE(atomic_size_t, size_t);
+     TEST_ATOMIC_TYPE(atomic_ptrdiff_t, ptrdiff_t);
++#if 0
+     TEST_ATOMIC_TYPE(atomic_intmax_t, intmax_t);
+     TEST_ATOMIC_TYPE(atomic_uintmax_t, uintmax_t);
++#endif
+     TEST_ATOMIC_TYPE(atomic_intptr_t, intptr_t);
+     TEST_ATOMIC_TYPE(atomic_uintptr_t, uintptr_t);
+-    TEST_ATOMIC_TYPE(atomic_uint8_t, uint8_t);
+-    TEST_ATOMIC_TYPE(atomic_int8_t, int8_t);
+     TEST_ATOMIC_TYPE(atomic_uint16_t, uint16_t);
+     TEST_ATOMIC_TYPE(atomic_int16_t, int16_t);
+     TEST_ATOMIC_TYPE(atomic_uint32_t, uint32_t);
+     TEST_ATOMIC_TYPE(atomic_int32_t, int32_t);
++#if 0
+     TEST_ATOMIC_TYPE(atomic_uint64_t, uint64_t);
+     TEST_ATOMIC_TYPE(atomic_int64_t, int64_t);
++#endif
+
+     test_atomic_flag();
+
-- 
1.8.5.4
---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Wed Mar 12 2014 - 17:36:50 GMT