diff mbox

[ovs-dev,v2] INSTALL.md: Add details about kernel module preference.

Message ID 1474900490-25630-1-git-send-email-guru@ovn.org
State Superseded
Headers show

Commit Message

Gurucharan Shetty Sept. 26, 2016, 2:34 p.m. UTC
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
---
 INSTALL.md | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

Darrell Ball Sept. 27, 2016, 3:52 a.m. UTC | #1
On Mon, Sep 26, 2016 at 7:34 AM, Gurucharan Shetty <guru@ovn.org> wrote:

> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
> ---
>  INSTALL.md | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/INSTALL.md b/INSTALL.md
> index bb40e4a..6ecefdf 100644
> --- a/INSTALL.md
> +++ b/INSTALL.md
> @@ -322,9 +322,30 @@ Building the Sources
>  4. Run "make install" to install the executables and manpages into the
>     running system, by default under /usr/local.
>
> -5. If you built kernel modules, you may install and load them, e.g.:
> +5. If you built kernel modules, you may install them, e.g.:
>
>        `% make modules_install`
> +
> +    It is possible that you already had a Open vSwitch kernel module
> +    installed on your machine that came from upstream Linux (in a
> +    different directory).  To make sure that you insert the Open vSwitch
> +    kernel module you built from this repository, you should create a
> +    depmod.d file that prefers your newly installed kernel modules over
> +    the kernel modules from upstream Linux.  The following snippet of
> +    code achieves the same.
> +
> +    ```
> +    % config_file="/etc/depmod.d/openvswitch.conf"
> +    % for module in datapath/linux/*.ko; do
> +      modname="$(basename ${module})"
> +      echo "override $modname * extra" >> "$config_file"
> +      echo "override $modname * weak-updates" >> "$config_file"
> +      done
> +    % depmod -a
> +    ```
> +
>

I tried the script

