Subject: [alpine-aports] [PATCH] main/openvswitch: fix network script / improve docs / integrate LXC

From: Stuart Cardall <[email-masked]>
Date: Sat, 11 Jul 2015 19:33:06 +0000

small fix for /etc/network/if-pre-up.d/openvswitch. When networking is
started now ovs-vswitchd will be started if stopped.

added /usr/share/doc/openvswitch/README.alpine which provides
instructions on how to use /etc/network/pre-up.d/openvswitch.

You can now configure bridges / ports / bonds in /etc/network/interfaces.

You can also integrate LXC into OVS / ifupdown easily via 'ovsup' & 'ovsdown':
https://github.com/itoffshore/lxc-scripts

If you install 'apk-post-messages' & 'openvswitch-doc' detailed instructions
are printed.
---
 main/openvswitch/APKBUILD              | 15 ++++++--
 main/openvswitch/ifupdown-alpine.patch | 11 ++++++
 main/openvswitch/ifupdown.sh           |  4 ++
 main/openvswitch/readme.debian.patch   | 70 ++++++++++++++++++++++++++++++++++
 4 files changed, 96 insertions(+), 4 deletions(-)
 create mode 100644 main/openvswitch/readme.debian.patch

diff --git a/main/openvswitch/APKBUILD b/main/openvswitch/APKBUILD
index d19cc33..940304c 100644
--- a/main/openvswitch/APKBUILD
+++ b/main/openvswitch/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Stuart Cardall <[email-masked]>
 pkgname=openvswitch
 pkgver=2.3.2
-pkgrel=0
+pkgrel=1
 pkgdesc="A production quality, multilayer virtual switch"
 url="http://openvswitch.org/"
 arch="all"
@@ -21,6 +21,7 @@ source="http://openvswitch.org/releases/$pkgname-$pkgver.tar.gz
 	musl-if_packet.patch
 	0001-ovs-thread-Set-stacksize-to-1M.patch
 	ifupdown-alpine.patch
+	readme.debian.patch
 	"
 
 _builddir="$srcdir"/$pkgname-$pkgver
@@ -78,6 +79,9 @@ package() {
 		"$pkgdir"/etc/network/if-pre-up.d/openvswitch || return 1
 	ln -s ../if-pre-up.d/openvswitch \
 		"$pkgdir"/etc/network/if-post-down.d/openvswitch || return 1
+	mkdir -p "$pkgdir"/usr/share/doc/openvswitch || return 1
+	install -m644 debian/openvswitch-switch.README.Debian \
+                "$pkgdir"/usr/share/doc/openvswitch/README.alpine || return 1
 }
 
 md5sums="5a5739ed82f1accac1c2d8d7553dc88f  openvswitch-2.3.2.tar.gz
@@ -88,7 +92,8 @@ f10a8ac784654bec359bda52779f16fe  ovsdb-server.confd
 45b381d434ccbc634a3224c5963edc66  ovs-modules.initd
 6e17032bd6e7caf6e6e844b5a84d7080  musl-if_packet.patch
 59fa9a6d293a25571562a5190ae559f2  0001-ovs-thread-Set-stacksize-to-1M.patch
-efb3c073b7c475d9fb3999a38e4f92c0  ifupdown-alpine.patch"
+b8c688a31385dc4e19f12799546a8a8e  ifupdown-alpine.patch
+7280528282e3c9ec235e013fede2f973  readme.debian.patch"
 sha256sums="386b11df94d06c68d391ee4091832360095bd3a14c72d454325fab284dad9887  openvswitch-2.3.2.tar.gz
 737be74a4ce951cd49b9cd85696ff5cbdb54fa7ad52c831494fcf336487fc420  ovsdb-server.initd
 d0d8a6a7256f4cc47ab1b9f9f7657202388133bcfff3668e7c1d4adbcc572261  ovsdb-server.confd
