[ovs-dev] rhel: Fix upgrade path
diff mbox series

Message ID 1561488352-13391-1-git-send-email-gvrose8192@gmail.com
State New
Headers show
Series
  • [ovs-dev] rhel: Fix upgrade path
Related show

Commit Message

Gregory Rose June 25, 2019, 6:45 p.m. UTC
There is a bug in the upgrade path from the old kmod-openvswitch SysV
based RPM to the new openvswitch-kmod systemd based RPM. Since the
name of the package is changed it is not possible to use the yum
or rpm upgrade options.  This prevents passing in a 1 or 2 to the
%postun scriptlet section of the older RPM and that causes the section
to be treated as an 'erase'.  The old kmod-openvswitch %postun section
proceeds to erase the symlinks in ../weak-updates/openvwswitch that
the installation of the new package had just created.

Fix this by adding a %posttrans tag to the systemd spec file.  This
scriptlet is called after the symlinks have just been erased and
it calls the ovs-kmod-manage.sh script to recreate the symlinks and
run depmod -a again so that the correct kernel modules will be
found and loaded.

VMware-BZ: #236987

Cc: Aaron Conole <aconole@redhat.com>
Cc: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 rhel/openvswitch-kmod-fedora.spec.in | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Aaron Conole June 25, 2019, 9:05 p.m. UTC | #1
Greg Rose <gvrose8192@gmail.com> writes:

> There is a bug in the upgrade path from the old kmod-openvswitch SysV
> based RPM to the new openvswitch-kmod systemd based RPM. Since the
> name of the package is changed it is not possible to use the yum
> or rpm upgrade options.  This prevents passing in a 1 or 2 to the
> %postun scriptlet section of the older RPM and that causes the section
> to be treated as an 'erase'.  The old kmod-openvswitch %postun section
> proceeds to erase the symlinks in ../weak-updates/openvwswitch that
> the installation of the new package had just created.
>
> Fix this by adding a %posttrans tag to the systemd spec file.  This
> scriptlet is called after the symlinks have just been erased and
> it calls the ovs-kmod-manage.sh script to recreate the symlinks and
> run depmod -a again so that the correct kernel modules will be
> found and loaded.
>
> VMware-BZ: #236987
>
> Cc: Aaron Conole <aconole@redhat.com>
> Cc: Flavio Leitner <fbl@redhat.com>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> ---

LGTM.  I didn't test this, though.

Acked-by: Aaron Conole <aconole@redhat.com>
Gregory Rose June 25, 2019, 10:01 p.m. UTC | #2
On 6/25/2019 2:05 PM, Aaron Conole wrote:
> Greg Rose <gvrose8192@gmail.com> writes:
>
>> There is a bug in the upgrade path from the old kmod-openvswitch SysV
>> based RPM to the new openvswitch-kmod systemd based RPM. Since the
>> name of the package is changed it is not possible to use the yum
>> or rpm upgrade options.  This prevents passing in a 1 or 2 to the
>> %postun scriptlet section of the older RPM and that causes the section
>> to be treated as an 'erase'.  The old kmod-openvswitch %postun section
>> proceeds to erase the symlinks in ../weak-updates/openvwswitch that
>> the installation of the new package had just created.
>>
>> Fix this by adding a %posttrans tag to the systemd spec file.  This
>> scriptlet is called after the symlinks have just been erased and
>> it calls the ovs-kmod-manage.sh script to recreate the symlinks and
>> run depmod -a again so that the correct kernel modules will be
>> found and loaded.
>>
>> VMware-BZ: #236987
>>
>> Cc: Aaron Conole <aconole@redhat.com>
>> Cc: Flavio Leitner <fbl@redhat.com>
>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>> ---
> LGTM.  I didn't test this, though.
>
> Acked-by: Aaron Conole <aconole@redhat.com>
Thanks!!
Justin Pettit June 25, 2019, 11:28 p.m. UTC | #3
> On Jun 25, 2019, at 2:05 PM, Aaron Conole <aconole@redhat.com> wrote:
> 
> Greg Rose <gvrose8192@gmail.com> writes:
> 
>> There is a bug in the upgrade path from the old kmod-openvswitch SysV
>> based RPM to the new openvswitch-kmod systemd based RPM. Since the
>> name of the package is changed it is not possible to use the yum
>> or rpm upgrade options.  This prevents passing in a 1 or 2 to the
>> %postun scriptlet section of the older RPM and that causes the section
>> to be treated as an 'erase'.  The old kmod-openvswitch %postun section
>> proceeds to erase the symlinks in ../weak-updates/openvwswitch that
>> the installation of the new package had just created.
>> 
>> Fix this by adding a %posttrans tag to the systemd spec file.  This
>> scriptlet is called after the symlinks have just been erased and
>> it calls the ovs-kmod-manage.sh script to recreate the symlinks and
>> run depmod -a again so that the correct kernel modules will be
>> found and loaded.
>> 
>> VMware-BZ: #236987
>> 
>> Cc: Aaron Conole <aconole@redhat.com>
>> Cc: Flavio Leitner <fbl@redhat.com>
>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>> ---
> 
> LGTM.  I didn't test this, though.
> 
> Acked-by: Aaron Conole <aconole@redhat.com>

Thanks for the patch and review.  I committed it to master, branch-2.11, and branch-2.10.  Let me know if I should backport it further.

--Justin
0-day Robot June 26, 2019, 9:31 a.m. UTC | #4
Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Committer Justin Pettit <jpettit@ovn.org> needs to sign off.
Lines checked: 52, Warnings: 0, Errors: 1


Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

Thanks,
0-day Robot

Patch
diff mbox series

diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/openvswitch-kmod-fedora.spec.in
index 92d763f..a50016d 100644
--- a/rhel/openvswitch-kmod-fedora.spec.in
+++ b/rhel/openvswitch-kmod-fedora.spec.in
@@ -120,6 +120,15 @@  done
 fi
 /sbin/depmod -a
 
+%posttrans
+# The upgrade path from the older kmod-openvswitch SysV package to
+# the newer openvswitch-kmod systemd package will end up removing
+# the symlinks to the weak-updates/openvswitch drivers because of
+# it's %postun section.  We add this section to handle that case.
+if [ -x "%{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh" ]; then
+    %{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh
+fi
+
 %files
 %defattr(0644,root,root)
 /lib/modules/*/extra/openvswitch/*.ko