From nobody Thu Oct 31 23:08:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1644923552; cv=none; d=zohomail.com; s=zohoarc; b=JzrWjEqrNR/Mx9hm1kbMvhFh5kr7zkNWgQctiKZvLiQPOtkCYDvIYWpIF/kK6cq8cMwDSqQf1srbFqFQnjk+Lh5QFAhqRPvvls+dh1oYsKhW0ghhZeiXYps0eOWf7AopcS6hUV6KvoSJUsbZbJlIOdJtbHnd0a78fo2sL6Be9LE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644923552; 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=tBi8h+wL7jLc3MvCboham/0ONb0qunCAxzyKqZyf+Wo=; b=GuU95vpvlg0r8CuzIiwwdYSOeQl46+5M8aHY7BjT3gg+ufAjHBmjwCccPI56AlHlVoHIUt3pXHA2PcOU1JxWoQ35aJOGga36OgSiQhlm3bb74bUlqp4OD022znR1IYXd3U353vbE4Bznf/pPpEueGFAIKXV8O3v51guGEKlc20Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1644923552773848.3850183567916; Tue, 15 Feb 2022 03:12:32 -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-482-a_fV_QaPMNGM4M-ZUEN9WQ-1; Tue, 15 Feb 2022 06:12:29 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 66C6E1006AA3; Tue, 15 Feb 2022 11:12:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D0501086485; Tue, 15 Feb 2022 11:12:23 +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 664DF1809CB9; Tue, 15 Feb 2022 11:12:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21FBCG0V015514 for ; Tue, 15 Feb 2022 06:12:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 167F2401DB6; Tue, 15 Feb 2022 11:12:16 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 129C6401DB0 for ; Tue, 15 Feb 2022 11:12:16 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 E2C34811E81 for ; Tue, 15 Feb 2022 11:12:15 +0000 (UTC) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-330-yQlbd0JXOOqAsldxNTIvuA-1; Tue, 15 Feb 2022 06:12:14 -0500 Received: by mail-wr1-f72.google.com with SMTP id h24-20020adfaa98000000b001e33eb81e71so8214202wrc.9 for ; Tue, 15 Feb 2022 03:12:14 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id l31sm10634532wms.0.2022.02.15.03.12.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 03:12:12 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id EDC8847927A3 for ; Tue, 15 Feb 2022 12:12:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644923551; 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=tBi8h+wL7jLc3MvCboham/0ONb0qunCAxzyKqZyf+Wo=; b=aM6GdwQUA79euYc8/hx2otS9dFTjsMq5JI5YRHkFfJ702IE4mbzIKOKJT54LkRuGxhR9JG XruwvdcGkQMVgMa2yMokFEkLrGArgxnlByS5aYL85tiDeBKinIClMr34VMYt6l3SgO1zlG FF449+LP87RpdmEtWAsnE6LK8wDJndo= X-MC-Unique: a_fV_QaPMNGM4M-ZUEN9WQ-1 X-MC-Unique: yQlbd0JXOOqAsldxNTIvuA-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=tBi8h+wL7jLc3MvCboham/0ONb0qunCAxzyKqZyf+Wo=; b=fZPLTJtp+5Z80GaZHzXza5LV8H28cKvj2rqjzDxBpKiSYOjM68JB7rJwizdYKfdPbG cDFMshyx76PZjwfvigSeXSLLGc+qez1BTqjhxmbQffVh51KO8tiZxkHz7Yx2uB/nFy0v LiwL80kxOKGMd6HzQxAHMSx03DEshlnnrJEJVlM8bXOwsbyUPd94MZwQ0kh6rUfuqxRs w2KR/2zBevDejpXV/y8wO0Cv8RWU96s0vDNk/ymFVKuXMz7jA0pk6fVLE3VVmO1EjFUj FJ3eSFfT+b5VQPE233kj6HpO11oqEA6mjshTQHW0LPVoLrGUSaIwYyHSwJFoVpDqKUq7 5G6Q== X-Gm-Message-State: AOAM532Hyn9xkWnY2JhP+eHa9smyJuVvmAqAzkhOBWPo68g8HspgPtY4 WlKQSf9iMbJXJQcVUa1f8nDC9ixNRm2uqlNrGImqRBhJiIrtm+mdfctCfZiwF6lxTcakS/RSQdB rT54Bcczp7ZZJtJslTm5/fW/gm1WqkWvWOTHkkHyVPHy8eRThK6A/ou7ObXDA34BbQUfwiRY= X-Received: by 2002:a1c:ed09:: with SMTP id l9mr2682862wmh.142.1644923533232; Tue, 15 Feb 2022 03:12:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzV7NTiTmtNYZWBs4kAHssf4wuf9qUFbiqhG5xemdPX4rw5FJ/CT9YDqHi18Y4duDUtw54OsQ== X-Received: by 2002:a1c:ed09:: with SMTP id l9mr2682827wmh.142.1644923532841; Tue, 15 Feb 2022 03:12:12 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH] Make systemd unit ordering more robust Date: Tue, 15 Feb 2022 12:12:11 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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.22 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: 1644923554920100001 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 --- src/util/virsystemd.c | 4 ++++ tools/libvirt-guests.service.in | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index a86d4c6bb905..2d9711ad41b6 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -441,7 +441,9 @@ 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']>)]", + drivername, slicename); message =3D g_variant_new("(s@ayssus@ai@a(sv))", name, @@ -489,7 +491,9 @@ 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']>)]", + drivername, slicename); message =3D g_variant_new("(s@ayssus@a(sv))", name, 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