diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-10-06 14:12:21 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-10-06 14:12:21 +0000 |
commit | 21dbf20f52bed1e9ca112acc550013be68e5c17b (patch) | |
tree | d65cb88860b5102be90e55f4838adfa72d3160ba /testing | |
parent | 72a716fba2ea67a59b323af580cbcdeff1902231 (diff) | |
download | aports-21dbf20f52bed1e9ca112acc550013be68e5c17b.tar.bz2 aports-21dbf20f52bed1e9ca112acc550013be68e5c17b.tar.xz |
testing/openvswitch: fix creation/upgrade of database
Instead of create/update database from install script we do it from
init.d script. This is becase:
- we need /dev/urandom, which might not exist til until the mdev/udev
service is started. We cannot assume those are running during
install
- in case of upgrade, if the service is running (which is normally is)
we will get locking error because the db is in use.
We solve both those things by creating/upgrading the database before
starting it, from the init.d script.
fixes #3417
Diffstat (limited to 'testing')
-rw-r--r-- | testing/openvswitch/APKBUILD | 10 | ||||
-rw-r--r-- | testing/openvswitch/openvswitch.post-install | 21 | ||||
-rw-r--r-- | testing/openvswitch/openvswitch.post-upgrade | 21 | ||||
-rw-r--r-- | testing/openvswitch/ovsdb-server.initd | 18 |
4 files changed, 19 insertions, 51 deletions
diff --git a/testing/openvswitch/APKBUILD b/testing/openvswitch/APKBUILD index 9cc2dabfa8..b76707bfce 100644 --- a/testing/openvswitch/APKBUILD +++ b/testing/openvswitch/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Stuart Cardall <developer@it-offshore.co.uk> pkgname=openvswitch pkgver=2.3.0 -pkgrel=4 +pkgrel=5 pkgdesc="A production quality, multilayer virtual switch - includes Kernel Modules for best performance." url="http://openvswitch.org/" arch="all" @@ -10,7 +10,7 @@ license="GPL" depends="" depends_dev="openssl-dev" makedepends="$depends_dev perl python" -install="openvswitch.post-install openvswitch.post-upgrade" +install="" subpackages="$pkgname-doc $pkgname-dbg $pkgname-monitor" source="http://openvswitch.org/releases/$pkgname-$pkgver.tar.gz ovsdb-server.initd @@ -73,7 +73,7 @@ package() { } md5sums="9c4d1471a56718132e0157af1bfc9310 openvswitch-2.3.0.tar.gz -464eafc0e07aada01495470f5f816f36 ovsdb-server.initd +b31c5fff2ba358dc6af49ab6ffcdecbf ovsdb-server.initd f10a8ac784654bec359bda52779f16fe ovsdb-server.confd 003297c9ec93877508812332101c2bf5 ovs-vswitchd.initd 2d1e0111ea62779f49e14d62678294b2 ovs-vswitchd.confd @@ -81,7 +81,7 @@ ae128e5c349710c0fb3849b2d3b3aa40 ovs-modules.initd 6e17032bd6e7caf6e6e844b5a84d7080 musl-if_packet.patch 59fa9a6d293a25571562a5190ae559f2 0001-ovs-thread-Set-stacksize-to-1M.patch" sha256sums="011052645cd4c7afee2732e87d45e589a0540ac7b7523027d3be2d7c7db7c899 openvswitch-2.3.0.tar.gz -b58a4bdab9ca035a9271067edadb19598985c55820f020d8aefe71b516a3e7f6 ovsdb-server.initd +d7791b1e7e84955489f88e457631c6cedfeff26c5865c8569b69e1bd96633dc7 ovsdb-server.initd d0d8a6a7256f4cc47ab1b9f9f7657202388133bcfff3668e7c1d4adbcc572261 ovsdb-server.confd 591d8c10080ba2fa2ddf5bf8da281d931421c95ff728f56fbaa10be7c3d8431c ovs-vswitchd.initd cc189d5ca24708ff775a4de312df3f611c65714724b8901ec6527c9e3f22e14a ovs-vswitchd.confd @@ -89,7 +89,7 @@ cc189d5ca24708ff775a4de312df3f611c65714724b8901ec6527c9e3f22e14a ovs-vswitchd.c d0e9e3e30b2943b10e7efa59c41c3bf8d5b599d55fc99198146bf4761df4d8ae musl-if_packet.patch faf997814e89b0b5948c06050ef38051f0bc6b108958f76313263f77a724906c 0001-ovs-thread-Set-stacksize-to-1M.patch" sha512sums="f3a665bc84d8a6e282928db61ae648a826f273e44e34311a60e6f0e74a6ab10c8410cb374f0ce80abe7c58b9559a97388cdbfe2ef28ac4bedd2f5e52b3cd6ed1 openvswitch-2.3.0.tar.gz -6d660c986666b3f3b052d5ff6a8555c8bf5234fee8c4740d70974b1ac00ee2a0711e931494556290e18fce820ce8f2d4a5f25e40e9c863da9b639c18c0515763 ovsdb-server.initd +7b6b0a3c42839053d21ff72b576d92ba08ee5d900faa25fa04a183114a55c4d7dc85538cd7d3333386a27d7a7f632c1d2a38a2b950972c29d11d96addaffa27c ovsdb-server.initd b1588d076bbfc7ef2dd46fce8e46186f40cbbc4667697f7ac13ddc68e34568fdab315fde47838de7f6d32916853190336cfe3735f672ad7cb624ae14dbff55a5 ovsdb-server.confd 3d493047a6729b7e0742438de828a2530acbcdac9c1c410786bf1eefb5e9f09850fb479f45245f550d1077146d4545fb91a845ae79f673b6c1c2902220920e33 ovs-vswitchd.initd 346aea099f51707d2b4fc9fdc8c1502582723fb4e00c4d5d1624b0378c94dfb76674fa95e2af894f36169df52109dbe441ee6a45aa744584d9e4c74d15a46c1d ovs-vswitchd.confd diff --git a/testing/openvswitch/openvswitch.post-install b/testing/openvswitch/openvswitch.post-install deleted file mode 100644 index 3dfef0db6a..0000000000 --- a/testing/openvswitch/openvswitch.post-install +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -NORMAL="\033[1;0m" -STRONG="\033[1;1m" -GREEN="\033[1;32m" - -print_green() { - local prompt="${GREEN}${STRONG}$1 ${NORMAL}" - printf "${prompt} %s\n" -} - -db="/etc/openvswitch/conf.db" -if [ -e "$db" ]; then - print_green "\nTrying schema migration for $db..." - ovsdb-tool convert "$db" "/usr/share/openvswitch/vswitch.ovsschema" -else - 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 deleted file mode 100644 index 3dfef0db6a..0000000000 --- a/testing/openvswitch/openvswitch.post-upgrade +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -NORMAL="\033[1;0m" -STRONG="\033[1;1m" -GREEN="\033[1;32m" - -print_green() { - local prompt="${GREEN}${STRONG}$1 ${NORMAL}" - printf "${prompt} %s\n" -} - -db="/etc/openvswitch/conf.db" -if [ -e "$db" ]; then - print_green "\nTrying schema migration for $db..." - ovsdb-tool convert "$db" "/usr/share/openvswitch/vswitch.ovsschema" -else - print_green "\nCreating new Open vSwitch database $db...\n" - ovsdb-tool create "$db" "/usr/share/openvswitch/vswitch.ovsschema" -fi - - diff --git a/testing/openvswitch/ovsdb-server.initd b/testing/openvswitch/ovsdb-server.initd index e369da3116..29d19045fe 100644 --- a/testing/openvswitch/ovsdb-server.initd +++ b/testing/openvswitch/ovsdb-server.initd @@ -11,6 +11,9 @@ private_key=${PRIVATE_KEY:+"--private-key=${PRIVATE_KEY}"} certificate=${CERTIFICATE:+"--certificate=${CERTIFICATE}"} bootstrap_ca_cert=${BOOTSTRAP_CA_CERT:+"--bootstrap-ca-cert=${BOOTSTRAP_CA_CERT}"} +db=${DATABASE:-/etc/openvswitch/conf.db} +dbschema=/usr/share/openvswitch/vswitch.ovsschema + command="/usr/sbin/ovsdb-server" command_args=" --pidfile @@ -25,11 +28,12 @@ command_args=" ${OPTIONS}" pidfile="/var/run/openvswitch/ovsdb-server.pid" + depend() { - need localmount ovsdb-server - after bootmisc hwdrivers modules - before net - use logger + need localmount dev + 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: @@ -37,4 +41,10 @@ depend() { start_pre() { checkpath -d "/var/run/openvswitch" -m 0750 + if ! [ -e "$db" ]; then + ovsdb-tool create $db $dbschema + elif [ "$(ovsdb-tool needs-conversion $db $dbschema)" = "yes" ]; then + ovsdb-tool convert $db $dbschema + fi } + |