From patchwork Fri Sep 17 13:27:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1529399 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=K8SWYDbQ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H9vsN24b8z9sR4 for ; Fri, 17 Sep 2021 23:28:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 1AF0F4074B; Fri, 17 Sep 2021 13:28:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7AtThAyWtyVz; Fri, 17 Sep 2021 13:28:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id E28984073F; Fri, 17 Sep 2021 13:28:02 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C24C4C000F; Fri, 17 Sep 2021 13:28:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 39126C000D for ; Fri, 17 Sep 2021 13:28:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1EADF84070 for ; Fri, 17 Sep 2021 13:28:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xxISlCx8La6F for ; Fri, 17 Sep 2021 13:27:59 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by smtp1.osuosl.org (Postfix) with ESMTPS id 96AA281D19 for ; Fri, 17 Sep 2021 13:27:59 +0000 (UTC) Received: by mail-lf1-x12c.google.com with SMTP id m3so31092782lfu.2 for ; Fri, 17 Sep 2021 06:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZRQiEMY9p0TGHDtWAfuUlC2WmTlH5gXOI68Kc8JucnI=; b=K8SWYDbQfDWBBWcBBlykXWCKJP6vwRjKxwFDeUsFjSijPX8QI7TrFYWCi7EM2NP5SN pld8wfNJbGLZkNyHlfSMeRFGkw+IKpoap8HxOZ2cS4Hy+1T3RK5npw8nzDOs9+eyJnkh aAA+LVWJCn5cmLEw+uNF63APDAdC4Ojt51CDsIs7lF0cOjLVjDce77GjpNsQQNZaT4rr FDm7T29Q7pY/Frlu4p9k3KuSFLsG3XUPdGmw9YMH3v9IIdkltrc2U4SBguTr2KnIMmcb wEldDkLSch9Smgf19ofldZUbhxAi8Vxke7JSIvhD/SyRqPoDN+suWb5feQ+DBTYGZr2P 6fXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZRQiEMY9p0TGHDtWAfuUlC2WmTlH5gXOI68Kc8JucnI=; b=GSTpp4mTkeoZgx8NJh1Ijz9k+yz78iLSsUt1LTVrleU725Pug4PmO8/TfNaH3nCQFA Awf/v0xi1rO1Oxn+WB40OpV65pqG+rs5oGQWg9QHK6dSE0dRxOMt5t7rvBapFoyRM6zv u/JRyKZwNzebycIn/Q8MH3oWioNRpwQ/Jm6tS4GZCD3e6vtBprK6Tt7aPPc+fGLGpBay dDDB9v3yER+h66DXeK41gPIuqr3aKCeePO7GqDOvHBINCppgowX1LCQcVz8454QZcBfJ 1UEhJNZ4oTUsNGMSPQDf6q8KR3wRsZoE78d2fLllv9yMETWxumkQArVmOiCwZfzCHqej gOhQ== X-Gm-Message-State: AOAM533gbbWrTPIZ2K4LuUE54Y6+8E1FUVCnLzZ3XKm5A684mMECCHys 7WCRKvvT8BWiFAqCfwhDDkBut+KHpQw= X-Google-Smtp-Source: ABdhPJyJO94Iz6SOrspZ3QeOLQdGW1ho+LRRZ4LjWkMAm4Ise0hO8HzEiBTQI7NqrLQdn2FMRQyNOA== X-Received: by 2002:a2e:3912:: with SMTP id g18mr9098889lja.146.1631885272278; Fri, 17 Sep 2021 06:27:52 -0700 (PDT) Received: from localhost.localdomain (109-252-131-59.dynamic.spd-mgts.ru. [109.252.131.59]) by smtp.gmail.com with ESMTPSA id 203sm732025ljf.63.2021.09.17.06.27.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Sep 2021 06:27:52 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 17 Sep 2021 16:27:50 +0300 Message-Id: <20210917132750.4114-1-odivlad@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn] rhel, utils: don't affect traffic on controller upgrade X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 --- 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}}