[ovs-dev] [PATCH 2/2] openvswitch-switch.postinst: Avoid getting redirected to systemctl.

Gurucharan Shetty guru at ovn.org
Mon Jun 19 11:05:59 UTC 2017


When the openvswitch-switch package is installed, postinst script
is used to make a call to /etc/init.d/openvswitch-switch with
"restart" as the command. openvswitch-switch.init inturn would carefully
restart OVS by saving the openflow flows and replacing the kernel
module only when needed.

With recent versions of Ubuntu and Debian, any call of "restart"
no longer calls the "restart" of openvswitch-switch.init but instead
calls a runtime generated systemd file which inturn makes a "stop"
call followed by a "start" call. This would mean that we would neither
save flows or replace the kernel module.

This commit tries to solve this problem by getting rid of '#DEBHELPER'
and replacing "restart" with "ovsrestart" so that we skip systemd
generated files.

VMware-BZ: #1890631
Signed-off-by: Gurucharan Shetty <guru at ovn.org>
---
 debian/openvswitch-switch.postinst | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/debian/openvswitch-switch.postinst b/debian/openvswitch-switch.postinst
index 2464572..3fc0361 100755
--- a/debian/openvswitch-switch.postinst
+++ b/debian/openvswitch-switch.postinst
@@ -54,6 +54,14 @@ export OVS_MISSING_KMOD_OK
 [ -z "${OVS_FORCE_RELOAD_KMOD}" ] && OVS_FORCE_RELOAD_KMOD=yes || true
 export OVS_FORCE_RELOAD_KMOD
 
-#DEBHELPER#
+if [ -x "/etc/init.d/openvswitch-switch" ]; then
+        update-rc.d openvswitch-switch defaults >/dev/null
+        if [ -n "$2" ]; then
+                _dh_action=ovsrestart
+        else
+                _dh_action=start
+        fi
+        invoke-rc.d openvswitch-switch $_dh_action || exit $?
+fi
 
 exit 0
-- 
1.9.1



More information about the dev mailing list