@@ -97,7 +102,8 @@ cc189d5ca24708ff775a4de312df3f611c65714724b8901ec6527c9e3f22e14a  ovs-vswitchd.c
 06079771a94dd363218f2b3561efd0178a47d85bfd73c8b6cf24eef4ec82b0de  ovs-modules.initd
 d0e9e3e30b2943b10e7efa59c41c3bf8d5b599d55fc99198146bf4761df4d8ae  musl-if_packet.patch
 faf997814e89b0b5948c06050ef38051f0bc6b108958f76313263f77a724906c  0001-ovs-thread-Set-stacksize-to-1M.patch
-d2284376febcdb465ef2f216be01be52dab2a9726624b12c5cc47fb0d955d1b1  ifupdown-alpine.patch"
+8554e7272818471fb12d633132e2e51ea31199a5d4559e2c098af48ab089b0de  ifupdown-alpine.patch
+57a2becc7210faff2fb57ef51f8e6c33978925b48e013ba5fb78d031f2f55748  readme.debian.patch"
 sha512sums="dfbd9d5b16aeecdc880efb910e0ec2e474dcc02515f0033b1e9466735387b39f2855bec49936a261aea66badb35e09598dbb9fc4b506e9a9e0c18d3441fea691  openvswitch-2.3.2.tar.gz
 097d4721a78fff749c534910d98543778474406bd61b469b88a0d981a2a380556444437ec44278cead6d8688c45a38b2acbf1551acb9ab38d048f413728e3b88  ovsdb-server.initd
 b1588d076bbfc7ef2dd46fce8e46186f40cbbc4667697f7ac13ddc68e34568fdab315fde47838de7f6d32916853190336cfe3735f672ad7cb624ae14dbff55a5  ovsdb-server.confd
@@ -106,4 +112,5 @@ b1588d076bbfc7ef2dd46fce8e46186f40cbbc4667697f7ac13ddc68e34568fdab315fde47838de7
 614c86eab826bb8f934cf4a98508fde9952a0b7211414e074510473af3455077a333729aa0e59f3634b9bf30d64847d0f7597246506c36a8f09d57573a2522fc  ovs-modules.initd
 1ebfb2629081cc0b34383e6c2f163f3c1d43da3a399b8ba8745871b77029d3b8fc21a287ff859a6a9cca2cb4885715458d4e4086cb6c17765ff7c898d4004850  musl-if_packet.patch
 5fed04e68b58ab322154fa1cc4c4b63b08c22ed41f0b7713dbe8437f7cb4e9fd93c8aba524c2e5a46bba956da9439f5bfe5ba6fcdff2b98fa9bbcc748c5b64db  0001-ovs-thread-Set-stacksize-to-1M.patch
-eb24886fd8110adde4a68f7ab0887af0cdf88e27d58f030208a0a9d7aef0065b8c5f7e2d489ff48c82ba386fbb9575c0273c5d4958e2638263ea78824242354e  ifupdown-alpine.patch"
+45c793e1fd303a2a234abdb99c07a5dac14261a216e3f250f50488dba7114771372225c18f9f1469344e040e1b51dec513d423323dce6af4077757c22f3330d9  ifupdown-alpine.patch
+27bf10138b0be024c0a9039aea9cfa42825d365de5d414872b25d7cd642f2d0d41d5c604d5282362f3d2b1782513fc792a619fe0b6de19d14c04178e11a3ccb0  readme.debian.patch"
diff --git a/main/openvswitch/ifupdown-alpine.patch b/main/openvswitch/ifupdown-alpine.patch
index e35b4aa..a417f72 100644
--- a/main/openvswitch/ifupdown-alpine.patch
+++ b/main/openvswitch/ifupdown-alpine.patch
@@ -1,5 +1,16 @@
 --- ./debian/ifupdown.sh.orig
 +++ ./debian/ifupdown.sh
+@@ -29,8 +29,8 @@ if (ovs_vsctl --version) > /dev/null 2>&
+     exit 0
+ fi
+ 
+-if /etc/init.d/openvswitch-switch status > /dev/null 2>&1; then :; else
+-    /etc/init.d/openvswitch-switch start
++if ! /etc/init.d/ovs-vswitchd status &>/dev/null; then
++    /etc/init.d/ovs-vswitchd start
+ fi
+ 
+ if [ "${MODE}" = "start" ]; then
 @@ -38,7 +38,8 @@
                           ${OVS_EXTRA+-- $OVS_EXTRA}
  
