[ovs-dev] [PATCH v3] debian: Change openvswitch restart logic for kernel package.

Gurucharan Shetty shettyg at nicira.com
Thu Jan 17 21:23:13 UTC 2013


Currently, every time we install the non-dkms openvswitch kernel package,
we restart openvswitch. This has no useful effect when an Open vSwitch kernel
module is already loaded, because "/etc/init.d/openvswitch restart" does not
load the new version of the kernel module.

With this patch, we start openvswitch if there is no kernel module
currently loaded (which is a case for a fresh install of openvswitch). This
will load the kernel module.

If someone wants to use the latest kernel module after an upgrade, they need
to run "/etc/init.d/openvswitch-switch force-reload-kmod" manually.

Issue #13556
Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 ...tch-datapath-module-_KVERS_.postinst.modules.in |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in b/debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in
index 2ed4753..3ed4800 100755
--- a/debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in
+++ b/debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in
@@ -7,17 +7,21 @@ set -e
 
 #DEBHELPER#
 
-# If the switch is running, restart it.  This ensures that we are using the
-# latest kernel module, because the init script will unload and reload the
-# module.
+# If the kernel module is already loaded, we have nothing to do here.
+# A force-reload-kmod should be run manually to use the new kernel module.
+if [ -e /sys/module/openvswitch ] || [ -e /sys/module/openvswitch_mod ]; then
+    exit 0
+fi
+
+# If the kernel module is not loaded, then it is likely because none
+# was installed before and therefore Open vSwitch couldn't be started.
+# Try to start it now.
 #
 # (Ideally we'd only want to do this if this package corresponds to the
 # running kernel, but I don't know a reliable way to check.)
 INIT=/etc/init.d/openvswitch-switch
-if test -x $INIT && $INIT status; then
-    $INIT restart || true
+if test -x $INIT; then
+    $INIT start || true
 fi
 
 exit 0
-
-
-- 
1.7.9.5




More information about the dev mailing list