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

Gurucharan Shetty shettyg at nicira.com
Thu Jan 17 20:44:11 UTC 2013

Currently, every time we install the non-dkms openvswitch kernel package,
we restart openvswitch. This is unnecessary when there is already a kernel
module insmodded.

With this patch, we only restart openvswitch if there is no kernel module
currently insmodded (which is a case for a fresh install of openvswitch).

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 |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in b/debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in
index 2ed4753..48387a2 100755
--- a/debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in
+++ b/debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in
@@ -7,17 +7,18 @@ set -e
-# 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 not loaded and the openvswitch-switch is installed,
+# restart it. This ensures that the kernel module will be loaded.
 # (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.)
+if [ -e /sys/module/openvswitch ] || [ -e /sys/module/openvswitch_mod ]; then
+    exit 0
-if test -x $INIT && $INIT status; then
+if test -x $INIT; then
     $INIT restart || true
 exit 0

More information about the dev mailing list