diff mbox series

[ovs-dev,V2] rhel: Ensure proper OVS kernel modules load after upgrade

Message ID 1516121055-10634-1-git-send-email-gvrose8192@gmail.com
State Accepted
Headers show
Series [ovs-dev,V2] rhel: Ensure proper OVS kernel modules load after upgrade | expand

Commit Message

Gregory Rose Jan. 16, 2018, 4:44 p.m. UTC
Add post install and post un-install scripts to make sure that the
openvswitch kernel modules are correctly written with the weak-modules
utility. This ensures that after an upgrade to a newer kernel the
correct openvswitch kernel modules from a previous installation will
be found by the depmod search path.

Suggested-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>

---
V2 - Modify the correct kmod spec file
---
 rhel/openvswitch-kmod-fedora.spec.in | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

Ansis Jan. 16, 2018, 6:02 p.m. UTC | #1
On 16 January 2018 at 08:44, Greg Rose <gvrose8192@gmail.com> wrote:
> Add post install and post un-install scripts to make sure that the
> openvswitch kernel modules are correctly written with the weak-modules
> utility. This ensures that after an upgrade to a newer kernel the
> correct openvswitch kernel modules from a previous installation will
> be found by the depmod search path.
>
> Suggested-by: Flavio Leitner <fbl@sysclose.org>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>

While I haven't tested your patch because ovs/master rhel spec files
are currently broken due to another issue, this patch looks sane to
me. Hence:

Acked-by: Ansis Atteka <aatteka@ovn.org>

I will test it once I will get past other issues that prevent me from
building rpms on master branch.


>
> ---
> V2 - Modify the correct kmod spec file
> ---
>  rhel/openvswitch-kmod-fedora.spec.in | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/openvswitch-kmod-fedora.spec.in
> index 93adb03..c0cd298 100644
> --- a/rhel/openvswitch-kmod-fedora.spec.in
> +++ b/rhel/openvswitch-kmod-fedora.spec.in
> @@ -57,7 +57,28 @@ rm -rf $RPM_BUILD_ROOT
>
>  %post
>  # Ensure that modprobe will find our modules.
> -depmod %{kernel}
> +for k in $(cd /lib/modules && /bin/ls); do
> +    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
> +done
> +if [ -x "/sbin/weak-modules" ]; then
> +    for m in openvswitch vport-gre vport-stt vport-geneve \
> +             vport-lisp vport-vxlan; do
> +        echo "/lib/modules/%{kernel}/extra/$m.ko"
> +    done | /sbin/weak-modules --add-modules
> +fi
> +
> +%postun
> +for k in $(cd /lib/modules && /bin/ls); do
> +    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
> +done
> +if [ "$1" = 0 ]; then  # Erase, not upgrade
> +    if [ -x "/sbin/weak-modules" ]; then
> +        for m in openvswitch vport-gre vport-stt vport-geneve \
> +                 vport-lisp vport-vxlan; do
> +        echo "/lib/modules/%{kernel}/extra/$m.ko"
> +    done | /sbin/weak-modules --remove-modules
> +    fi
> +fi
>
>  %files
>  %defattr(0644,root,root)
> --
> 1.8.3.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Flavio Leitner Jan. 16, 2018, 6:15 p.m. UTC | #2
On Tue, Jan 16, 2018 at 08:44:15AM -0800, Greg Rose wrote:
> Add post install and post un-install scripts to make sure that the
> openvswitch kernel modules are correctly written with the weak-modules
> utility. This ensures that after an upgrade to a newer kernel the
> correct openvswitch kernel modules from a previous installation will
> be found by the depmod search path.
> 
> Suggested-by: Flavio Leitner <fbl@sysclose.org>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> 
> ---

LGTM, though I have not tested.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Gregory Rose Jan. 16, 2018, 6:28 p.m. UTC | #3
On 1/16/2018 10:02 AM, Ansis Atteka wrote:
> On 16 January 2018 at 08:44, Greg Rose <gvrose8192@gmail.com> wrote:
>> Add post install and post un-install scripts to make sure that the
>> openvswitch kernel modules are correctly written with the weak-modules
>> utility. This ensures that after an upgrade to a newer kernel the
>> correct openvswitch kernel modules from a previous installation will
>> be found by the depmod search path.
>>
>> Suggested-by: Flavio Leitner <fbl@sysclose.org>
>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> While I haven't tested your patch because ovs/master rhel spec files
> are currently broken due to another issue, this patch looks sane to
> me. Hence:
>
> Acked-by: Ansis Atteka <aatteka@ovn.org>
>
> I will test it once I will get past other issues that prevent me from
> building rpms on master branch.

