From patchwork Mon Nov 14 19:41:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timothy Redaelli X-Patchwork-Id: 1703748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MrGze8y9; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NB07p3Pzfz23lt for ; Tue, 15 Nov 2022 06:42:14 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2A53B60AFE; Mon, 14 Nov 2022 19:42:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2A53B60AFE Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MrGze8y9 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AOVMHDjc1cQp; Mon, 14 Nov 2022 19:42:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3F339605DB; Mon, 14 Nov 2022 19:42:10 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3F339605DB Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 05E5DC0032; Mon, 14 Nov 2022 19:42:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 35983C002D for ; Mon, 14 Nov 2022 19:42:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id F1636813D0 for ; Mon, 14 Nov 2022 19:42:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org F1636813D0 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MrGze8y9 X-Virus-Scanned: amavisd-new at osuosl.org 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 YbXF0y-H0ZbR for ; Mon, 14 Nov 2022 19:42:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A2BC0813CA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id A2BC0813CA for ; Mon, 14 Nov 2022 19:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668454926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b+QU3oBnCqqMBTrcLLsrEStq5pnxv9wdxdnGnBZ+Rm8=; b=MrGze8y9K91hPNC7PpUSV43qkGDUbtIc4ials1R77uhmYw24sixsxgR1H+blq+jsRyu7fr 0AdvzsUf202lEDI9RxhVE6kKfdtHrzTSNpMOZJ0e6rIxzEH5Xp6Rh1ALaxscRII5GEDzTS Fzde3kNo4PAFHdLTE2SwWjEMPpY/IaI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-294-rPCdeHVBNkSfY-6U1pXGIA-1; Mon, 14 Nov 2022 14:42:02 -0500 X-MC-Unique: rPCdeHVBNkSfY-6U1pXGIA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF45C380673D; Mon, 14 Nov 2022 19:42:01 +0000 (UTC) Received: from aldebaran.redhat.com (ovpn-194-51.brq.redhat.com [10.40.194.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0DC7C15BB3; Mon, 14 Nov 2022 19:42:00 +0000 (UTC) From: Timothy Redaelli To: dev@openvswitch.org Date: Mon, 14 Nov 2022 20:41:53 +0100 Message-Id: <9286dc65a636d98ed48a2582049b53e3c150b6c5.1668454862.git.tredaelli@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Flavio Leitner , Yedidyah Bar David Subject: [ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks 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" conf.db is by default at /etc/openvswitch, but it should be at /var/lib/openvswitch like on Debian or like ovnnb_db.db and ovnsb_db.db. If conf.db already exists in /etc/openvswitch then it's moved to /var/lib/openvswitch. Symlinks are created for conf.db and .conf.db.~lock~ into /etc/openvswitch for backward compatibility. Reported-at: https://bugzilla.redhat.com/1830857 Reported-by: Yedidyah Bar David Signed-off-by: Timothy Redaelli --- v1 -> v2: - Use hugetlbfs group instead of openvswitch when the package is built with dpdk (as reported by Flavio) --- rhel/openvswitch-fedora.spec.in | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in index df296ea08..c8d238fbc 100644 --- a/rhel/openvswitch-fedora.spec.in +++ b/rhel/openvswitch-fedora.spec.in @@ -239,8 +239,6 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/ install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch -touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db -touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/.conf.db.~lock~ touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf install -p -m 644 -D selinux/openvswitch-custom.pp \ @@ -329,6 +327,27 @@ if [ $1 -eq 1 ]; then fi %endif +# Ensure that /etc/openvswitch/conf.db links to /var/lib/openvswitch, +# moving an existing file if there is one. +# +# Ditto for .conf.db.~lock~. +for base in conf.db .conf.db.~lock~; do + new=/var/lib/openvswitch/$base + old=/etc/openvswitch/$base + if test -f $old && test ! -e $new; then + mv $old $new + fi + if test ! -e $old && test ! -h $old; then + ln -s $new $old + fi + touch $new +%if %{with dpdk} + chown openvswitch:hugetlbfs $new +%else + chown openvswitch:openvswitch $new +%endif +done + %if 0%{?systemd_post:1} # This may not enable openvswitch service or do daemon-reload. %systemd_post %{name}.service @@ -414,8 +433,8 @@ fi %endif %dir %{_sysconfdir}/openvswitch %{_sysconfdir}/openvswitch/default.conf -%config %ghost %{_sysconfdir}/openvswitch/conf.db -%ghost %{_sysconfdir}/openvswitch/.conf.db.~lock~ +%config %ghost %{_sharedstatedir}/openvswitch/conf.db +%ghost %{_sharedstatedir}/openvswitch/.conf.db.~lock~ %config %ghost %{_sysconfdir}/openvswitch/system-id.conf %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch %defattr(-,root,root)