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/openvswitch/ovsdb-server.initd | |
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/openvswitch/ovsdb-server.initd')
-rw-r--r-- | testing/openvswitch/ovsdb-server.initd | 18 |
1 files changed, 14 insertions, 4 deletions
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 } + |