[ovs-dev] [PATCH ovn] rhel, utils: don't affect traffic on controller upgrade
Numan Siddique
numans at ovn.org
Fri Sep 17 20:02:07 UTC 2021
On Fri, Sep 17, 2021 at 9:28 AM Vladislav Odintsov <odivlad at gmail.com> wrote:
>
> Currently upgrade of ovn-host rpm package affects active
> traffic. This is because systemctl try-restart
> ovn-controller is invoked during rpm package upgrade.
> It calls ovn-ctl stop_controller and then start_controller.
>
> Adding ovn-ctl stop_controller --restart to %postun
> upgrade case right before systemctl try-restart. Also,
> upgrade ovn-ctl script to support --restart argument in it.
>
> Ideally this should be done by systemd when restart is
> called, but it's impossible to pass restart command to
> systemd.
>
> Signed-off-by: Vladislav Odintsov <odivlad at gmail.com>
Thanks for the patch. I applied this patch.
I did try to find a better way to fix it. Seems to me this is the only way.
Numan
> ---
> rhel/ovn-fedora.spec.in | 8 ++++++++
> utilities/ovn-ctl | 10 ++++++++--
> 2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
> index 6716dd0d2..5fe0f990f 100644
> --- a/rhel/ovn-fedora.spec.in
> +++ b/rhel/ovn-fedora.spec.in
> @@ -400,6 +400,14 @@ fi
> %endif
>
> %postun host
> +if [ "$1" -ge "1" ] ; then
> + # Package upgrade, not uninstall
> + # We perform lightweight stop here not to affect active traffic during
> + # ovn-controller upgrade.
> + # Ideally this would be held by systemd, but it's impossible
> + # to pass custom restart command to systemd service.
> + %{_datadir}/ovn/scripts/ovn-ctl stop_controller --restart
> +fi
> %if 0%{?systemd_postun_with_restart:1}
> %systemd_postun_with_restart ovn-controller.service
> %else
> diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
> index ff61f21d0..b30eb209d 100755
> --- a/utilities/ovn-ctl
> +++ b/utilities/ovn-ctl
> @@ -584,7 +584,11 @@ stop_ic () {
> }
>
> stop_controller () {
> - OVS_RUNDIR=${OVS_RUNDIR} stop_ovn_daemon ovn-controller "" "" "$@"
> + set "ovn-controller" "" ""
> + if test X"$RESTART" = Xyes; then
> + set "$@" "--restart"
> + fi
> + OVS_RUNDIR=${OVS_RUNDIR} stop_ovn_daemon "$@"
> }
>
> stop_controller_vtep () {
> @@ -606,7 +610,8 @@ restart_ic () {
> }
>
> restart_controller () {
> - stop_controller --restart
> + RESTART=yes
> + stop_controller
> start_controller
> }
>
> @@ -651,6 +656,7 @@ restart_ic_sb_ovsdb () {
>
> set_defaults () {
> OVN_MANAGE_OVSDB=yes
> + RESTART=no
>
> OVS_RUNDIR=${OVS_RUNDIR:-${rundir}}
> OVN_RUNDIR=${OVN_RUNDIR:-${ovn_rundir}}
> --
> 2.30.0
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
More information about the dev
mailing list