[ovs-dev] [PATCH 2/2] fedora: Handle upgrades from rhel package.

Ansis Atteka ansisatteka at gmail.com
Fri May 10 00:36:28 UTC 2019


On Fri, 3 May 2019 at 11:19, Gurucharan Shetty <guru at ovn.org> wrote:
>
> 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 <guru at ovn.org>

Do I understand correctly that Aaron has concern whether the
autoenable build flag that you introduced in patch 1/2 should
automatically enable openvswitch on every installation (opposed to
only first installation)? Did you look into how other fedora packages
that enable services on installation behave? I kinda see the point
that if admin explicitly disabled openvswitch then we should not
blindly re-enable openvswitch back...

> ---
>  rhel/openvswitch-fedora.spec.in | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
> index e8165f9..d41d11c 100644
> --- a/rhel/openvswitch-fedora.spec.in
> +++ b/rhel/openvswitch-fedora.spec.in
> @@ -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
> @@ -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

The double restart thingy seems kinda weird to me as well, but I don't
have insight why systemd behaves that way. Would calling systemctl
stop before daemon-reload and then systemctl [re]start after
daemon-reload solve the problem in a more elegant way? If not probably
this is not worth something worth to bother with.

> +    # daemons. Another "restart" (outside the package postinst script) is
> +    # needed to actually run new daemons.
> +    if [ -e "%{_tmppath}/ovs-upgrade-from-sysv" ]; then
t seems that if rpm package that was built from rhel spec file was
removed (without upgrade) and then you do fresh install, then you hit
this upgrade path too. Unless the whole host was rebooted before fresh
install and all contents of /tmp directory were purged. Though this
may not be an issue after invoking the "sytemctl enable", right?

Do you think it may make sense to commit to remove this migration code
after couple releases? I kinda see this as a temporary solution that
is supposed to help admins with migrating from rhel spec files to
fedora spec files. Once everyone has migrated, then this code becomes
clutter.
> +        systemctl restart openvswitch
> +        rm "%{_tmppath}/ovs-upgrade-from-sysv"
> +    fi
>  %endif
>
>  %post selinux-policy
> --
> 1.9.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev


More information about the dev mailing list