Thanks!

- Greg

>
>> ---
>> V2 - Modify the correct kmod spec file
>> ---
>>   rhel/openvswitch-kmod-fedora.spec.in | 23 ++++++++++++++++++++++-
>>   1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/openvswitch-kmod-fedora.spec.in
>> index 93adb03..c0cd298 100644
>> --- a/rhel/openvswitch-kmod-fedora.spec.in
>> +++ b/rhel/openvswitch-kmod-fedora.spec.in
>> @@ -57,7 +57,28 @@ rm -rf $RPM_BUILD_ROOT
>>
>>   %post
>>   # Ensure that modprobe will find our modules.
>> -depmod %{kernel}
>> +for k in $(cd /lib/modules && /bin/ls); do
>> +    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
>> +done
>> +if [ -x "/sbin/weak-modules" ]; then
>> +    for m in openvswitch vport-gre vport-stt vport-geneve \
>> +             vport-lisp vport-vxlan; do
>> +        echo "/lib/modules/%{kernel}/extra/$m.ko"
>> +    done | /sbin/weak-modules --add-modules
>> +fi
>> +
>> +%postun
>> +for k in $(cd /lib/modules && /bin/ls); do
>> +    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
>> +done
>> +if [ "$1" = 0 ]; then  # Erase, not upgrade
>> +    if [ -x "/sbin/weak-modules" ]; then
>> +        for m in openvswitch vport-gre vport-stt vport-geneve \
>> +                 vport-lisp vport-vxlan; do
>> +        echo "/lib/modules/%{kernel}/extra/$m.ko"
>> +    done | /sbin/weak-modules --remove-modules
>> +    fi
>> +fi
>>
>>   %files
>>   %defattr(0644,root,root)
>> --
>> 1.8.3.1
>>
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Gregory Rose Jan. 16, 2018, 6:31 p.m. UTC | #4
On 1/16/2018 10:15 AM, Flavio Leitner wrote:
> On Tue, Jan 16, 2018 at 08:44:15AM -0800, Greg Rose wrote:
>> Add post install and post un-install scripts to make sure that the
>> openvswitch kernel modules are correctly written with the weak-modules
>> utility. This ensures that after an upgrade to a newer kernel the
>> correct openvswitch kernel modules from a previous installation will
>> be found by the depmod search path.
>>
>> Suggested-by: Flavio Leitner <fbl@sysclose.org>
>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>>
>> ---
> LGTM, though I have not tested.
>
> Acked-by: Flavio Leitner <fbl@sysclose.org>
>

Thank you Flavio!

- Greg
Flavio Leitner Jan. 16, 2018, 7:53 p.m. UTC | #5
On Tue, Jan 16, 2018 at 10:31:29AM -0800, Gregory Rose wrote:
> On 1/16/2018 10:15 AM, Flavio Leitner wrote:
> > On Tue, Jan 16, 2018 at 08:44:15AM -0800, Greg Rose wrote:
> > > Add post install and post un-install scripts to make sure that the
> > > openvswitch kernel modules are correctly written with the weak-modules
> > > utility. This ensures that after an upgrade to a newer kernel the
> > > correct openvswitch kernel modules from a previous installation will
> > > be found by the depmod search path.
> > > 
> > > Suggested-by: Flavio Leitner <fbl@sysclose.org>
> > > Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> > > 
> > > ---
> > LGTM, though I have not tested.
> > 
> > Acked-by: Flavio Leitner <fbl@sysclose.org>
> > 
> 
> Thank you Flavio!

Thank you for fixing it :-)
Gurucharan Shetty Jan. 16, 2018, 10:38 p.m. UTC | #6
On 16 January 2018 at 08:44, Greg Rose <gvrose8192@gmail.com> wrote:

> Add post install and post un-install scripts to make sure that the
> openvswitch kernel modules are correctly written with the weak-modules
> utility. This ensures that after an upgrade to a newer kernel the
> correct openvswitch kernel modules from a previous installation will
> be found by the depmod search path.
>
> Suggested-by: Flavio Leitner <fbl@sysclose.org>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>

Woudn't dist.conf override the contents of openvswitch.conf and you still
choose inbuilt kernel module?


