From patchwork Wed Sep 22 12:17:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1531217 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=U7+lW0Sn; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 4HDy411VmKz9sW4 for ; Wed, 22 Sep 2021 22:17:53 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D81FE407B6; Wed, 22 Sep 2021 12:17:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pwgsD4hY9Z8J; Wed, 22 Sep 2021 12:17:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1C4D44075E; Wed, 22 Sep 2021 12:17:49 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E52D6C0011; Wed, 22 Sep 2021 12:17:48 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id A997DC000D for ; Wed, 22 Sep 2021 12:17:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9940740139 for ; Wed, 22 Sep 2021 12:17:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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 rZJH5UJpMOwm for ; Wed, 22 Sep 2021 12:17:45 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by smtp2.osuosl.org (Postfix) with ESMTPS id 4C532400FA for ; Wed, 22 Sep 2021 12:17:45 +0000 (UTC) Received: by mail-lf1-x134.google.com with SMTP id z24so10903424lfu.13 for ; Wed, 22 Sep 2021 05:17:45 -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=3j6FZGRPAPY/Yxpneq1QR4ZBSShW9eDD1HA5Rz2rg/g=; b=U7+lW0SneHpbFrgUsZvL5XoJ8k8ot079HaFvYA5cmsQ4iUWsJ+cp56sGXC0/X5sUuA k7M9Jm3Ych7J3x/vIGi1wNRvIQuNK0zBk16RAYU8dAFbB6l9QZnhv1M0vrdlj1n+jcyK I4k4wkqYcLBScdJTEJeRDIsUbJ0VlY/TeZbmnX4QCtoSByUNgc6DbB4IW6YgYT0MGlO2 kbd8TTkge5Va5gywlbfatzfe3LErS64ewZHvIfJxz220Ohr1LzvrbazJmnEVc4y8Awr1 cn1kz6V+zhrOqtiEBxXCIykGBLYVKB7+a1nSkQIGoeefaGLDFi7bmkc/PKPumHRLnKer dPXg== 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=3j6FZGRPAPY/Yxpneq1QR4ZBSShW9eDD1HA5Rz2rg/g=; b=jxbkaEIrqPgEVIbIKpqlL5Pu9MkVJE5Q7DBmIsY04BkKU8xCbjZkHhxajXS7mN1RyL Fs9XTPtVGE4SOFVpalEpFvjfOtJ5zUm2Kfko+XG67NrK+FX0cjafEqSDSu2oDjYz7AnV EupdHVkEo1LhPVC4+SrQBs6mqVgxIXgQi1cO5OZaOGTPnAI+TO4yCGuPQKPx3kKzrAfI ZpElA+4XMScNijw9byNtJj0wYvqfWqqBItfRgK4atnFx4ScDh0IIzQywFjhuAi1gNCRd m7aAS3pE/pgXTkK6QN646lD8yz8CAQOPgpSLSsaxo5nME1IX6ppxHHP4rPhQrPR/Z+vT yOzQ== X-Gm-Message-State: AOAM5306bvTfbdwU2u3+i4xDF9NCepyLbQvcz4Yr27Wra/ikGyIa0ql6 Tgi9ZaMJafKTDVcO6SwmuPoG6wjg4Q0= X-Google-Smtp-Source: ABdhPJwNku1Ryvql1WT9aseD0Tw4VRTldFYxhB57vekomwYaoTonaK25zZauADiTxdxVFt29kChmEA== X-Received: by 2002:a05:651c:150b:: with SMTP id e11mr34495994ljf.289.1632313063139; Wed, 22 Sep 2021 05:17:43 -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 u21sm236492lju.26.2021.09.22.05.17.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Sep 2021 05:17:42 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Wed, 22 Sep 2021 15:17:40 +0300 Message-Id: <20210922121740.59142-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: replace try-restart with restart in ovn-controller %postun 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" In commit [1] support for graceful stop during ovn-controller RPM upgrade was added. Unfortunately there was an error, where after ovn-controller service stop via ctl socket was invoked, systemd service transitioned to dead state and subsequent try-restart didn't start the service. This commit fixes such situation by checking actual ovn-controller service status and doing an unconditional restart if service was running before upgrade. [1] https://github.com/ovn-org/ovn/commit/8540c544f0e67d3dc475bbeb350ea3053a1772dd Signed-off-by: Vladislav Odintsov --- rhel/ovn-fedora.spec.in | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in index 5fe0f990f..2d6399c53 100644 --- a/rhel/ovn-fedora.spec.in +++ b/rhel/ovn-fedora.spec.in @@ -401,22 +401,19 @@ fi %postun host if [ "$1" -ge "1" ] ; then + /bin/systemctl daemon-reload >/dev/null 2>&1 || : # 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 - /bin/systemctl daemon-reload >/dev/null 2>&1 || : - if [ "$1" -ge "1" ] ; then - # Package upgrade, not uninstall - /bin/systemctl try-restart ovn-controller.service >/dev/null 2>&1 || : + systemctl -q is-active ovn-controller + if [ "$?" -eq 0 ] ; then + # ovn-controller was running prior to upgrade, so do a graceful restart + %{_datadir}/ovn/scripts/ovn-ctl stop_controller --restart >/dev/null 2>&1 || : + /bin/systemctl restart ovn-controller.service >/dev/null 2>&1 || : fi -%endif +fi %postun vtep %if 0%{?systemd_postun_with_restart:1}