Reuven Plevinsky via dev <[email protected]> writes:

> In case the OVS kernel module is not installed, OVS userspace can
> still be used.  Currently its absence blocks OVS startup.
>
> Allow it with a warning.  Attempting to create a "system" type
> bridge will fail with "No such file or directory" errors in the
> ovs-vswitchd log.
>
> Signed-off-by: Reuven Plevinsky <[email protected]>
> ---
>  utilities/ovs-kmod-ctl.8  | 16 +++++++++++-----
>  utilities/ovs-kmod-ctl.in |  7 ++++++-
>  2 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/utilities/ovs-kmod-ctl.8 b/utilities/ovs-kmod-ctl.8
> index c36638e79f52..5acffa931e71 100644
> --- a/utilities/ovs-kmod-ctl.8
> +++ b/utilities/ovs-kmod-ctl.8
> @@ -43,9 +43,14 @@ Each of \fBovs\-kmod\-ctl\fR's commands is described 
> separately below.
>  .
>  .PP
>  The \fBinsert\fR command loads the Open vSwitch kernel modules, if
> -needed.  If this fails, and the Linux bridge module is loaded but no
> -bridges exist, it tries to unload the bridge module and tries loading
> -the Open vSwitch kernel module again.
> +needed.  If the \fBopenvswitch\fR kernel module is not installed on
> +the system, the command continues without it, allowing Open vSwitch
> +to operate in userspace\-only mode.
> +.PP
> +If \fBmodprobe\fR\|(8) fails for an installed module, and the Linux
> +bridge module is loaded but no bridges exist, the command tries to
> +unload the bridge module and retries loading the Open vSwitch kernel
> +module.
>  .
>  .SH "The ``remove'' command"
>  .
> @@ -58,8 +63,9 @@ modules.
>  .
>  \fBovs\-kmod\-ctl\fR exits with status 0 on success and nonzero on
>  failure.  The \fBinsert\fR command is considered to succeed if kernel
> -modules are already loaded; the \fBremove\fR command is considered to
> -succeed if none of the kernel modules are loaded.
> +modules are already loaded or if the \fBopenvswitch\fR module is not
> +installed (userspace\-only mode); the \fBremove\fR command is considered
> +to succeed if none of the kernel modules are loaded.
>  .
>  .SH "ENVIRONMENT"
>  .
> diff --git a/utilities/ovs-kmod-ctl.in b/utilities/ovs-kmod-ctl.in
> index 19f1009647e2..daa8c42d4e3d 100644
> --- a/utilities/ovs-kmod-ctl.in
> +++ b/utilities/ovs-kmod-ctl.in
> @@ -29,7 +29,12 @@ done
>  
>  insert_mods () {
>      # Try loading openvswitch kernel module.
> -    action "Inserting openvswitch module" modprobe openvswitch
> +    modinfo openvswitch > /dev/null 2>&1
> +    if test $? = 0; then
> +        action "Inserting openvswitch module" modprobe openvswitch
> +    else
> +        log_warning_msg "No openvswitch module, running in userspace mode 
> only"
> +    fi

This seems to be a "return 0" effect here to avoid doing the check in
insert_mods_if_required - but that is probably where we should do the
detection that the module is available.  So I guess it probably is
better to do it in the `insert_kmods_if_required` function::

  if ! modinfo openvswitch > /dev/null 2>&1 ; then
     log_warning_msg ....
  fi

Also, "running in userspace mode only" isn't exactly correct.  Rather,
we know that the vswitchd will not be able to use the netlink datapath,
but I think the message here is misleading.  For example, AF_XDP is
kindof a hybrid mode that will still work.  I suggest something more
neutral, like "openvswitch module isn't available".

>  }
>  
>  insert_kmods_if_required() {

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to