From nobody Sat May 18 09:01:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1607330392; cv=none; d=zohomail.com; s=zohoarc; b=NSDrlcxTedgI7ROWeFP0afAoFVgNOQfj+0OwpTd+B4SxVCAEFSn8/4J1F8VfB9UqtIjzKQvYQs7Fi/UZRU6YwcccxKJZN00EPVN6/pT5+iPBP818pgkP/G4Smah1zAzH/xowpw6mvuUI4pEh3r3u52hb6EwUi30vg537CdRCD/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607330392; h=Content-Type:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=3nQyCjqGjRjgELlsn+vRvD5g2fgMrMj5N8HAUa/cmrI=; b=gOg8K9THMV9cIjPpVbYYBvtqnEwATQfd/C+Y3iNoULvFl/IbGJ5E8X4cDwnTdT0vRIsDGGaj+AUnRfQ4f9GatTipSDIBgJuR1yr8t+WQT7cVMJ3vah4SFdlqfK3Z8GQ3lWgtGCde5Z8usnMHxY8EY1TCDDZ1WTafvNIHoCuvWdE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607330391868267.11568724986034; Mon, 7 Dec 2020 00:39:51 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-2_3UcC4TOJOyWs62YwXVCw-1; Mon, 07 Dec 2020 03:39:48 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BDDA41E7C2; Mon, 7 Dec 2020 08:39:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56A6B3A3; Mon, 7 Dec 2020 08:39:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2265F4BB7B; Mon, 7 Dec 2020 08:39:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B78cvpV008476 for ; Mon, 7 Dec 2020 03:38:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id B5B762166B27; Mon, 7 Dec 2020 08:38:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B10802166B28 for ; Mon, 7 Dec 2020 08:38:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3DD6F858296 for ; Mon, 7 Dec 2020 08:38:55 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-EQgZUNFeO1m1aLNR9V-SmQ-1; Mon, 07 Dec 2020 03:38:52 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kmC2c-00C59k-7O for libvir-list@redhat.com; Mon, 07 Dec 2020 11:38:42 +0300 X-MC-Unique: 2_3UcC4TOJOyWs62YwXVCw-1 X-MC-Unique: EQgZUNFeO1m1aLNR9V-SmQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2] spec: don't touch existing nwfilters on update Date: Mon, 7 Dec 2020 11:38:33 +0300 Message-Id: <1607330313-740588-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Mimecast-Spam-Signature: yes X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Nwfilter can be edited by the user and we don't want to overwrite the editi= ngs. Also the filters in %{datadir} does not have UUIDs and these are generated = on libvirtd start. Thus this patch also fixes regeneration of UUIDs on libvirtd update. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Michal Privoznik --- It is a successor to original version of the patch [1]. The discussion can be found in [2]. Diff to v1: - just keep existing nwfilters untouched instead of bringing new version of nwfilter while keeping UUID=20 [1] https://www.redhat.com/archives/libvir-list/2020-October/msg01357.html [2] https://www.redhat.com/archives/libvir-list/2020-December/msg00260.html libvirt.spec.in | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 880051b..98914ce 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1439,12 +1439,21 @@ fi rm -rf %{_localstatedir}/lib/rpm-state/libvirt || : =20 %post daemon-config-nwfilter -cp %{_datadir}/libvirt/nwfilter/*.xml %{_sysconfdir}/libvirt/nwfilter/ -# libvirt saves these files with mode 600 -chmod 600 %{_sysconfdir}/libvirt/nwfilter/*.xml +restart_daemon=3D0 +for dfile in %{_datadir}/libvirt/nwfilter/*.xml; do + sfile=3D%{_sysconfdir}/libvirt/nwfilter/`basename $dfile` + if [ ! -f "$sfile" ]; then + cp "$dfile" "$sfile" + # libvirt saves these files with mode 600 + chmod 600 "$sfile" + restart_daemon=3D1 + fi +done # Make sure libvirt picks up the new nwfilter defininitons -mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || : -touch %{_localstatedir}/lib/rpm-state/libvirt/restart || : +if [ $restart_daemon -eq 1 ]; then + mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || : + touch %{_localstatedir}/lib/rpm-state/libvirt/restart || : +fi =20 %posttrans daemon-config-nwfilter if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then --=20 1.8.3.1