#!/bin/bash
config_file="/etc/depmod.d/openvswitch.conf"
for module in datapath/linux/*.ko; do
modname="$(basename ${module})"
echo "override $modname * extra" >> "$config_file"
echo "override $modname * weak-updates" >> "$config_file"
done
depmod -a

on Ubuntu 14.04 and the script generated the expected
file contents

dball@ubuntu:~/openvswitch/ovs/_gcc$ cat /etc/depmod.d/openvswitch.conf
override openvswitch.ko * extra
override openvswitch.ko * weak-updates
override vport-geneve.ko * extra
override vport-geneve.ko * weak-updates
override vport-gre.ko * extra
override vport-gre.ko * weak-updates
override vport-lisp.ko * extra
override vport-lisp.ko * weak-updates
override vport-stt.ko * extra
override vport-stt.ko * weak-updates
override vport-vxlan.ko * extra
override vport-vxlan.ko * weak-updates

However the "extra" directory where locally built ovs kos are installed is
not
taking precedence

dball@ubuntu:~/openvswitch/ovs/_gcc$ sudo modinfo openvswitch
filename:       /lib/modules/3.19.0-25-generic/kernel/net/
openvswitch/openvswitch.ko
license:        GPL
description:    Open vSwitch switching datapath
srcversion:     EB1236CA2503B5F233DE125
depends:        libcrc32c
intree:         Y
vermagic:       3.19.0-25-generic SMP mod_unload modversions
signer:         Magrathea: Glacier signing key
sig_key:        6A:AA:11:D1:8C:2D:3A:40:B1:B4:DB:E5:BF:8A:D6:56:DD:F5:18:38
sig_hashalgo:   sha512

So I edited the script to do something minimal, although it may not
work for all distributions ?

#!/bin/bash
config_file="/etc/depmod.d/openvswitch.conf"
echo "search extra" >> "$config_file"
depmod -a

dball@ubuntu:~/openvswitch/ovs/_gcc$ cat /etc/depmod.d/openvswitch.conf
search extra

and it seems to work (i.e. overrides my default config file) on Ubuntu

dball@ubuntu:~/openvswitch/ovs/_gcc$ sudo modinfo openvswitch
filename:       /lib/modules/3.19.0-25-generic/extra/openvswitch.ko
alias:          net-pf-16-proto-16-family-ovs_packet
alias:          net-pf-16-proto-16-family-ovs_flow
alias:          net-pf-16-proto-16-family-ovs_vport
alias:          net-pf-16-proto-16-family-ovs_datapath
version:        2.6.90
license:        GPL
description:    Open vSwitch switching datapath
srcversion:     E30F336D9883ACAE1CB02EA
depends:        nf_conntrack,nf_nat,nf_defrag_ipv6,libcrc32c,nf_nat_
ipv6,nf_nat_ipv4,gre,nf_defrag_ipv4
vermagic:       3.19.0-25-generic SMP mod_unload modversions
parm:           udp_port:Destination UDP port (ushort)





> +    Finally, load the kernel modules that you need.  e.g.:
> +
>        `% /sbin/modprobe openvswitch`
>
>     To verify that the modules have been loaded, run "/sbin/lsmod" and
> --
> 1.9.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
Darrell Ball Sept. 27, 2016, 6:08 a.m. UTC | #2
On Mon, Sep 26, 2016 at 8:52 PM, Darrell Ball <dlu998@gmail.com> wrote:

>
>
> On Mon, Sep 26, 2016 at 7:34 AM, Gurucharan Shetty <guru@ovn.org> wrote:
>
>> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
>> ---
>>  INSTALL.md | 23 ++++++++++++++++++++++-
>>  1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/INSTALL.md b/INSTALL.md
>> index bb40e4a..6ecefdf 100644
>> --- a/INSTALL.md
>> +++ b/INSTALL.md
>> @@ -322,9 +322,30 @@ Building the Sources
>>  4. Run "make install" to install the executables and manpages into the
>>     running system, by default under /usr/local.
>>
>> -5. If you built kernel modules, you may install and load them, e.g.:
>> +5. If you built kernel modules, you may install them, e.g.:
>>
>>        `% make modules_install`
>> +
>> +    It is possible that you already had a Open vSwitch kernel module
>> +    installed on your machine that came from upstream Linux (in a
>> +    different directory).  To make sure that you insert the Open vSwitch
>> +    kernel module you built from this repository, you should create a
>> +    depmod.d file that prefers your newly installed kernel modules over
>> +    the kernel modules from upstream Linux.  The following snippet of
>> +    code achieves the same.
>> +
>> +    ```
>> +    % config_file="/etc/depmod.d/openvswitch.conf"
>> +    % for module in datapath/linux/*.ko; do
>> +      modname="$(basename ${module})"
>> +      echo "override $modname * extra" >> "$config_file"
>> +      echo "override $modname * weak-updates" >> "$config_file"
>> +      done
>> +    % depmod -a
>> +    ```
>> +
>>
>
> I tried the script
>
> #!/bin/bash
> config_file="/etc/depmod.d/openvswitch.conf"
> for module in datapath/linux/*.ko; do
> modname="$(basename ${module})"
> echo "override $modname * extra" >> "$config_file"
> echo "override $modname * weak-updates" >> "$config_file"
> done
> depmod -a
>
> on Ubuntu 14.04 and the script generated the expected
> file contents
>
> dball@ubuntu:~/openvswitch/ovs/_gcc$ cat /etc/depmod.d/openvswitch.conf
> override openvswitch.ko * extra
> override openvswitch.ko * weak-updates
> override vport-geneve.ko * extra
> override vport-geneve.ko * weak-updates
> override vport-gre.ko * extra
> override vport-gre.ko * weak-updates
> override vport-lisp.ko * extra
> override vport-lisp.ko * weak-updates
> override vport-stt.ko * extra
> override vport-stt.ko * weak-updates
> override vport-vxlan.ko * extra
> override vport-vxlan.ko * weak-updates
>
> However the "extra" directory where locally built ovs kos are installed is
> not
> taking precedence
>
> dball@ubuntu:~/openvswitch/ovs/_gcc$ sudo modinfo openvswitch
> filename:       /lib/modules/3.19.0-25-generic/kernel/net/openvswitch/
> openvswitch.ko
> license:        GPL
> description:    Open vSwitch switching datapath
> srcversion:     EB1236CA2503B5F233DE125
> depends:        libcrc32c
> intree:         Y
> vermagic:       3.19.0-25-generic SMP mod_unload modversions
> signer:         Magrathea: Glacier signing key
> sig_key:        6A:AA:11:D1:8C:2D:3A:40:B1:B4
> :DB:E5:BF:8A:D6:56:DD:F5:18:38
> sig_hashalgo:   sha512
>
> So I edited the script to do something minimal, although it may not
> work for all distributions ?
>
> #!/bin/bash
> config_file="/etc/depmod.d/openvswitch.conf"
> echo "search extra" >> "$config_file"
> depmod -a
>
> dball@ubuntu:~/openvswitch/ovs/_gcc$ cat /etc/depmod.d/openvswitch.conf
> search extra
>
> and it seems to work (i.e. overrides my default config file) on Ubuntu
>

I checked into this further and depmod just seems to be using an
alphabetical order for depmod
config files !
It does not seem to differentiate non-default vs default config files.
Hence, this approach will not work.



>
> dball@ubuntu:~/openvswitch/ovs/_gcc$ sudo modinfo openvswitch
> filename:       /lib/modules/3.19.0-25-generic/extra/openvswitch.ko
> alias:          net-pf-16-proto-16-family-ovs_packet
> alias:          net-pf-16-proto-16-family-ovs_flow
> alias:          net-pf-16-proto-16-family-ovs_vport
> alias:          net-pf-16-proto-16-family-ovs_datapath
> version:        2.6.90
> license:        GPL
> description:    Open vSwitch switching datapath
> srcversion:     E30F336D9883ACAE1CB02EA
> depends:        nf_conntrack,nf_nat,nf_defrag_ipv6,libcrc32c,nf_nat_ipv6,
> nf_nat_ipv4,gre,nf_defrag_ipv4
> vermagic:       3.19.0-25-generic SMP mod_unload modversions
> parm:           udp_port:Destination UDP port (ushort)
>







>
>
>
>
>
>> +    Finally, load the kernel modules that you need.  e.g.:
>> +
>>        `% /sbin/modprobe openvswitch`
>>
>>     To verify that the modules have been loaded, run "/sbin/lsmod" and
>> --
>> 1.9.1
>>
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
>>
>
>
Gurucharan Shetty Sept. 27, 2016, 3:21 p.m. UTC | #3
On 26 September 2016 at 20:52, Darrell Ball <dlu998@gmail.com> wrote:

>
>
> On Mon, Sep 26, 2016 at 7:34 AM, Gurucharan Shetty <guru@ovn.org> wrote:
>
>> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
>> ---
>>  INSTALL.md | 23 ++++++++++++++++++++++-
>>  1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/INSTALL.md b/INSTALL.md
>> index bb40e4a..6ecefdf 100644
>> --- a/INSTALL.md
>> +++ b/INSTALL.md
>> @@ -322,9 +322,30 @@ Building the Sources
>>  4. Run "make install" to install the executables and manpages into the
>>     running system, by default under /usr/local.
>>
>> -5. If you built kernel modules, you may install and load them, e.g.:
>> +5. If you built kernel modules, you may install them, e.g.:
>>
>>        `% make modules_install`
>> +
>> +    It is possible that you already had a Open vSwitch kernel module
>> +    installed on your machine that came from upstream Linux (in a
>> +    different directory).  To make sure that you insert the Open vSwitch
>> +    kernel module you built from this repository, you should create a
>> +    depmod.d file that prefers your newly installed kernel modules over
>> +    the kernel modules from upstream Linux.  The following snippet of
>> +    code achieves the same.
>> +
>> +    ```
>> +    % config_file="/etc/depmod.d/openvswitch.conf"
>> +    % for module in datapath/linux/*.ko; do
>> +      modname="$(basename ${module})"
>> +      echo "override $modname * extra" >> "$config_file"
>> +      echo "override $modname * weak-updates" >> "$config_file"
>> +      done
>> +    % depmod -a
>> +    ```
>> +
>>
>
> I tried the script
>
> #!/bin/bash
> config_file="/etc/depmod.d/openvswitch.conf"
> for module in datapath/linux/*.ko; do
> modname="$(basename ${module})"
> echo "override $modname * extra" >> "$config_file"
> echo "override $modname * weak-updates" >> "$config_file"
> done
> depmod -a
>
> on Ubuntu 14.04 and the script generated the expected
> file contents
>
> dball@ubuntu:~/openvswitch/ovs/_gcc$ cat /etc/depmod.d/openvswitch.conf
> override openvswitch.ko * extra
> override openvswitch.ko * weak-updates
> override vport-geneve.ko * extra
> override vport-geneve.ko * weak-updates
> override vport-gre.ko * extra
> override vport-gre.ko * weak-updates
> override vport-lisp.ko * extra
> override vport-lisp.ko * weak-updates
> override vport-stt.ko * extra
> override vport-stt.ko * weak-updates
> override vport-vxlan.ko * extra
> override vport-vxlan.ko * weak-updates
>

Can you try the v3 that I sent. It is very similar to what we do for RHEL
here:
https://github.com/openvswitch/ovs/blob/master/rhel/openvswitch-kmod-rhel6.spec.in#L65


>
> However the "extra" directory where locally built ovs kos are installed is
> not
> taking precedence
>
> dball@ubuntu:~/openvswitch/ovs/_gcc$ sudo modinfo openvswitch
> filename:       /lib/modules/3.19.0-25-generic/kernel/net/openvswitch/
> openvswitch.ko
> license:        GPL
> description:    Open vSwitch switching datapath
> srcversion:     EB1236CA2503B5F233DE125
> depends:        libcrc32c
> intree:         Y
> vermagic:       3.19.0-25-generic SMP mod_unload modversions
> signer:         Magrathea: Glacier signing key
> sig_key:        6A:AA:11:D1:8C:2D:3A:40:B1:B4
> :DB:E5:BF:8A:D6:56:DD:F5:18:38
> sig_hashalgo:   sha512
>
> So I edited the script to do something minimal, although it may not
> work for all distributions ?
>
> #!/bin/bash
> config_file="/etc/depmod.d/openvswitch.conf"
> echo "search extra" >> "$config_file"
> depmod -a
>
> dball@ubuntu:~/openvswitch/ovs/_gcc$ cat /etc/depmod.d/openvswitch.conf
> search extra
>
> and it seems to work (i.e. overrides my default config file) on Ubuntu
>
> dball@ubuntu:~/openvswitch/ovs/_gcc$ sudo modinfo openvswitch
> filename:       /lib/modules/3.19.0-25-generic/extra/openvswitch.ko
> alias:          net-pf-16-proto-16-family-ovs_packet
> alias:          net-pf-16-proto-16-family-ovs_flow
> alias:          net-pf-16-proto-16-family-ovs_vport
> alias:          net-pf-16-proto-16-family-ovs_datapath
> version:        2.6.90
> license:        GPL
> description:    Open vSwitch switching datapath
> srcversion:     E30F336D9883ACAE1CB02EA
> depends:        nf_conntrack,nf_nat,nf_defrag_ipv6,libcrc32c,nf_nat_ipv6,
> nf_nat_ipv4,gre,nf_defrag_ipv4
> vermagic:       3.19.0-25-generic SMP mod_unload modversions
> parm:           udp_port:Destination UDP port (ushort)
>
>
>
>
>
>> +    Finally, load the kernel modules that you need.  e.g.:
>> +
>>        `% /sbin/modprobe openvswitch`
>>
>>     To verify that the modules have been loaded, run "/sbin/lsmod" and
>> --
>> 1.9.1
>>
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
>>
>
>
Darrell Ball Sept. 27, 2016, 7:57 p.m. UTC | #4
On Tue, Sep 27, 2016 at 8:21 AM, Guru Shetty <guru@ovn.org> wrote:

>
>
> On 26 September 2016 at 20:52, Darrell Ball <dlu998@gmail.com> wrote:
>
>>
>>
>> On Mon, Sep 26, 2016 at 7:34 AM, Gurucharan Shetty <guru@ovn.org> wrote:
>>
>>> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
>>> ---
>>>  INSTALL.md | 23 ++++++++++++++++++++++-
>>>  1 file changed, 22 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/INSTALL.md b/INSTALL.md
>>> index bb40e4a..6ecefdf 100644
>>> --- a/INSTALL.md
>>> +++ b/INSTALL.md
>>> @@ -322,9 +322,30 @@ Building the Sources
>>>  4. Run "make install" to install the executables and manpages into the
>>>     running system, by default under /usr/local.
>>>
>>> -5. If you built kernel modules, you may install and load them, e.g.:
>>> +5. If you built kernel modules, you may install them, e.g.:
>>>
>>>        `% make modules_install`
>>> +
>>> +    It is possible that you already had a Open vSwitch kernel module
>>> +    installed on your machine that came from upstream Linux (in a
>>> +    different directory).  To make sure that you insert the Open vSwitch
>>> +    kernel module you built from this repository, you should create a
>>> +    depmod.d file that prefers your newly installed kernel modules over
>>> +    the kernel modules from upstream Linux.  The following snippet of
>>> +    code achieves the same.
>>> +
>>> +    ```
>>> +    % config_file="/etc/depmod.d/openvswitch.conf"
>>> +    % for module in datapath/linux/*.ko; do
>>> +      modname="$(basename ${module})"
>>> +      echo "override $modname * extra" >> "$config_file"
>>> +      echo "override $modname * weak-updates" >> "$config_file"
>>> +      done
>>> +    % depmod -a
>>> +    ```
>>> +
>>>
>>
>> I tried the script
>>
>> #!/bin/bash
>> config_file="/etc/depmod.d/openvswitch.conf"
>> for module in datapath/linux/*.ko; do
>> modname="$(basename ${module})"
>> echo "override $modname * extra" >> "$config_file"
>> echo "override $modname * weak-updates" >> "$config_file"
>> done
>> depmod -a
>>
>> on Ubuntu 14.04 and the script generated the expected
>> file contents
>>
>> dball@ubuntu:~/openvswitch/ovs/_gcc$ cat /etc/depmod.d/openvswitch.conf
>> override openvswitch.ko * extra
>> override openvswitch.ko * weak-updates
>> override vport-geneve.ko * extra
>> override vport-geneve.ko * weak-updates
>> override vport-gre.ko * extra
>> override vport-gre.ko * weak-updates
>> override vport-lisp.ko * extra
>> override vport-lisp.ko * weak-updates
>> override vport-stt.ko * extra
>> override vport-stt.ko * weak-updates
>> override vport-vxlan.ko * extra
>> override vport-vxlan.ko * weak-updates
>>
>
> Can you try the v3 that I sent. It is very similar to what we do for RHEL
> here:
> https://github.com/openvswitch/ovs/blob/master/rhel/
> openvswitch-kmod-rhel6.spec.in#L65
>


Looks better without the ".ko" suffix in config file

Acked-by: Darrell Ball <dlu998@gmail.com>




>
>> However the "extra" directory where locally built ovs kos are installed
>> is not
>> taking precedence
>>
>> dball@ubuntu:~/openvswitch/ovs/_gcc$ sudo modinfo openvswitch
>> filename:       /lib/modules/3.19.0-25-generic
>> /kernel/net/openvswitch/openvswitch.ko
>> license:        GPL
>> description:    Open vSwitch switching datapath
>> srcversion:     EB1236CA2503B5F233DE125
>> depends:        libcrc32c
>> intree:         Y
>> vermagic:       3.19.0-25-generic SMP mod_unload modversions
>> signer:         Magrathea: Glacier signing key
>> sig_key:        6A:AA:11:D1:8C:2D:3A:40:B1:B4
>> :DB:E5:BF:8A:D6:56:DD:F5:18:38
>> sig_hashalgo:   sha512
>>
>> So I edited the script to do something minimal, although it may not
>> work for all distributions ?
>>
>> #!/bin/bash
>> config_file="/etc/depmod.d/openvswitch.conf"
>> echo "search extra" >> "$config_file"
>> depmod -a
>>
>> dball@ubuntu:~/openvswitch/ovs/_gcc$ cat /etc/depmod.d/openvswitch.conf
>> search extra
>>
>> and it seems to work (i.e. overrides my default config file) on Ubuntu
>>
>> dball@ubuntu:~/openvswitch/ovs/_gcc$ sudo modinfo openvswitch
>> filename:       /lib/modules/3.19.0-25-generic/extra/openvswitch.ko
>> alias:          net-pf-16-proto-16-family-ovs_packet
>> alias:          net-pf-16-proto-16-family-ovs_flow
>> alias:          net-pf-16-proto-16-family-ovs_vport
>> alias:          net-pf-16-proto-16-family-ovs_datapath
>> version:        2.6.90
>> license:        GPL
>> description:    Open vSwitch switching datapath
>> srcversion:     E30F336D9883ACAE1CB02EA
>> depends:        nf_conntrack,nf_nat,nf_defrag
>> _ipv6,libcrc32c,nf_nat_ipv6,nf_nat_ipv4,gre,nf_defrag_ipv4
>> vermagic:       3.19.0-25-generic SMP mod_unload modversions
>> parm:           udp_port:Destination UDP port (ushort)
>>
>>
>>
>>
>>
>>> +    Finally, load the kernel modules that you need.  e.g.:
>>> +
>>>        `% /sbin/modprobe openvswitch`
>>>
>>>     To verify that the modules have been loaded, run "/sbin/lsmod" and
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> dev mailing list
>>> dev@openvswitch.org
>>> http://openvswitch.org/mailman/listinfo/dev
>>>
>>
>>
>
diff mbox

Patch

diff --git a/INSTALL.md b/INSTALL.md
index bb40e4a..6ecefdf 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -322,9 +322,30 @@  Building the Sources
 4. Run "make install" to install the executables and manpages into the
    running system, by default under /usr/local.
 
-5. If you built kernel modules, you may install and load them, e.g.:
+5. If you built kernel modules, you may install them, e.g.:
 
       `% make modules_install`
+
+    It is possible that you already had a Open vSwitch kernel module
+    installed on your machine that came from upstream Linux (in a
+    different directory).  To make sure that you insert the Open vSwitch
+    kernel module you built from this repository, you should create a
+    depmod.d file that prefers your newly installed kernel modules over
+    the kernel modules from upstream Linux.  The following snippet of
+    code achieves the same.
+
+    ```
+    % config_file="/etc/depmod.d/openvswitch.conf"
+    % for module in datapath/linux/*.ko; do
+      modname="$(basename ${module})"
+      echo "override $modname * extra" >> "$config_file"
+      echo "override $modname * weak-updates" >> "$config_file"
+      done
+    % depmod -a
+    ```
+
+    Finally, load the kernel modules that you need.  e.g.:
+
       `% /sbin/modprobe openvswitch`
 
    To verify that the modules have been loaded, run "/sbin/lsmod" and