From patchwork Fri May 3 07:05:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurucharan Shetty X-Patchwork-Id: 1095007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44wgPc6w00z9s3l for ; Sat, 4 May 2019 04:18:59 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E94813A8A; Fri, 3 May 2019 18:18:54 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 2361F39DF for ; Fri, 3 May 2019 18:18:12 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A01DB79 for ; Fri, 3 May 2019 18:18:11 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id n2so3072348pgg.13 for ; Fri, 03 May 2019 11:18:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=B1VljkpkU99wN0AR86aA6XGGbMuwMW5zPxx2DtDWrGw=; b=I28TPKnXh/sOOGYw+iWUkxXUJneBwhlnyO8s+TjJrZfcY9IzOyHVzuM30R3HQrQD24 AxB56r+n6DFMu9GMdV7cKuPDab1PBb/TSM6HV4cr/iPUCko2/dhJxDjLkBouTjznIdq5 +TILzRmylD+tPp1GKyPAOVzaWbjBddB3zkKiHf1GqeQ5yrouxogex4lBJtb0mamR4GDt pKSSfNUetSxIyL4r2Jbcea05s6WYJrRI6VQHJa0oYD177VXb0fL9XjVgJOQztuqXgnT6 8k7Z23L1wPn/Fq5ckQj3PSMDCXFxHP0wQWQjcWK9piBnrSja9TU1IzijS9/iDh63XFOM mJxQ== X-Gm-Message-State: APjAAAXRKOeAZxy6Byfn0sDkgdP15TatXsb0RbGPavJ1QCKxXkJ9nLL5 +TH27APfh477+sPMoGMivntcYHnJ X-Google-Smtp-Source: APXvYqycgpRYhp5cBUGkRK2hCMxDRf4Ovlv1EtbnoiYi/Kqvt2v2KULxuofRPLujz9hmdJc9O8OaLg== X-Received: by 2002:a63:1654:: with SMTP id 20mr12489473pgw.166.1556907490966; Fri, 03 May 2019 11:18:10 -0700 (PDT) Received: from kube-master.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id h13sm427397pgk.55.2019.05.03.11.18.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 May 2019 11:18:10 -0700 (PDT) From: Gurucharan Shetty To: dev@openvswitch.org Date: Fri, 3 May 2019 00:05:34 -0700 Message-Id: <1556867135-29383-1-git-send-email-guru@ovn.org> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 1/2] fedora: Ability to auto enable openvswitch service. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org We currently have rhel/openvswitch.spec.in that automatically enables openvswitch service when the package is installed using chkconfig. But fedora rpm may not enable openvswitch service automatically. The macro currently being used in fedora rpm (systemd_post) will look for preset files in /etc/systemd/system-preset/ to figure out whether openvswitch service needs to be automatically enabled. But, the fedora package does not provide such a file. The argument is that people may want to install the package for binaries and not necessarily to run OVS. If someone now wants to install the fedora package and automatically enable openvswitch, he will have to create a new package that OVS package depends on to install the preset file. This is unwieldy. This commit, provides a rpm build time option to enable the openvswitch service automatically. If you now run the below command, openvswitch service will be automatically enabled during package installation. make rpm-fedora RPMBUILD_OPT="--with autoenable" Signed-off-by: Gurucharan Shetty Acked-by: Ansis Atteka --- rhel/openvswitch-fedora.spec.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in index ce728b4..e8165f9 100644 --- a/rhel/openvswitch-fedora.spec.in +++ b/rhel/openvswitch-fedora.spec.in @@ -32,6 +32,9 @@ # This is enabled by default for versions of the distribution that # have Python 3 by default (Fedora > 22). %bcond_with build_python3 +# If there is a need to automatically enable the package after installation, +# specify the "--with autoenable" +%bcond_with autoenable # Enable PIE, bz#955181 %global _hardened_build 1 @@ -382,6 +385,7 @@ fi %endif %if 0%{?systemd_post:1} + # This may not enable openvswitch service or do daemon-reload. %systemd_post %{name}.service %else # Package install, not upgrade @@ -390,6 +394,11 @@ fi fi %endif +%if %{with autoenable} + systemctl daemon-reload + systemctl enable openvswitch +%endif + %post selinux-policy %selinux_modules_install -s targeted %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp From patchwork Fri May 3 07:05:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurucharan Shetty X-Patchwork-Id: 1095008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44wgQB36YKz9s00 for ; Sat, 4 May 2019 04:19:30 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id CB99A3A6B; Fri, 3 May 2019 18:18:55 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 23A8B39DF for ; Fri, 3 May 2019 18:18:15 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 91BCE79 for ; Fri, 3 May 2019 18:18:12 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id 188so3263424pfd.8 for ; Fri, 03 May 2019 11:18:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=ZOdRy7BQTQLnsj4vMR08+JcBjg5eqQ1aCEzAcd25ufk=; b=En1OggEbBr+HQ3kLLGlHk1wMjFUHR5X3Vn+j5LzUG6C2muHGY3jI1fn66jdxA/djHU 8CDJnJk0Rh8dlC+ChfStfWjgnoehU6JzLIv1krGuLWoYLLKAlA80iLxVtwmqZ4J7hqCi aa0c/pxOxmsLOM5/ntTMZPALjgrqg72l5mEe8GlWZxG/WIBytuEKMQAW5reUAj6pgerJ Y/rvWQ6zqaLPefhgoyLqx0OIjzgTff9Lp5uNaZgv2HxQ2cVySnl+MHr3o8TqJCYwdAg5 egdGNycDYekUz5knx84cjiY8fFQklbAv1/gr91Ry4FrJe8WXriKbXozJytvxmkxjgJr7 O6pw== X-Gm-Message-State: APjAAAUZrQwn9q3yPjkORr+sVzs0NDLgqmPvYyrFeRPUZMPWzCmEWJVq cxe9McEgiUT7MXwrv/75S7q3ERVg X-Google-Smtp-Source: APXvYqzNNfTfrXcYQQMf4CVfJEKNAcKfojKbfWfyq9h5DHWdYzTfuR0yqQUJQ2eXqJgc++za/dWYNg== X-Received: by 2002:a65:610a:: with SMTP id z10mr12322744pgu.54.1556907491954; Fri, 03 May 2019 11:18:11 -0700 (PDT) Received: from kube-master.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id h13sm427397pgk.55.2019.05.03.11.18.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 May 2019 11:18:11 -0700 (PDT) From: Gurucharan Shetty To: dev@openvswitch.org Date: Fri, 3 May 2019 00:05:35 -0700 Message-Id: <1556867135-29383-2-git-send-email-guru@ovn.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1556867135-29383-1-git-send-email-guru@ovn.org> References: <1556867135-29383-1-git-send-email-guru@ovn.org> X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 2/2] fedora: Handle upgrades from rhel package. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 Acked-by: Ansis Atteka --- 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 + # 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