mirror of
https://github.com/openvswitch/ovs
synced 2025-10-13 14:07:02 +00:00
Currently, when we upgrade openvswitch packages, we do a restart of userspace daemons automatically. This does not replace the kernel module. But almost everytime, we want to 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, reloads the kernel module and also restarts the userspace daemons. This gives us a total of two restarts of userspace daemons. This is quite expensive in a hypervisor with hundreds of VMs sending real traffic. This also hurts the controller as it gets two reconnections in a short amount of time. With this patch, during a package upgrade, if the kernel module on disk is different than the one that is loaded, we will automatically do a force-reload-kmod while openvswitch-switch is installed. If not, we will just do a "restart" like before. One can install the kernel package first and then install the userspace packages in 2 separate steps to enforce a single 'force-reload-kmod'. 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@nicira.com>
60 lines
1.7 KiB
Bash
Executable File
60 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# postinst script for openvswitch-switch
|
|
#
|
|
# see: dh_installdeb(1)
|
|
|
|
set -e
|
|
|
|
# summary of how this script can be called:
|
|
# * <postinst> `configure' <most-recently-configured-version>
|
|
# * <old-postinst> `abort-upgrade' <new version>
|
|
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
|
# <new-version>
|
|
# * <postinst> `abort-remove'
|
|
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
|
# <failed-install-package> <version> `removing'
|
|
# <conflicting-package> <version>
|
|
# for details, see http://www.debian.org/doc/debian-policy/ or
|
|
# the debian-policy package
|
|
|
|
|
|
case "$1" in
|
|
configure)
|
|
DEFAULT=/etc/default/openvswitch-switch
|
|
TEMPLATE=/usr/share/openvswitch/switch/default.template
|
|
if ! test -e $DEFAULT; then
|
|
cp $TEMPLATE $DEFAULT
|
|
else
|
|
for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
|
|
do
|
|
if ! grep $var $DEFAULT >/dev/null 2>&1; then
|
|
echo >> $DEFAULT
|
|
sed -n "/$var:/,/$var=/p" $TEMPLATE >> $DEFAULT
|
|
fi
|
|
done
|
|
fi
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# Do not fail package installation just because the kernel module
|
|
# is not available.
|
|
OVS_MISSING_KMOD_OK=yes
|
|
export OVS_MISSING_KMOD_OK
|
|
|
|
# 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#
|
|
|
|
exit 0
|