[ovs-dev] [PATCH 2/2] debian: force-reload-kmod while package upgrading.

Gurucharan Shetty shettyg at nicira.com
Wed Apr 10 22:41:23 UTC 2013


Currently, when we upgrade openvswitch packages, we do restart
of userspace daemons. This does not replace the kernel module.

But almost everytime, we want to also use the new kernel module
that comes with the new version. This means that we need to
manually do a "force-reload-kmod". This step, along with reloading
kernel module also restarts userspace daemons. This gives us a
total of 2 restarts. This is quite expensive in a hypervisor with
hundreds of VMs sending real traffic. This also hurts the controller
as it gets 2 reconnections in a short amount of time.

With this patch, during a package upgrade, we will automatically do
a force-reload-kmod while openvswitch-switch is installed. Usually,
when openvswitch is upgraded, both kernel package and userspace
package is upgraded together with a "dpkg -i" on command line. This
results in both packages unpacked first and then configured. This
ensures that we use the new kernel module during the postinst of
openvswitch-switch package. One can also install the kernel package
first and then install the userspace package in 2 separate steps.

If anyone wants to just restart the userspace package instead of
force-reload-kmod, they can set the value of OVS_FORCE_RELOAD_KMOD=no
while installing the package.
Ex: OVS_FORCE_RELOAD_KMOD=no dpkg -i openvswitch-switch*

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 debian/openvswitch-switch.init     |    7 ++++---
 debian/openvswitch-switch.postinst |    7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/debian/openvswitch-switch.init b/debian/openvswitch-switch.init
index d84c1b6..9d8a9f0 100755
--- a/debian/openvswitch-switch.init
+++ b/debian/openvswitch-switch.init
@@ -75,10 +75,11 @@ stop () {
 }
 
 restart () {
-    # OVS_RESTART_SAVE_FLOWS can be set by package postinst script.
-    if [ "$OVS_RESTART_SAVE_FLOWS" = "yes" ] || \
-       [ "$1" = "--save-flows=yes" ]; then
+    # OVS_FORCE_RELOAD_KMOD can be set by package postinst script.
+    if [ "$1" = "--save-flows=yes" ]; then
         start restart
+    elif [ "$OVS_FORCE_RELOAD_KMOD" = "yes" ]; then
+        start force-reload-kmod
     else
         stop
         start
diff --git a/debian/openvswitch-switch.postinst b/debian/openvswitch-switch.postinst
index ac6ed65..2464572 100755
--- a/debian/openvswitch-switch.postinst
+++ b/debian/openvswitch-switch.postinst
@@ -49,9 +49,10 @@ esac
 OVS_MISSING_KMOD_OK=yes
 export OVS_MISSING_KMOD_OK
 
-# Save and restore openflow flows during a package upgrade.
-OVS_RESTART_SAVE_FLOWS=yes
-export OVS_RESTART_SAVE_FLOWS
+# force-reload-kmod during upgrade. If a user wants to override this,
+# they can set the variable OVS_FORCE_RELOAD_KMOD=no while installing.
+[ -z "${OVS_FORCE_RELOAD_KMOD}" ] && OVS_FORCE_RELOAD_KMOD=yes || true
+export OVS_FORCE_RELOAD_KMOD
 
 #DEBHELPER#
 
-- 
1.7.9.5




More information about the dev mailing list