From nobody Mon Feb 9 19:25:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1695668414; cv=none; d=zohomail.com; s=zohoarc; b=hFIoKkqgWDQruBZh15WD9bo+Ca3+npBja2Di9GN7hpy/z/BIhLyiMKWIt7hOJSBrxYELxUIqvU6STqtJpIU744bNXKXBPCTE1kmQ65H3C68LkG1G/cdQCBRGk3AsH9NQzRci18oKAHGmL0XG/X/dRCqkPEFOp+RgCoYWbhWOZpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695668414; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YFljQEwe9CEEjOxfhFvWTVLVvTwubdftc5bytNxT0Ss=; b=be8tmkziKJWRNXwWpO5+zzJKlUprSqMQhhJOnvIDSxL9i4DIwm8YEqDryzw9v8vzC3HjdTXAocQxb8Qjo91h1VIRtTEEeC3F5jn+8RSJMDzuzZCLIpZ1fw9tj9J6WSbOxD80mhaJr1ZF7D3Hq38OEssF92r4ylcWjUv6S7K38Sc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1695668414728274.89183028965977; Mon, 25 Sep 2023 12:00:14 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-evB_JfFkNuqWAk_awyKsrQ-1; Mon, 25 Sep 2023 14:59:50 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 419B580A1C6; Mon, 25 Sep 2023 18:59:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A45249BB9A; Mon, 25 Sep 2023 18:59:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1FBC219465A3; Mon, 25 Sep 2023 18:59:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 444F3194658C for ; Mon, 25 Sep 2023 18:59:41 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 38D31711294; Mon, 25 Sep 2023 18:59:41 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.45.226.198]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C1222711293 for ; Mon, 25 Sep 2023 18:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695668413; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=YFljQEwe9CEEjOxfhFvWTVLVvTwubdftc5bytNxT0Ss=; b=RSHcRRyOUO/xcIZlr6cmc9aFheqlKEt/OnWEt/3MoO+PbvPKZyJNtXQ1HkWU3/J4PBdtbn ClpnVV4UkRbbb2+RXwvpkBcQpnYPWXxZkx5pSOO/vovjVLtvlq1f4TkBaKxPbWg48mtWr8 zRjhSr3SR/J81tfgz1kPNNn4VM+AUrI= X-MC-Unique: evB_JfFkNuqWAk_awyKsrQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 34/42] systemd: Make modular daemons conflict with libvirtd Date: Mon, 25 Sep 2023 20:58:32 +0200 Message-ID: <20230925185840.880191-35-abologna@redhat.com> In-Reply-To: <20230925185840.880191-1-abologna@redhat.com> References: <20230925185840.880191-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1695668415865100003 Content-Type: text/plain; charset="utf-8"; x-default="true" We want to make sure that, at any given time, we have either the modular daemons or the monolithic one running, never both. In order to achieve that, make every single modular unit conflict with the corresponding libvirtd unit. We set both Conflicts=3Dlibvirtd.unit and After=3Dlibvirtd.unit: this tells systemd that, whenever virtfood.unit and libvirtd.unit are part of the same transaction, the former should win out. Thanks to this, if both the modular daemons and the monolithic one have been enabled because of outdated automation or a simple mistake of the administrator, the request to start libvirtd at boot will be ignored and the result will be a regular modular deployment. If the request to start libvirtd is made when the modular daemons are already running, we have no way to prevent systemd from complying with that request; however, thanks to the way the conflict relationship has been declared, they will be shut down cleanly before libvirtd is started. From the user's point of view, the transition from modular to monolithic will be completely transparent: it's basically the same scenario as a regular package upgrade, just with an extra twist. Note that, while switching from modular to monolithic at runtime happens automatically, going back requires manual intervention, i.e. starting all the necessary sockets one by one. That's okay: the goal here is to prevent misconfiguration and force of habit to accidentally disrupt a working setup, not to encourage the scenario. In a correctly configured and managed host, it should never occur. Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- src/virtd-admin.socket.in | 2 ++ src/virtd-ro.socket.in | 2 ++ src/virtd-tcp.socket.in | 2 ++ src/virtd-tls.socket.in | 2 ++ src/virtd.service.in | 3 ++- src/virtd.socket.in | 2 ++ 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/virtd-admin.socket.in b/src/virtd-admin.socket.in index 3a09951b12..e43f4df82d 100644 --- a/src/virtd-admin.socket.in +++ b/src/virtd-admin.socket.in @@ -3,6 +3,8 @@ Description=3D@name@ admin socket Before=3D@service@.service BindsTo=3D@service@.socket After=3D@service@.socket +Conflicts=3Dlibvirtd-admin.socket +After=3Dlibvirtd-admin.socket @socket_unit_extra@ =20 [Socket] diff --git a/src/virtd-ro.socket.in b/src/virtd-ro.socket.in index e882f25a7b..7b91f0d657 100644 --- a/src/virtd-ro.socket.in +++ b/src/virtd-ro.socket.in @@ -3,6 +3,8 @@ Description=3D@name@ local read-only socket Before=3D@service@.service BindsTo=3D@service@.socket After=3D@service@.socket +Conflicts=3Dlibvirtd-ro.socket +After=3Dlibvirtd-ro.socket @socket_unit_extra@ =20 [Socket] diff --git a/src/virtd-tcp.socket.in b/src/virtd-tcp.socket.in index 26c6dfa75b..d715e2d00d 100644 --- a/src/virtd-tcp.socket.in +++ b/src/virtd-tcp.socket.in @@ -3,6 +3,8 @@ Description=3D@name@ non-TLS IP socket Before=3D@service@.service BindsTo=3D@service@.socket After=3D@service@.socket +Conflicts=3Dlibvirtd-tcp.socket +After=3Dlibvirtd-tcp.socket @socket_unit_extra@ =20 [Socket] diff --git a/src/virtd-tls.socket.in b/src/virtd-tls.socket.in index 077c320cce..5b2550fb1d 100644 --- a/src/virtd-tls.socket.in +++ b/src/virtd-tls.socket.in @@ -3,6 +3,8 @@ Description=3D@name@ TLS IP socket Before=3D@service@.service BindsTo=3D@service@.socket After=3D@service@.socket +Conflicts=3Dlibvirt-tls.socket +After=3Dlibvirt-tls.socket @socket_unit_extra@ =20 [Socket] diff --git a/src/virtd.service.in b/src/virtd.service.in index c9afecad73..21391a65b0 100644 --- a/src/virtd.service.in +++ b/src/virtd.service.in @@ -1,9 +1,10 @@ [Unit] Description=3D@name@ daemon -Conflicts=3Dlibvirtd.service Requires=3D@service@.socket Requires=3D@service@-ro.socket Requires=3D@service@-admin.socket +Conflicts=3Dlibvirtd.service +After=3Dlibvirtd.service After=3Dnetwork.target After=3Ddbus.service After=3Dapparmor.service diff --git a/src/virtd.socket.in b/src/virtd.socket.in index 278f59ef1c..e4dc94b277 100644 --- a/src/virtd.socket.in +++ b/src/virtd.socket.in @@ -1,6 +1,8 @@ [Unit] Description=3D@name@ local socket Before=3D@service@.service +Conflicts=3Dlibvirtd.socket +After=3Dlibvirtd.socket @socket_unit_extra@ =20 [Socket] --=20 2.41.0