diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/ovn/APKBUILD | 67 | ||||
-rw-r--r-- | testing/ovn/ovn-controller.initd | 22 | ||||
-rw-r--r-- | testing/ovn/ovn-northd.initd | 2 | ||||
-rw-r--r-- | testing/ovn/ovn-ovsdb-server-nb.initd | 4 | ||||
-rw-r--r-- | testing/ovn/ovn-ovsdb-server-sb.initd | 2 | ||||
-rw-r--r-- | testing/ovn/ovs-ifupdown-alpine.patch | 17 | ||||
-rw-r--r-- | testing/ovn/ovs-modules.initd | 20 | ||||
-rw-r--r-- | testing/ovn/ovs-vswitchd.confd | 6 | ||||
-rw-r--r-- | testing/ovn/ovs-vswitchd.initd | 25 | ||||
-rw-r--r-- | testing/ovn/ovsdb-server.confd | 16 | ||||
-rw-r--r-- | testing/ovn/ovsdb-server.initd | 50 |
11 files changed, 216 insertions, 15 deletions
diff --git a/testing/ovn/APKBUILD b/testing/ovn/APKBUILD index a976416d34e..4155f1ce4b9 100644 --- a/testing/ovn/APKBUILD +++ b/testing/ovn/APKBUILD @@ -1,8 +1,9 @@ +# Contributor: Stuart Cardall <developer@it-offshore.co.uk> # Maintainer: Leonardo Arena <rnalrd@alpinelinux.org> pkgname=ovn pkgver=23.09.0 ovs_pkgver=3.2.1 -pkgrel=0 +pkgrel=1 pkgdesc="Open Virtual Network" url="https://www.ovn.org" arch="all" @@ -26,6 +27,14 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/ovn-org/ovn/archive/refs/tag ovn-northd.initd ovn-ovsdb-server-nb.initd ovn-ovsdb-server-sb.initd + ovn-controller.initd + ovs-modules.initd + ovs-vswitchd.confd + ovs-vswitchd.initd + ovsdb-server.confd + ovsdb-server.initd + + ovs-ifupdown-alpine.patch " provides="openvswitch=$ovs_pkgver" # https://dev.alpinelinux.org/archive/ovn/openvswitch-$ovs_pkgver-$_gitrev.tar.gz @@ -40,9 +49,10 @@ snapshot() { } prepare() { - default_prepare + # default_prepare ./boot.sh cd "$srcdir"/ovs-$ovs_pkgver + patch -p1 < ../ovs-ifupdown-alpine.patch ./boot.sh } @@ -83,28 +93,57 @@ package() { # parallel install issue make -j1 DESTDIR="$pkgdir" install - # install the required version of OpenVSwitch - cd "$srcdir/ovs-$ovs_pkgver" - make DESTDIR="$pkgdir" install - - # remove unneeded ovs files - rm -rf "$pkgdir"/etc - rm -rf "$pkgdir"/var - + install -Dm644 ../ovn-ctl.confd "$pkgdir"/etc/conf.d/ovn-ctl + local f for f in ovn-northd \ ovn-ovsdb-server-nb \ ovn-ovsdb-server-sb \ + ovn-controller \ ; do install -Dm755 ../"$f".initd "$pkgdir/etc/init.d/$f" - install -Dm644 ../ovn-ctl.confd "$pkgdir/etc/conf.d/$f" + ln -s ovn-ctl "$pkgdir/etc/conf.d/$f" done + + # Install the required version of OpenVSwitch + # Taken from openvswitch package + cd "$srcdir/ovs-$ovs_pkgver" + make DESTDIR="$pkgdir" install + + # we don't install python and bash extensions + rm -rf "$pkgdir"/usr/share/openvswitch/python + rm -rf "$pkgdir"/etc/bash_completion.d + + install -Dm755 "$srcdir"/ovsdb-server.initd \ + "$pkgdir"/etc/init.d/ovsdb-server + 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-vswitchd.confd \ + "$pkgdir"/etc/conf.d/ovs-vswitchd + + install -d "$pkgdir"/etc/network/if-pre-up.d \ + "$pkgdir"/etc/network/if-post-down.d + install -m755 debian/ifupdown.sh \ + "$pkgdir"/etc/network/if-pre-up.d/openvswitch + ln -s ../if-pre-up.d/openvswitch \ + "$pkgdir"/etc/network/if-post-down.d/openvswitch } sha512sums=" 90fb0496e7a219fa8a4cf22daa40ce54a7e8174228d1baa6946c399a81fed7ba380a8e0a93ad8da6a83aaf47c22312637541e449e076f08884fc9dd28179e6fd ovn-23.09.0.tar.gz 709e7a39c97d44cb4fc2741ec386d2bb446adf4c374d5d15480dc62e49d5e327354eb81ca09b55b0c0954dd42b28d3bd278840247d42b2f8802e667f90bd8c97 openvswitch-3.2.1.tar.gz b98fd4acefcc03714cebe18dd78839ec1e6777ed6b1b035873b7a05c24ce5c91b62d890543e58529ed47413c4ab926468a9915bf15675475712ac039f9d1cda5 ovn-ctl.confd -9208004e2615f39e4432741781a38ba8d0f312a3a728e51d32f45bccecd3012d869cc7d3f1a77a850ff6803f93e2e0fac49a77f9136ec8faa553df50d4545936 ovn-northd.initd -c57f8728c6cd46dee838ff8a5093c736632782e469fdc87c840c70dacc69bc46e83b96e03bcac308b0d109bcbeea118e28a7c4487e60ff0296ed5b5ad68a6dfb ovn-ovsdb-server-nb.initd -11a670dfec6d20290cff20faea95aadc520984a45047b5baf798c89bdea46fab699b2a499c1f2e1c31e14a0c670dd554c061b35185977e7e9ebce42eb388786e ovn-ovsdb-server-sb.initd +436f3bc162675b5baa9e301d58fe30d7d0dfb7a196f73012cd8dd3ee7b3e9016c8db81092629da08ee08fc572a697c4c1463c819254c26eaf1f69150f522c503 ovn-northd.initd +3bb3fc3578b41f326cb120d96189f46b475ad1c4c9f0fbd1c28cbad6dc6510143566e6ea26d29820da96b51477f6611e7ce242543a6e7af2b8bd3974ebf102fe ovn-ovsdb-server-nb.initd +752b57d73f8fe9583b09c814758a0d779c3e87680b47efa55e80ed4b2e80c949b1094ddc36f2533e1b8a3eea3cb7481c09dcfae15b0a6381463b27b898823ee5 ovn-ovsdb-server-sb.initd +26ad49aa5deeb216bb24b8a76ed1f2bbaee582a53f034546110d7380f8c5d225663994ce44b108bac8cd2ea4c5348b3c8edef1cd7c9668c14f39151d35a0ed35 ovn-controller.initd +1e08aa5ac6ce55b97256478b9243c8a4c92a42a97fc70ea0439c832b12a775af28a127224ae6c4ce01642dde65f76c610a44105912338bf443d8ea390c2d9ccf ovs-modules.initd +346aea099f51707d2b4fc9fdc8c1502582723fb4e00c4d5d1624b0378c94dfb76674fa95e2af894f36169df52109dbe441ee6a45aa744584d9e4c74d15a46c1d ovs-vswitchd.confd +4bff37f8bed32d5327b4b0433984ab8ffdce77f618034aa6ffd1ad4a7caa00703ea2bef312876dce5aafa4c17fe06dddd75e5c05c10e13bf8f5c3805a0654a96 ovs-vswitchd.initd +b1588d076bbfc7ef2dd46fce8e46186f40cbbc4667697f7ac13ddc68e34568fdab315fde47838de7f6d32916853190336cfe3735f672ad7cb624ae14dbff55a5 ovsdb-server.confd +097d4721a78fff749c534910d98543778474406bd61b469b88a0d981a2a380556444437ec44278cead6d8688c45a38b2acbf1551acb9ab38d048f413728e3b88 ovsdb-server.initd +08c08612be2bbcc3c006a6175f2357542e436fa5bec6b2f3ff5200e8084874a72b8116d3408cffec312e33c104b177db381727666f8dd4712617616eee8c4d63 ovs-ifupdown-alpine.patch " diff --git a/testing/ovn/ovn-controller.initd b/testing/ovn/ovn-controller.initd new file mode 100644 index 00000000000..12a75893bb6 --- /dev/null +++ b/testing/ovn/ovn-controller.initd @@ -0,0 +1,22 @@ +#!/sbin/openrc-run + +command="/usr/share/ovn/scripts/ovn-ctl" +command_args="start_controller --ovn-manage-ovsdb=no --no-monitor $OVN_CTL_OPTS" +command_background="yes" +pidfile="/run/ovn/$RC_SVCNAME.pid" +description="Open Virtual Network host control daemon" + +depend() { + need net + after firewall +} + +start_pre() { + checkpath --directory "${pidfile%/*}" +} + +stop() { + ebegin "Stopping $RC_SVCNAME" + $command stop_controller --no-monitor + eend $? +} diff --git a/testing/ovn/ovn-northd.initd b/testing/ovn/ovn-northd.initd index b433eeb9b0b..0638b09dc06 100644 --- a/testing/ovn/ovn-northd.initd +++ b/testing/ovn/ovn-northd.initd @@ -16,5 +16,7 @@ start_pre() { } stop() { + ebegin "Stopping $RC_SVCNAME" $command stop_northd --no-monitor + eend $? } diff --git a/testing/ovn/ovn-ovsdb-server-nb.initd b/testing/ovn/ovn-ovsdb-server-nb.initd index 80d2c06a754..93eb086e302 100644 --- a/testing/ovn/ovn-ovsdb-server-nb.initd +++ b/testing/ovn/ovn-ovsdb-server-nb.initd @@ -16,5 +16,7 @@ start_pre() { } stop() { - $command stop_nb_ovsdb + ebegin "Stopping $RC_SVCNAME" + $command stop_nb_ovsdb + eend $? } diff --git a/testing/ovn/ovn-ovsdb-server-sb.initd b/testing/ovn/ovn-ovsdb-server-sb.initd index 13ee14fda2b..2adbeb69289 100644 --- a/testing/ovn/ovn-ovsdb-server-sb.initd +++ b/testing/ovn/ovn-ovsdb-server-sb.initd @@ -16,5 +16,7 @@ start_pre() { } stop() { + ebegin "Stopping $RC_SVCNAME" $command stop_sb_ovsdb + eend $? } diff --git a/testing/ovn/ovs-ifupdown-alpine.patch b/testing/ovn/ovs-ifupdown-alpine.patch new file mode 100644 index 00000000000..2c156f0101f --- /dev/null +++ b/testing/ovn/ovs-ifupdown-alpine.patch @@ -0,0 +1,17 @@ +diff --git a/debian/ifupdown.sh b/debian/ifupdown.sh +index 952d1b0..7aed7e0 100755 +--- a/debian/ifupdown.sh ++++ b/debian/ifupdown.sh +@@ -35,8 +35,10 @@ if [ -f $SERVICE_UNIT ] && [ -x /bin/systemctl ]; then + systemctl start openvswitch-switch.service + fi + else +- if service openvswitch-switch status > /dev/null 2>&1; then +- service openvswitch-switch start ++ if ! /etc/init.d/ovs-vswitchd status &>/dev/null; then ++ /etc/init.d/ovs-modules start ++ /etc/init.d/ovsdb-server start ++ /etc/init.d/ovs-vswitchd start + fi + fi + diff --git a/testing/ovn/ovs-modules.initd b/testing/ovn/ovs-modules.initd new file mode 100644 index 00000000000..e6695ac3ccf --- /dev/null +++ b/testing/ovn/ovs-modules.initd @@ -0,0 +1,20 @@ +#!/sbin/openrc-run + +MODULES="openvswitch" + +depend() { + before ovsdb-server +} + +start() { + ebegin "Loading Openvswitch kernel modules" + for mod in $MODULES; do + modprobe -q $mod + done + eend $? +} + +stop() { + # modules cannot be removed without a reboot + return 0 +} diff --git a/testing/ovn/ovs-vswitchd.confd b/testing/ovn/ovs-vswitchd.confd new file mode 100644 index 00000000000..3c3d15865b1 --- /dev/null +++ b/testing/ovn/ovs-vswitchd.confd @@ -0,0 +1,6 @@ +# Connection string for the configuration database (usually a unix socket) +DATABASE="unix:/var/run/openvswitch/db.sock" + +# Additional options +OPTIONS="--mlockall" + diff --git a/testing/ovn/ovs-vswitchd.initd b/testing/ovn/ovs-vswitchd.initd new file mode 100644 index 00000000000..fe35a96721d --- /dev/null +++ b/testing/ovn/ovs-vswitchd.initd @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +# 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-vswitchd-r1,v 1.1 2013/04/08 19:37:58 dev-zero Exp $ + +description="Open vSwitch virtual switch" + +pidfile="/var/run/openvswitch/ovs-vswitchd.pid" +command="/usr/sbin/ovs-vswitchd" +command_args=" + --pidfile=$pidfile + --detach + --monitor + ${OPTIONS} ${DATABASE}" + +depend() { + need localmount ovsdb-server + after bootmisc hwdrivers modules + before net + use logger +} + +start_pre() { + checkpath --directory "${pidfile%/*}" --mode 0750 +} diff --git a/testing/ovn/ovsdb-server.confd b/testing/ovn/ovsdb-server.confd new file mode 100644 index 00000000000..97367b9717e --- /dev/null +++ b/testing/ovn/ovsdb-server.confd @@ -0,0 +1,16 @@ +# Socket for bringing the server up +DB_SOCKET="/var/run/openvswitch/db.sock" + +# Remote sockets are defined in the database by default +REMOTE_DB="db:Open_vSwitch,Open_vSwitch,manager_options" + +# All certificates and keys are stored in the database (if any) +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" + +# Additional options +# OPTIONS="" diff --git a/testing/ovn/ovsdb-server.initd b/testing/ovn/ovsdb-server.initd new file mode 100644 index 00000000000..65c3f2ef33e --- /dev/null +++ b/testing/ovn/ovsdb-server.initd @@ -0,0 +1,50 @@ +#!/sbin/openrc-run +# 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/ovsdb-server-r1,v 1.1 2013/04/08 19:37:58 dev-zero Exp $ + +description="Open vSwitch database server" + +remote_punix=${DB_SOCKET:+"--remote=punix:${DB_SOCKET}"} +remote_db=${REMOTE_DB:+"--remote=${REMOTE_DB}"} +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 + --detach + --monitor + ${remote_punix} + ${remote_db} + ${private_key} + ${certificate} + ${bootstrap_ca_cert} + ${DATABASE} + ${OPTIONS}" +pidfile="/var/run/openvswitch/ovsdb-server.pid" + + +depend() { + 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: +# /etc/init.d/ovsdb-server --nodeps stop |or| rc-service ovsdb-server -- --nodeps stop + +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 +} + |