[ovs-dev] [PATCH] packaging: Do not automatically restart user-space on upgrade from 1.3

Ansis Atteka aatteka at nicira.com
Thu Jan 19 01:19:43 UTC 2012


This will print a warning and avoid user-space restart
if system already had 1.3 or older OVS installed. This is
a workaround for a bug where older kernel modules could not
communicate with newer user-space.

Issue: 9128

Signed-off-by: Ansis Atteka <aatteka at nicira.com>
Reported-by: Michael Kruze <mkruze at nicira.com>
---
 debian/automake.mk                 |    1 +
 debian/openvswitch-switch.postinst |   16 ++++++++++++++++
 debian/openvswitch-switch.prerm    |    6 ++++++
 debian/rules                       |    3 +--
 4 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 debian/openvswitch-switch.prerm

diff --git a/debian/automake.mk b/debian/automake.mk
index 755d727..500a0a4 100644
--- a/debian/automake.mk
+++ b/debian/automake.mk
@@ -39,6 +39,7 @@ EXTRA_DIST += \
 	debian/openvswitch-switch.manpages \
 	debian/openvswitch-switch.postinst \
 	debian/openvswitch-switch.postrm \
+	debian/openvswitch-switch.prerm \
 	debian/openvswitch-switch.template \
 	debian/openvswitch-test.dirs \
 	debian/openvswitch-test.install \
diff --git a/debian/openvswitch-switch.postinst b/debian/openvswitch-switch.postinst
index c50853a..f358445 100755
--- a/debian/openvswitch-switch.postinst
+++ b/debian/openvswitch-switch.postinst
@@ -61,6 +61,22 @@ if test -x /etc/init.d/openvswitch-switch; then
     fi
 fi
 
+if [ -n "$2" ] && dpkg --compare-versions "$2" lt 1.4; then
+    printf "\nThere is an upgrade bug from pre-1.4 Open vSwitch. As a\n"
+    printf "workaround you must manually run force-reload-kmod command\n"
+    printf "or reboot the system to finish the upgrade.\n\n"
+else
+    if [ -x "/etc/init.d/openvswitch-switch" ]; then
+        update-rc.d openvswitch-switch defaults >/dev/null
+        if [ -n "$2" ]; then
+            _dh_action=restart
+        else
+            _dh_action=start
+        fi
+        invoke-rc.d openvswitch-switch $_dh_action || init_script_error
+    fi
+fi
+
 #DEBHELPER#
 
 exit 0
diff --git a/debian/openvswitch-switch.prerm b/debian/openvswitch-switch.prerm
new file mode 100644
index 0000000..8110222
--- /dev/null
+++ b/debian/openvswitch-switch.prerm
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+
+if [ -x "/etc/init.d/openvswitch-switch" ] && [ "$1" = remove ]; then
+    invoke-rc.d openvswitch-switch stop || init_script_error
+fi
\ No newline at end of file
diff --git a/debian/rules b/debian/rules
index c8b6c63..ddbe26e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -117,8 +117,7 @@ binary-common:
 	dh_installexamples
 	dh_installdebconf
 	dh_installlogrotate
-	dh_installinit -R -Nopenvswitch-switch
-	dh_installinit -R -popenvswitch-switch --error-handler=init_script_error
+	dh_installinit -popenvswitch-switch --error-handler=init_script_error --no-start
 	dh_installcron
 	dh_installman --language=C
 	dh_link
-- 
1.7.5.4




More information about the dev mailing list