Skip to content

Commit

Permalink
fedora: Handle upgrades from rhel package.
Browse files Browse the repository at this point in the history
Currently we have rhel/openvswitch.spec.in that provides
sysv scripts. The fedora package provides systemd scripts.
If one upgrades openvswitch package from sysv to systemd,
you will end up in a situation where old OVS daemons are
running, but systemd does not know about it.  One "restart"
is needed for systemd to see the old daemons. Another "restart"
or "force-reload-kmod" is needed to actually use the new
daemons.

This commit, just takes care of the first restart. The "real"
restart/force-reload-kmod will still have to be done outside
the package installation.

Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Ansis Atteka <[email protected]>
  • Loading branch information
shettyg committed May 14, 2019
1 parent dcd0f1e commit dab29ad
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rhel/openvswitch-fedora.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ getent passwd openvswitch >/dev/null || \
usermod -a -G hugetlbfs openvswitch
%endif
%endif

%if %{with autoenable}
if [ -x "/etc/init.d/openvswitch" ]; then
touch %{_tmppath}/ovs-upgrade-from-sysv
fi
%endif
exit 0

%post
Expand Down Expand Up @@ -397,6 +403,14 @@ fi
%if %{with autoenable}
systemctl daemon-reload
systemctl enable openvswitch
# Handle upgrades to this package from the OVS repo's rhel packages.
# One "restart" is needed for newer systemd files to see the old running
# daemons. Another "restart" (outside the package postinst script) is
# needed to actually run new daemons.
if [ -e "%{_tmppath}/ovs-upgrade-from-sysv" ]; then
systemctl restart openvswitch
rm "%{_tmppath}/ovs-upgrade-from-sysv"
fi
%endif

%post selinux-policy
Expand Down

0 comments on commit dab29ad

Please sign in to comment.