From nobody Tue May 14 20:29:48 2024 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=1644936762; cv=none; d=zohomail.com; s=zohoarc; b=n9i6NzdyW3ea+qJ6+Mx6Y9ttp0bZ08f5e67nk55mtLXjCJ4kYIQ3VMiCWBOoAz23b2CTogPY4J8HY49qmptFH5RZWnyYAO7aL6WU39GZ1HMbYxSeV6B/pjycNQJ26HZMLWNGVOdtUIN/tGjPI/epUQ2nkyO0bj7N9p3PaXKLd6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644936762; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Y1E0HPSwLIsii083vrnMFiGq3holRazqLBltKY2n6C0=; b=I1uHvAj6AMItyBd3f+vkOAxidOaN1xkrS5wIWodmjYAXFHflXlsIXZudT9hGUhist/seXmXHvM8H1N3aXjAeqW+NP6HAPOGSUSqaJe3bpTi0Otgbw54W29HrkbobSaigPzz8a+jWfKSbVf9BGOfrXEudpe72PjAkJMWCWQ8ZnYA= 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 1644936762043135.44428623328588; Tue, 15 Feb 2022 06:52:42 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-133-werqEzSkN3ikj97KjHdNsA-1; Tue, 15 Feb 2022 09:52:37 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 50970101F001; Tue, 15 Feb 2022 14:52:31 +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 43CA24CEDF; Tue, 15 Feb 2022 14:52:29 +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 647AF4BB7C; Tue, 15 Feb 2022 14:52:26 +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 21FEqOwO001851 for ; Tue, 15 Feb 2022 09:52:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4CD1B2166B17; Tue, 15 Feb 2022 14:52:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 469382166B13 for ; Tue, 15 Feb 2022 14:52:20 +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-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D0C6185A7BA for ; Tue, 15 Feb 2022 14:52:20 +0000 (UTC) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-310-AGBlq5JoPcK5f6bt6BkGtQ-1; Tue, 15 Feb 2022 09:52:18 -0500 Received: by mail-wm1-f71.google.com with SMTP id o24-20020a05600c379800b0037c3222c0faso872861wmr.1 for ; Tue, 15 Feb 2022 06:52:18 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id p7sm8308980wrr.95.2022.02.15.06.52.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 06:52:16 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 292E247959D8 for ; Tue, 15 Feb 2022 15:52:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644936760; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Y1E0HPSwLIsii083vrnMFiGq3holRazqLBltKY2n6C0=; b=hQCmdHuC7+vb23e936pYSWT6oafAfpSSMuD6iNr9/9O+KVKXOILEX4b8OcRcyoVDxFsi5q dC2vsZb0p2ooVhnQlwXCuSgIUkG/J8OT6if4NlU4veWAAJj3Y0ZjU9dAyLiSoDP+F5P8AS Fs/pXoopQwU9YyoavT7xj1m8PsQa0X0= X-MC-Unique: werqEzSkN3ikj97KjHdNsA-1 X-MC-Unique: AGBlq5JoPcK5f6bt6BkGtQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Y1E0HPSwLIsii083vrnMFiGq3holRazqLBltKY2n6C0=; b=W10W+9MwSxxZruk3R7G533UGL5UPrjL2qM/b3n/Cxm18sNJi8EW/uH1TU5StKF275b GuFuJirkMt+Ct/toqEdZitlllgE8L2PEvZMjPfouLyCVA49llmNSuGl0FAznMVlBUa/t rkxcom/ABosMlSXxL5xmDbPvP64DCleLVqAZBkd9RreW5qKvSeXDD/VISidxcMhVUoKr dkvg9X00O0ifbYw3QLc0NOEIPISAQihMF1xnpOR+AfM3SMzkhhFZJVBjcWiL+blBJrAI Q8q62a515iSWLROKp7fKw6UfPG7zd78JjdQ2HCIhg8dPJ+Y6Zumc90v6OcQ3+THBwDa/ 7ZUw== X-Gm-Message-State: AOAM533a7q5n31Clp7bEXioe/lDIg4ldiAtFWFVRy6iLmA08Oc55Rpva Y8lpkaV2ZxZVZw3tWHHOLNjLWzNnAAFcP+ib1cT9RFk9qr/qGsG4caJTw4qEdZh5BzNRG+7eT91 YN1WBww41ZI8O4/D6E5C7pB4LyVmMMh6+H1oGJteRX4C7CzBswD0bB8YFwvDurPeYewHP3tU= X-Received: by 2002:a05:6000:251:: with SMTP id m17mr3658354wrz.88.1644936737654; Tue, 15 Feb 2022 06:52:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxb9P7vLM3HDaYW1cC16nhYs5Aav6n0+9PSNFOZ9vpt0wVATDGk3AlCBVVxS/KcOAWywMCew== X-Received: by 2002:a05:6000:251:: with SMTP id m17mr3658341wrz.88.1644936737419; Tue, 15 Feb 2022 06:52:17 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH v2] Make systemd unit ordering more robust Date: Tue, 15 Feb 2022 15:52:16 +0100 Message-Id: <09ddc40b2714a4328917a4ad8c74d3e96fc98205.1644936726.git.mkletzan@redhat.com> MIME-Version: 1.0 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.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1644936764129100001 Content-Type: text/plain; charset="utf-8" Since libvirt-guests script/service can operate on various URIs and we do support both socket activation and traditional services, the ordering shoul= d be specified for all the possible sockets and services. Also remove the Wants=3D dependency since do not want to start any service.= We cannot know which one libvirt-guests is configured, so we'd have to start a= ll the daemons which would break if unused colliding services are not masked (libvirtd.service in the modular case and all the modular daemon ser= vice units in the monolithic scenario). Fortunately we can assume that the syst= em is configured properly to start services/sockets that are of interest to the u= ser. That also works with the setup described in https://libvirt.org/daemons.htm= l . To make it even more robust we add the daemon service into the machine units created for individual domains as it was missing there. https://bugzilla.redhat.com/show_bug.cgi?id=3D1868537 Signed-off-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/util/virsystemd.c | 8 ++++++-- tools/libvirt-guests.service.in | 12 +++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index a86d4c6bb905..f156c2f39ae5 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -441,8 +441,10 @@ int virSystemdCreateMachine(const char *name, nicindexes, nnicindexes, s= izeof(int)); gprops =3D g_variant_new_parsed("[('Slice', <%s>)," " ('After', <['libvirtd.service']>)," + " ('After', <['virt%sd.service']>)," " ('Before', <['virt-guest-shutdown.= target']>)]", - slicename); + slicename, + drivername); message =3D g_variant_new("(s@ayssus@ai@a(sv))", name, guuid, @@ -489,8 +491,10 @@ int virSystemdCreateMachine(const char *name, uuid, 16, sizeof(unsigned char)); gprops =3D g_variant_new_parsed("[('Slice', <%s>)," " ('After', <['libvirtd.service']>)," + " ('After', <['virt%sd.service']>)," " ('Before', <['virt-guest-shutdown.= target']>)]", - slicename); + slicename, + drivername); message =3D g_variant_new("(s@ayssus@a(sv))", name, guuid, diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service= .in index 1a9b233e1177..3cf647619612 100644 --- a/tools/libvirt-guests.service.in +++ b/tools/libvirt-guests.service.in @@ -1,10 +1,20 @@ [Unit] Description=3DSuspend/Resume Running libvirt Guests -Wants=3Dlibvirtd.service Requires=3Dvirt-guest-shutdown.target After=3Dnetwork.target After=3Dtime-sync.target +After=3Dlibvirtd.socket +After=3Dvirtqemud.socket +After=3Dvirtlxcd.socket +After=3Dvirtvboxd.socket +After=3Dvirtvzd.socket +After=3Dvirtxend.socket After=3Dlibvirtd.service +After=3Dvirtqemud.service +After=3Dvirtlxcd.service +After=3Dvirtvboxd.service +After=3Dvirtvzd.service +After=3Dvirtxend.service After=3Dvirt-guest-shutdown.target Documentation=3Dman:libvirt-guests(8) Documentation=3Dhttps://libvirt.org --=20 2.35.1