>
> ---
> V2 - Modify the correct kmod spec file
> ---
>  rhel/openvswitch-kmod-fedora.spec.in | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/openvswitch-kmod-
> fedora.spec.in
> index 93adb03..c0cd298 100644
> --- a/rhel/openvswitch-kmod-fedora.spec.in
> +++ b/rhel/openvswitch-kmod-fedora.spec.in
> @@ -57,7 +57,28 @@ rm -rf $RPM_BUILD_ROOT
>
>  %post
>  # Ensure that modprobe will find our modules.
> -depmod %{kernel}
> +for k in $(cd /lib/modules && /bin/ls); do
> +    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
> +done
> +if [ -x "/sbin/weak-modules" ]; then
> +    for m in openvswitch vport-gre vport-stt vport-geneve \
> +             vport-lisp vport-vxlan; do
> +        echo "/lib/modules/%{kernel}/extra/$m.ko"
> +    done | /sbin/weak-modules --add-modules
> +fi
> +
> +%postun
> +for k in $(cd /lib/modules && /bin/ls); do
> +    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
> +done
> +if [ "$1" = 0 ]; then  # Erase, not upgrade
> +    if [ -x "/sbin/weak-modules" ]; then
> +        for m in openvswitch vport-gre vport-stt vport-geneve \
> +                 vport-lisp vport-vxlan; do
> +        echo "/lib/modules/%{kernel}/extra/$m.ko"
> +    done | /sbin/weak-modules --remove-modules
> +    fi
> +fi
>
>  %files
>  %defattr(0644,root,root)
> --
> 1.8.3.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Gregory Rose Jan. 16, 2018, 11:33 p.m. UTC | #7
On 1/16/2018 2:38 PM, Guru Shetty wrote:
>
>
> On 16 January 2018 at 08:44, Greg Rose <gvrose8192@gmail.com 
> <mailto:gvrose8192@gmail.com>> wrote:
>
>     Add post install and post un-install scripts to make sure that the
>     openvswitch kernel modules are correctly written with the weak-modules
>     utility. This ensures that after an upgrade to a newer kernel the
>     correct openvswitch kernel modules from a previous installation will
>     be found by the depmod search path.
>
>     Suggested-by: Flavio Leitner <fbl@sysclose.org
>     <mailto:fbl@sysclose.org>>
>     Signed-off-by: Greg Rose <gvrose8192@gmail.com
>     <mailto:gvrose8192@gmail.com>>
>
>
> Woudn't dist.conf override the contents of openvswitch.conf and you 
> still choose inbuilt kernel module?

It was my understanding that this would obviate the need for fiddling 
with the depmod search path by correct usage of the weak-modules utility.

- Greg

>
>     ---
>     V2 - Modify the correct kmod spec file
>     ---
>      rhel/openvswitch-kmod-fedora.spec.in
>     <http://openvswitch-kmod-fedora.spec.in> | 23 ++++++++++++++++++++++-
>      1 file changed, 22 insertions(+), 1 deletion(-)
>
>     diff --git a/rhel/openvswitch-kmod-fedora.spec.in
>     <http://openvswitch-kmod-fedora.spec.in>
>     b/rhel/openvswitch-kmod-fedora.spec.in
>     <http://openvswitch-kmod-fedora.spec.in>
>     index 93adb03..c0cd298 100644
>     --- a/rhel/openvswitch-kmod-fedora.spec.in
>     <http://openvswitch-kmod-fedora.spec.in>
>     +++ b/rhel/openvswitch-kmod-fedora.spec.in
>     <http://openvswitch-kmod-fedora.spec.in>
>     @@ -57,7 +57,28 @@ rm -rf $RPM_BUILD_ROOT
>
>      %post
>      # Ensure that modprobe will find our modules.
>     -depmod %{kernel}
>     +for k in $(cd /lib/modules && /bin/ls); do
>     +    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
>     +done
>     +if [ -x "/sbin/weak-modules" ]; then
>     +    for m in openvswitch vport-gre vport-stt vport-geneve \
>     +             vport-lisp vport-vxlan; do
>     +        echo "/lib/modules/%{kernel}/extra/$m.ko"
>     +    done | /sbin/weak-modules --add-modules
>     +fi
>     +
>     +%postun
>     +for k in $(cd /lib/modules && /bin/ls); do
>     +    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
>     +done
>     +if [ "$1" = 0 ]; then  # Erase, not upgrade
>     +    if [ -x "/sbin/weak-modules" ]; then
>     +        for m in openvswitch vport-gre vport-stt vport-geneve \
>     +                 vport-lisp vport-vxlan; do
>     +        echo "/lib/modules/%{kernel}/extra/$m.ko"
>     +    done | /sbin/weak-modules --remove-modules
>     +    fi
>     +fi
>
>      %files
>      %defattr(0644,root,root)
>     --
>     1.8.3.1
>
>     _______________________________________________
>     dev mailing list
>     dev@openvswitch.org <mailto:dev@openvswitch.org>
>     https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>     <https://mail.openvswitch.org/mailman/listinfo/ovs-dev>
>
>
Ansis Jan. 16, 2018, 11:39 p.m. UTC | #8
On 16 January 2018 at 15:33, Gregory Rose <gvrose8192@gmail.com> wrote:
> On 1/16/2018 2:38 PM, Guru Shetty wrote:
>>
>>
>>
>> On 16 January 2018 at 08:44, Greg Rose <gvrose8192@gmail.com
>> <mailto:gvrose8192@gmail.com>> wrote:
>>
>>     Add post install and post un-install scripts to make sure that the
>>     openvswitch kernel modules are correctly written with the weak-modules
>>     utility. This ensures that after an upgrade to a newer kernel the
>>     correct openvswitch kernel modules from a previous installation will
>>     be found by the depmod search path.
>>
>>     Suggested-by: Flavio Leitner <fbl@sysclose.org
>>     <mailto:fbl@sysclose.org>>
>>     Signed-off-by: Greg Rose <gvrose8192@gmail.com
>>     <mailto:gvrose8192@gmail.com>>
>>
>>
>> Woudn't dist.conf override the contents of openvswitch.conf and you still
>> choose inbuilt kernel module?
>
>
> It was my understanding that this would obviate the need for fiddling with
> the depmod search path by correct usage of the weak-modules utility.
>


