From nobody Sat Nov 23 18:04:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 172305135533297.25844099352548; Wed, 7 Aug 2024 10:22:35 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5519F12B5; Wed, 7 Aug 2024 13:22:34 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 66E5F134A; Wed, 7 Aug 2024 13:16:25 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1A0E81172; Wed, 7 Aug 2024 13:16:13 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0985BCA8 for ; Wed, 7 Aug 2024 13:16:11 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-359--k17OFcDMP2nZ6-lTEGgZw-1; Wed, 07 Aug 2024 13:16:10 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6B25B19560B6 for ; Wed, 7 Aug 2024 17:16:09 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.32.31]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EED9419560A3 for ; Wed, 7 Aug 2024 17:16:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723050971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wNJSHIN4VOVC7HgIFvttXItKf+2BmZdn6ZFy6Lzuq0k=; b=Aa1ifhMrB2LSPlxwOJhCiov4P1ZABk5tBwYfmoTLM/deSu5wmwfhtHaXjnChvO7NDAmhZ3 MF1GNrVUdr2KBJS0gtSqxbwAO7b3fEbUzdLV8fbNmOA0VtYLiUmno7DIczzEC9n3YlEa9y NCSefrVK1ZYwPyw8Cfcn1cM8IFjYm0o= X-MC-Unique: -k17OFcDMP2nZ6-lTEGgZw-1 From: Laine Stump To: devel@lists.libvirt.org Subject: [PATCH 7/7] spec: stop trying to find unused network during deamon-network-config %post Date: Wed, 7 Aug 2024 13:16:03 -0400 Message-ID: <20240807171603.218784-8-laine@redhat.com> In-Reply-To: <20240807171603.218784-1-laine@redhat.com> References: <20240807171603.218784-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VM6Q43VA6YQX724HFPMCFMN7NGV6QU2G X-Message-ID-Hash: VM6Q43VA6YQX724HFPMCFMN7NGV6QU2G X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1723051355861116600 Content-Type: text/plain; charset="utf-8"; x-default="true" Since the default network now has autoaddr=3D'yes', there is no need to waste time during %post install looking for an unused network and modifying the config of the default virtual network. (It would be even simpler to just install the files directly to /etc rather than installing to the examples and then copying to /etc, but if we did that then someone who had manually net-undefined the default network would keep getting it reinstalled every time there was an update to libvirt-daemon-config-network. Of course these days someone who wants to do that can simply dnf rm daemon-config-network if they didn't want the stock default network config, but nobody will be expecting that they have to do that, leading to hundreds of bug reports about "I deleted the default network and it comes back every time I update my packages!") Signed-off-by: Laine Stump --- libvirt.spec.in | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 51cecfa598..cb62e0dcdb 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1949,38 +1949,12 @@ exit 0 %libvirt_systemd_config_pre virtnetworkd =20 %post daemon-config-network +# Installing during %post via cp rather than directly as a part of the pac= kage manifest +# prevents us from reinstalling on update in cases where the user has net-= undefined +# the default network (and so doesn't *want* it to be reinstalled) if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default= .xml ; then - # see if the network used by default network creates a conflict, - # and try to resolve it - # NB: 192.168.122.0/24 is used in the default.xml template file; - # do not modify any of those values here without also modifying - # them in the template. - orig_sub=3D122 - sub=3D${orig_sub} - nl=3D' -' - routes=3D"${nl}$(ip route show | cut -d' ' -f1)${nl}" - case ${routes} in - *"${nl}192.168.${orig_sub}.0/24${nl}"*) - # there was a match, so we need to look for an unused subnet - for new_sub in $(seq 124 254); do - case ${routes} in - *"${nl}192.168.${new_sub}.0/24${nl}"*) - ;; - *) - sub=3D$new_sub - break; - ;; - esac - done - ;; - *) - ;; - esac - - sed -e "s/${orig_sub}/${sub}/g" \ - < %{_datadir}/libvirt/networks/default.xml \ - > %{_sysconfdir}/libvirt/qemu/networks/default.xml + cp %{_datadir}/libvirt/networks/default.xml \ + %{_sysconfdir}/libvirt/qemu/networks/default.xml ln -s ../default.xml %{_sysconfdir}/libvirt/qemu/networks/autostart/de= fault.xml # libvirt saves this file with mode 0600 chmod 0600 %{_sysconfdir}/libvirt/qemu/networks/default.xml --=20 2.45.2