diff --git a/main/openvswitch/ifupdown.sh b/main/openvswitch/ifupdown.sh
index 9c0054f..a2bd048 100755
--- a/main/openvswitch/ifupdown.sh
+++ b/main/openvswitch/ifupdown.sh
@@ -29,6 +29,10 @@ if (ovs_vsctl --version) > /dev/null 2>&1; then :; else
     exit 0
 fi
 
+if /etc/init.d/ovs-vswitchd status > /dev/null 2>&1; then :; else
+    /etc/init.d/ovs-vswitchd start
+fi
+
 if [ "${MODE}" = "start" ]; then
     eval OVS_EXTRA=\"${IF_OVS_EXTRA}\"
 
diff --git a/main/openvswitch/readme.debian.patch b/main/openvswitch/readme.debian.patch
new file mode 100644
index 0000000..33f002e
--- /dev/null
+++ b/main/openvswitch/readme.debian.patch
@@ -0,0 +1,70 @@
+--- openvswitch-2.3.2/debian/openvswitch-switch.README.Debian	2015-06-18 19:32:47.000000000 +0000
++++ openvswitch-2.3.2/debian/openvswitch-switch.README.Debian.new	2015-07-10 17:03:12.791341980 +0000
+@@ -1,44 +1,5 @@
+-README.Debian for openvswitch-switch
+----------------------------------
+-
+-To use the Linux kernel-based switch implementation, you will need an
+-Open vSwitch kernel module.  There are multiple ways to obtain one.
+-In order of increasing manual effort, these are:
+-
+-       * Use a Linux kernel 3.3 or later, which has an integrated Open
+-	 vSwitch kernel module.
+-
+-	 The upstream Linux kernel module lacks a few features that
+-	 are in the third-party module.  For details, please see the
+-	 FAQ, "What features are not available in the Open vSwitch
+-	 kernel datapath that ships as part of the upstream Linux
+-	 kernel?".
+-
+-       * Install the "openvswitch-datapath-dkms" Debian package that
+-	 you built earlier.  This should automatically build and
+-	 install the Open vSwitch kernel module for your running
+-	 kernel.
+-
+-	 This option requires that you have a compiler and toolchain
+-	 installed on the machine where you run Open vSwitch, which
+-	 may be unacceptable in some production server environments.
+-
+-       * Install the "openvswitch-datapath-source" Debian package, use
+-	 "module-assistant" to build a Debian package of the Open
+-	 vSwitch kernel module for your kernel, and then install that
+-	 Debian package.
+-
+-	 You can install the kernel module Debian packages that you
+-	 build this way on the same machine where you built it or on
+-	 another machine or machines, which means that you don't
+-	 necessarily have to have any build infrastructure on the
+-	 machines where you use the kernel module.
+-
+-	 /usr/share/doc/openvswitch-datapath-source/README.Debian has
+-	 details on the build process.
+-
+-       * Build and install the kernel module by hand.
+-
++README.Alpine for Openvswitch
++-----------------------------
+ 
+ Debian network scripts integration
+ ----------------------------------
+@@ -172,11 +133,6 @@ iface gre1 inet manual
+     ovs_tunnel_type gre
+     ovs_tunnel_options options:remote_ip=182.168.1.2 options:key=1
+ 
+-ex 7: Create and destroy bridges.
+-
+-ifup --allow=ovs $list_of_bridges
+-ifdown --allow=ovs $list_of_bridges
+-
+ Notes on dependencies:
+ ---------------------
+ 
+@@ -203,3 +159,8 @@ in the 'auto' section, openvswitch-switc
+ ifupdown kicks in. In a case like this, the admin needs to make sure that /usr
+ has already been mounted and that a remote $syslog (if used) is ready to
+ receive openvswitch logs.
++
++Notes on LXC / ifupdown integration:
++-----------------------------------
++
++See 'ovsup' & 'ovsdown' https://github.com/itoffshore/lxc-scripts
-- 
2.4.5

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---