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

Ben Pfaff blp at nicira.com
Thu Jan 17 21:11:49 UTC 2013

On Thu, Jan 17, 2013 at 12:44:11PM -0800, Gurucharan Shetty wrote:
> 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.

I think that this could be better stated.  Instead of "This is
unnecessary..." how about:

   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.

> +# If the kernel module is not loaded and the openvswitch-switch is installed,
> +# restart it. This ensures that the kernel module will be loaded.

How about, instead of the above:

   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.)
> +if [ -e /sys/module/openvswitch ] || [ -e /sys/module/openvswitch_mod ]; then
> +    exit 0
> +fi
> +
>  INIT=/etc/init.d/openvswitch-switch
> -if test -x $INIT && $INIT status; then
> +if test -x $INIT; then
>      $INIT restart || true

I think that maybe we should only do "start" and not "restart".
Otherwise, if Open vSwitch is running, then installing a module for a
non-running kernel will disrupt traffic for a little while.

More information about the dev mailing list