On 12 December 2017 at 07:59, Yifeng Sun <[email protected]> wrote:

> Deployment and upgrade failure is quite often caused by that
> openvswitch.ko was
> built upon kernel x.y.z-release-A while it is loaded into a running kernel
> of x.y.z-release-B. This patch proposes to enforce the matching of the two
> kernel release numbers at the moment of deployment and upgrading.
>
> Signed-off-by: Yifeng Sun <[email protected]>
>

Yifeng,
 The issue in question is a little different. What usually happens is that
we build OVS $version (e.g OVS 2.8.0) kernel module for a particular redhat
release (say RHEL 7.4). But, RHEL7.4 updates its minor version (for e.g a
security update). Unless, there is a ABI change in that changed minor
version, we should still be able to use the package that we already built
for the previous minor version. With RHEL 6.x, this was usually not a
problem as the openvswitch.ko that we build would land in weak-updates
directory of redhat kernel of the newer minor version.

But something has changed with RHEL7.x, where the package that we install
does not land in "weak-updates"., but instead lands in a separate kernel
(the one that we built it for)
The potential solution for it after running some tests looks to be for us
to change the name of /etc/depmod.d/openvswitch.conf to
/etc/depmod.d/01openvswitch.conf and then add a line at the top:

search extra/openvswitch weak-updates/openvswitch updates extra built-in
weak-updates

Most likely, with RHEL7.x, there is a new file called
/etc/depmod.d/dist.conf which searches for "search updates extra built-in
weak-updates". So, when the kernel module package from this repo is
installed, it does not land it in "weak-updates" of the running kernel.




> ---
>  datapath/datapath.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index 178081993b42..0e3a1db63847 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -51,6 +51,8 @@
>  #include <net/genetlink.h>
>  #include <net/net_namespace.h>
>  #include <net/netns/generic.h>
> +#include <generated/utsrelease.h>
> +#include <linux/utsname.h>
>
>  #include "datapath.h"
>  #include "conntrack.h"
> @@ -61,6 +63,8 @@
>  #include "vport-internal_dev.h"
>  #include "vport-netdev.h"
>
> +static const char *build_kernel_release = UTS_RELEASE;
> +
>  unsigned int ovs_net_id __read_mostly;
>
>  static struct genl_family dp_packet_genl_family;
> @@ -2406,6 +2410,15 @@ static int __init dp_init(void)
>
>         BUILD_BUG_ON(sizeof(struct ovs_skb_cb) > FIELD_SIZEOF(struct
> sk_buff, cb));
>
> +       if (strcmp(build_kernel_release, utsname()->release)) {
> +               pr_err("Failed to load Open vSwitch kernel module: "
> +                               "the modules' built-on kernel release (%s)
> "
> +                               "doesn't match the running kernel's
> release (%s)\n",
> +                               build_kernel_release, utsname()->release);
> +               err = -EINVAL;
> +               goto error;
> +       }
> +
>         pr_info("Open vSwitch switching datapath %s\n", VERSION);
>
>         err = action_fifos_init();
> --
> 2.7.4
>
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to