I already pushed this patch to master and branch-2.8 before seeing
Guru's question about depmod config changes. Greg, please send another
patch if there is something else needed.
Gregory Rose Jan. 17, 2018, 12:32 a.m. UTC | #9
On 1/16/2018 3:39 PM, Ansis Atteka wrote:
> On 16 January 2018 at 15:33, Gregory Rose <gvrose8192@gmail.com> wrote:
>> On 1/16/2018 2:38 PM, Guru Shetty wrote:
>>>
>>>
>>> On 16 January 2018 at 08:44, Greg Rose <gvrose8192@gmail.com
>>> <mailto:gvrose8192@gmail.com>> wrote:
>>>
>>>      Add post install and post un-install scripts to make sure that the
>>>      openvswitch kernel modules are correctly written with the weak-modules
>>>      utility. This ensures that after an upgrade to a newer kernel the
>>>      correct openvswitch kernel modules from a previous installation will
>>>      be found by the depmod search path.
>>>
>>>      Suggested-by: Flavio Leitner <fbl@sysclose.org
>>>      <mailto:fbl@sysclose.org>>
>>>      Signed-off-by: Greg Rose <gvrose8192@gmail.com
>>>      <mailto:gvrose8192@gmail.com>>
>>>
>>>
>>> Woudn't dist.conf override the contents of openvswitch.conf and you still
>>> choose inbuilt kernel module?
>>
>> It was my understanding that this would obviate the need for fiddling with
>> the depmod search path by correct usage of the weak-modules utility.
>>
>
> I already pushed this patch to master and branch-2.8 before seeing
> Guru's question about depmod config changes. Greg, please send another
> patch if there is something else needed.

Once some internal testing is done with a build including this patch, if 
the patch is not sufficient then we still have Guru's fix to try.  Let's 
wait and see.

Thanks,

- Greg
diff mbox series

Patch

diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/openvswitch-kmod-fedora.spec.in
index 93adb03..c0cd298 100644
--- a/rhel/openvswitch-kmod-fedora.spec.in
+++ b/rhel/openvswitch-kmod-fedora.spec.in
@@ -57,7 +57,28 @@  rm -rf $RPM_BUILD_ROOT
 
 %post
 # Ensure that modprobe will find our modules.
-depmod %{kernel}
+for k in $(cd /lib/modules && /bin/ls); do
+    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
+done
+if [ -x "/sbin/weak-modules" ]; then
+    for m in openvswitch vport-gre vport-stt vport-geneve \
+             vport-lisp vport-vxlan; do
+        echo "/lib/modules/%{kernel}/extra/$m.ko"
+    done | /sbin/weak-modules --add-modules
+fi
+
+%postun
+for k in $(cd /lib/modules && /bin/ls); do
+    [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
+done
+if [ "$1" = 0 ]; then  # Erase, not upgrade
+    if [ -x "/sbin/weak-modules" ]; then
+        for m in openvswitch vport-gre vport-stt vport-geneve \
+                 vport-lisp vport-vxlan; do
+        echo "/lib/modules/%{kernel}/extra/$m.ko"
+    done | /sbin/weak-modules --remove-modules
+    fi
+fi
 
 %files
 %defattr(0644,root,root)