From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586208476; cv=none; d=zohomail.com; s=zohoarc; b=DANFZAwFZsk0+iNvZRWU+SOhIyAxCkI95UxwcGMrO5VYMBQNgfBdEn+uq2SyhotUlmRbzQW2LWItF0bGoipiWkj/4Sv7c5sCN9nwd3UrtnkuFe8a2V4pOTeegopxyCSPa9C0Xl4SgkGVa/6vS4mTj7Q6DLYRvp+yjcb6L1We1RI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208476; h=Content-Type:Content-Transfer-Encoding:Cc: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=QpNpyl7jwjFR8OgsTB/+bEXl9lONQmDmaoTiLsz59Sw=; b=QjaF268C4PHuLV1LyrFr8NtykfRBtaqXqnDMeZlrLuFk5k264j99Dite/qQmnH/I0M/SCVS03YZeUDbB6zRSjbCAqBXz3m8Q0jG8jdwouGOlkLal8m8hR9lFyfRj8FKMT5M4Zoc1Qpfb0FYUTTyyWrWTMMseZIrvR5J+9vNQg/A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586208476431557.1567329186446; Mon, 6 Apr 2020 14:27:56 -0700 (PDT) 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-181-heaP830rPPWL2VZQJ4TFHA-1; Mon, 06 Apr 2020 17:27:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFFEF149C3; Mon, 6 Apr 2020 21:27:44 +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 97BCD60C18; Mon, 6 Apr 2020 21:27:44 +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 2879E18089CD; Mon, 6 Apr 2020 21:27:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LRRN4015647 for ; Mon, 6 Apr 2020 17:27:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 639565C3F8; Mon, 6 Apr 2020 21:27:27 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 362325C28F; Mon, 6 Apr 2020 21:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208474; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=QpNpyl7jwjFR8OgsTB/+bEXl9lONQmDmaoTiLsz59Sw=; b=BCMW376A/qpNlY904hbZ7lqEYHRzJ0Uo0WuEzM31oz2S5a4IcimZHNtF8hx70kPsrrhYsw C7LLKMhHMRidUYWo3k0oejInjfKAElLbDAMEfwXuE+vXl/Kn6w8RER3hc5XarfQYddl7x/ Cr2xWYPy7PgezDpvbnKTeqmKH+H4l+g= X-MC-Unique: heaP830rPPWL2VZQJ4TFHA-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 01/15] slirp: leave the dbus daemon running on error Date: Mon, 6 Apr 2020 23:26:58 +0200 Message-Id: <20200406212712.1315604-2-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Don't stop the DBus daemon if a slirp helper failed to start, as it may be shared with other helpers. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_slirp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_slirp.c b/src/qemu/qemu_slirp.c index 09c1247892..49bffa01b8 100644 --- a/src/qemu/qemu_slirp.c +++ b/src/qemu/qemu_slirp.c @@ -355,6 +355,6 @@ qemuSlirpStart(qemuSlirpPtr slirp, virProcessKillPainfully(pid, true); if (pidfile) unlink(pidfile); - qemuDBusStop(driver, vm); + /* leave dbus daemon running, it may be used by others */ return -1; } --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586208467; cv=none; d=zohomail.com; s=zohoarc; b=LFCBYA0G/0EZGb4rvxix96nmD6hUDv5CPBYGFnJuBC0jHQNbFyAZntvTGolbsInS5gKDQ+sUufoZkuRhOoZO+hl62kIxBVWl5HoyV4qhNiRLBvfUQvo+8NkV2BMIr0RNVz2itRc4+dQd+bjAd6zBR2BNcmd+qCTp2gQVniHh8Ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208467; h=Content-Type:Content-Transfer-Encoding:Cc: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=iUIo4soUH4hm9g5O5w7F83kgsoZlMGD4+CaFRQhNm6A=; b=ASJ4/m9Whtdh8p5hSoFsznsYuwABQJsixqLgWDpGI5zs17wmNThsS2yZZ0ha1+Fu5m6fK83D53BHlAKhEAmBf5ZoeYz4OiapNtMNjDgUKKjiMJXr/wz+U7fMkbm0yy0I85xiXpA67FFXRtD/lGSaXhTfYfqMdACMQ+ZB3JuAG/E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586208467065828.235712016784; Mon, 6 Apr 2020 14:27:47 -0700 (PDT) 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-384--7LPsGXXN-ipPGyTGpTU3A-1; Mon, 06 Apr 2020 17:27:43 -0400 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 930CC100550D; Mon, 6 Apr 2020 21:27:37 +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 606DD1001B3F; Mon, 6 Apr 2020 21:27:37 +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 B532093A6D; Mon, 6 Apr 2020 21:27:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LRYIx015667 for ; Mon, 6 Apr 2020 17:27:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id D965B5DA7B; Mon, 6 Apr 2020 21:27:34 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3E365DC18; Mon, 6 Apr 2020 21:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208465; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=iUIo4soUH4hm9g5O5w7F83kgsoZlMGD4+CaFRQhNm6A=; b=jNjbGOrd74Hws/RSDtc2CBY0dwv5obfCEp4ZMMB1uoZKifPzC+v/ue7hFBhLyCgAakUjQz sRGX3vr6sROHFeE2B9zKHJRsve1UFg3LidkxURBCM5uLJI87Sj+2KHKaMIiTQkXRUWEH5h 1SKSTw6L6fV2dKpDChTUINnbJdC1I74= X-MC-Unique: -7LPsGXXN-ipPGyTGpTU3A-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 02/15] slirp: add helper to VM cgroup Date: Mon, 6 Apr 2020 23:26:59 +0200 Message-Id: <20200406212712.1315604-3-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau The slirp helper process should be associated with the VM cgroup, like other helpers. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_extdevice.c | 8 ++++++++ src/qemu/qemu_slirp.c | 14 ++++++++++++++ src/qemu/qemu_slirp.h | 3 +++ 3 files changed, 25 insertions(+) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 5a31b4d66e..dae3524307 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -284,6 +284,14 @@ qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver, return -1; } =20 + for (i =3D 0; i < def->nnets; i++) { + virDomainNetDefPtr net =3D def->nets[i]; + qemuSlirpPtr slirp =3D QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp; + + if (slirp && qemuSlirpSetupCgroup(slirp, cgroup) < 0) + return -1; + } + if (def->tpm && qemuExtTPMSetupCgroup(driver, def, cgroup) < 0) return -1; diff --git a/src/qemu/qemu_slirp.c b/src/qemu/qemu_slirp.c index 49bffa01b8..71dbded607 100644 --- a/src/qemu/qemu_slirp.c +++ b/src/qemu/qemu_slirp.c @@ -242,6 +242,14 @@ qemuSlirpStop(qemuSlirpPtr slirp, } =20 =20 +int +qemuSlirpSetupCgroup(qemuSlirpPtr slirp, + virCgroupPtr cgroup) +{ + return virCgroupAddProcess(cgroup, slirp->pid); +} + + int qemuSlirpStart(qemuSlirpPtr slirp, virDomainObjPtr vm, @@ -249,6 +257,7 @@ qemuSlirpStart(qemuSlirpPtr slirp, virDomainNetDefPtr net, bool incoming) { + qemuDomainObjPrivatePtr priv =3D vm->privateData; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autoptr(virCommand) cmd =3D NULL; g_autofree char *pidfile =3D NULL; @@ -348,6 +357,10 @@ qemuSlirpStart(qemuSlirpPtr slirp, } =20 slirp->pid =3D pid; + + if (priv->cgroup && qemuSlirpSetupCgroup(slirp, priv->cgroup) < 0) + goto error; + return 0; =20 error: @@ -355,6 +368,7 @@ qemuSlirpStart(qemuSlirpPtr slirp, virProcessKillPainfully(pid, true); if (pidfile) unlink(pidfile); + slirp->pid =3D 0; /* leave dbus daemon running, it may be used by others */ return -1; } diff --git a/src/qemu/qemu_slirp.h b/src/qemu/qemu_slirp.h index 5bf9596053..e1db908814 100644 --- a/src/qemu/qemu_slirp.h +++ b/src/qemu/qemu_slirp.h @@ -75,4 +75,7 @@ void qemuSlirpStop(qemuSlirpPtr slirp, =20 int qemuSlirpGetFD(qemuSlirpPtr slirp); =20 +int qemuSlirpSetupCgroup(qemuSlirpPtr slirp, + virCgroupPtr cgroup); + G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuSlirp, qemuSlirpFree); --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586208477; cv=none; d=zohomail.com; s=zohoarc; b=fdoyS33zkUtyC/X4Nryt+JLFQway2H+DnltUfKuzgPvqMdu8kVXZcQm2igGXxtHkNBDcPFo1UJ+XSPEMh+dRjFXTNPQ8O01v/QIxWctvgin5QZ1dAAjz+0s+hU9pGJ+ojf0/sYAovg2HY8c95TeLTP6XZyHvkG/Ggz+DiDSi6Pg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208477; h=Content-Type:Content-Transfer-Encoding:Cc: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=11u+m3g1VyDceys1sL8Ehz9tGvg2fAUk9CPjYU2XzEs=; b=j2Q+dG5wvWEgDU4W1CiJ17850RY9rpUxDNUm19EtlEaLU1+HFZbSig6fYaelTprZdHSLQy0bKj3eyjETNz7gmoU5SMo8OitdUKiR7jbtbm7Wh1c7azu+Vn8o2VNd0uubHcB201TcHiQU3ycr/zb2Ar56fuWtDRXjduoqu8HRNI4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586208477459478.76005452100924; Mon, 6 Apr 2020 14:27:57 -0700 (PDT) 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-176-VHBm1U3kPUGNQR55CFStkw-1; Mon, 06 Apr 2020 17:27:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1684F100DFC2; Mon, 6 Apr 2020 21:27:46 +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 E028060BF7; Mon, 6 Apr 2020 21:27:45 +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 98C4D18089D7; Mon, 6 Apr 2020 21:27:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LRbtl015679 for ; Mon, 6 Apr 2020 17:27:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 11CE45C541; Mon, 6 Apr 2020 21:27:37 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DE965C28F; Mon, 6 Apr 2020 21:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208476; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=11u+m3g1VyDceys1sL8Ehz9tGvg2fAUk9CPjYU2XzEs=; b=EPCcQ7n1op9cCCAGVvv+WEivLZjej+yrqxDsZ6VjaPFs8Easm2x4tQhKVNilDp9bE66Cr4 c1ZQkQyZfz4Bjuxu1WE+sozXZfxYooweJFj80G72tMNsHsVuLHILqfqaOrDKVVKmkDzKNU PCuOz5ej0lcd+/uXrIYKpfHKeBFOD04= X-MC-Unique: VHBm1U3kPUGNQR55CFStkw-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 03/15] qemu-dbus: prevent double start of the bus daemon Date: Mon, 6 Apr 2020 23:27:00 +0200 Message-Id: <20200406212712.1315604-4-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Allow calling qemuDBusStart() multiple times (as may be done by qemu-slirp already). Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_dbus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_dbus.c b/src/qemu/qemu_dbus.c index f3e6f3ee37..ae55bbb299 100644 --- a/src/qemu/qemu_dbus.c +++ b/src/qemu/qemu_dbus.c @@ -177,6 +177,9 @@ qemuDBusStart(virQEMUDriverPtr driver, pid_t cpid =3D -1; int ret =3D -1; =20 + if (priv->dbusDaemonRunning) + return 0; + if (!virFileIsExecutable(cfg->dbusDaemonName)) { virReportSystemError(errno, _("'%s' is not a suitable dbus-daemon"), --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1586208471; cv=none; d=zohomail.com; s=zohoarc; b=CEbqbOlQTdvOWzmmU47TLxqdLuEz0cE/9ENxHvQJ13dO8qyR5La7APqDTIe4ictU9G8LV0j0PGNKt7cDWNttCq428dxkqbsJOqOEkkvfSxq/87SjWg70te5L4H2YOs4P79Uaho8YdCsg/ewI64Lke2DFtsEz7xTeoGJOkvi6ijw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208471; h=Content-Type:Content-Transfer-Encoding:Cc: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=DQOJCsF7HpvoH7DloPWAgljhggXieEcR3hVkotzoxn4=; b=l/cJDPLMDIFx2vHU9VKCtXCGShdY9Bn399BJwzqmTFzuvRo+/KHAS34JnKlCZaBCGUwaaBYHObKvW8oeMgiAEIIiEq2JwEPd50g5phL2C08SkLKNsaeRy2SQiu56S9O1eb9IMeUr3pNiyR0E7w/ODtENcHUUUmZ167nFTXbtay4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1586208471544132.11964997024847; Mon, 6 Apr 2020 14:27:51 -0700 (PDT) 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-3-EmiZZLeaO56lWpPL3ka3sQ-1; Mon, 06 Apr 2020 17:27:47 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 654F38017F6; Mon, 6 Apr 2020 21:27:41 +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 13B0D5DA60; Mon, 6 Apr 2020 21:27: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 B3EBF18089CD; Mon, 6 Apr 2020 21:27:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LRdTb015690 for ; Mon, 6 Apr 2020 17:27:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E3BB5DA83; Mon, 6 Apr 2020 21:27:39 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 925365DA60; Mon, 6 Apr 2020 21:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208470; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=DQOJCsF7HpvoH7DloPWAgljhggXieEcR3hVkotzoxn4=; b=DtHXAmlVZAT6x3g63VxT5WlXjjtG7CzBMtkoQMq2TqOcDMb1ciesF8N3IFKyrmhgWuJ4E9 M99Au6j3mcKXCB/9er6pg02UC1WvlceKmZ+9wEbB1nXPXBKqpPhsCnDqRW+Y6wIIIRLq3r 7M48+30QLWpJn0kBofsbL+qrBuY0VFE= X-MC-Unique: EmiZZLeaO56lWpPL3ka3sQ-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 04/15] qemu-dbus: remove unused variable Date: Mon, 6 Apr 2020 23:27:01 +0200 Message-Id: <20200406212712.1315604-5-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_dbus.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/qemu/qemu_dbus.c b/src/qemu/qemu_dbus.c index ae55bbb299..02dc3ebf07 100644 --- a/src/qemu/qemu_dbus.c +++ b/src/qemu/qemu_dbus.c @@ -142,13 +142,11 @@ qemuDBusStop(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv =3D vm->privateData; g_autofree char *shortName =3D NULL; g_autofree char *pidfile =3D NULL; - g_autofree char *configfile =3D NULL; =20 if (!(shortName =3D virDomainDefGetShortName(vm->def))) return; =20 pidfile =3D qemuDBusCreatePidFilename(cfg, shortName); - configfile =3D qemuDBusCreateConfPath(cfg, shortName); =20 if (virPidFileForceCleanupPath(pidfile) < 0) { VIR_WARN("Unable to kill dbus-daemon process"); --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1586208478; cv=none; d=zohomail.com; s=zohoarc; b=GYsJQ7TPt2m0AvqnT9nOol/F149vqzWgDZhW24GNjtEKjjmWXgUR3SKpZSQiU0tHLOJ8EJt6g6wGYCpwZJbF0qdIDBl6v+zySfPUgr94etyjZ5O1y93mTh3TV9XPE8jJP3yQ2/eX38Ln3kuWyqopnLA39pYgPKkN4e0gSfHP254= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208478; h=Content-Type:Content-Transfer-Encoding:Cc: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=foLA62Q2f1C4ZhuYhAsWxU39gtuxMnob+SykXHEsV2Y=; b=ahAYV5d4zOILlZLHRi9svcPY0GvWwK/MRKWow8OWGA93BgjBy9865IcesNf/3BouCPrcmbT32kN/zQKhmfZMjzGrtNgEfFuKQXkJnT0vkmNWcg4M0E4sDEkgX0gtdvy1ybczNnGrwPdFVo7IqtIqaZyYIXPWLSe3Cc4DjnljxEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1586208478348772.6082322035703; Mon, 6 Apr 2020 14:27:58 -0700 (PDT) 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-323-A9qBCmoLPoWZM34rAzJfwQ-1; Mon, 06 Apr 2020 17:27:54 -0400 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 321D8190A7A0; Mon, 6 Apr 2020 21:27:49 +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 0199E19756; Mon, 6 Apr 2020 21:27:49 +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 A1E5393A73; Mon, 6 Apr 2020 21:27:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LRlXR015709 for ; Mon, 6 Apr 2020 17:27:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2CA7EA0A6F; Mon, 6 Apr 2020 21:27:47 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE1BB118F39; Mon, 6 Apr 2020 21:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208477; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=foLA62Q2f1C4ZhuYhAsWxU39gtuxMnob+SykXHEsV2Y=; b=ViR9LcB/R39PPILzwU8TXkz9JZcxIQjrgNp+2QsHYPgTvj15DHaPNuRSsH3pX+hMOumaO6 aJKUxHzWgAYZDoWtuTR1o6MOWI9z4Y+uT587imfheAfrVlph4YHHUNR00qLnPMvD/Lvtw3 lEkD1p0/SQHfbBv1XRdYkN3aKgnULEY= X-MC-Unique: A9qBCmoLPoWZM34rAzJfwQ-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 05/15] qemu-dbus: register DBus bus to the VM cgroup Date: Mon, 6 Apr 2020 23:27:02 +0200 Message-Id: <20200406212712.1315604-6-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau External devices are started before cgroup is created. Add the DBus daemon to the VM cgroup with the rest of the external devices. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_dbus.c | 24 ++++++++++++++++++++++++ src/qemu/qemu_dbus.h | 3 +++ src/qemu/qemu_extdevice.c | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/src/qemu/qemu_dbus.c b/src/qemu/qemu_dbus.c index 02dc3ebf07..53f6c45986 100644 --- a/src/qemu/qemu_dbus.c +++ b/src/qemu/qemu_dbus.c @@ -156,6 +156,30 @@ qemuDBusStop(virQEMUDriverPtr driver, } =20 =20 +int +qemuDBusSetupCgroup(virQEMUDriverPtr driver, + virDomainObjPtr vm) +{ + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + qemuDomainObjPrivatePtr priv =3D vm->privateData; + g_autofree char *shortName =3D NULL; + g_autofree char *pidfile =3D NULL; + pid_t cpid =3D -1; + + if (!priv->dbusDaemonRunning) + return 0; + + if (!(shortName =3D virDomainDefGetShortName(vm->def))) + return -1; + pidfile =3D qemuDBusCreatePidFilename(cfg, shortName); + if (virPidFileReadPath(pidfile, &cpid) < 0) { + VIR_WARN("Unable to get DBus PID"); + return -1; + } + + return virCgroupAddProcess(priv->cgroup, cpid); +} + int qemuDBusStart(virQEMUDriverPtr driver, virDomainObjPtr vm) diff --git a/src/qemu/qemu_dbus.h b/src/qemu/qemu_dbus.h index a96f19ac0d..474eb1058b 100644 --- a/src/qemu/qemu_dbus.h +++ b/src/qemu/qemu_dbus.h @@ -35,3 +35,6 @@ void qemuDBusStop(virQEMUDriverPtr driver, int qemuDBusVMStateAdd(virDomainObjPtr vm, const char *id); =20 void qemuDBusVMStateRemove(virDomainObjPtr vm, const char *id); + +int qemuDBusSetupCgroup(virQEMUDriverPtr driver, + virDomainObjPtr vm); diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index dae3524307..2096272761 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -23,6 +23,7 @@ #include "qemu_command.h" #include "qemu_extdevice.h" #include "qemu_vhost_user_gpu.h" +#include "qemu_dbus.h" #include "qemu_domain.h" #include "qemu_tpm.h" #include "qemu_slirp.h" @@ -276,6 +277,9 @@ qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver, virDomainDefPtr def =3D vm->def; size_t i; =20 + if (qemuDBusSetupCgroup(driver, vm) < 0) + return -1; + for (i =3D 0; i < def->nvideos; i++) { virDomainVideoDefPtr video =3D def->videos[i]; =20 --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1586208480; cv=none; d=zohomail.com; s=zohoarc; b=lJMgjehNl5VCtOSAn/5vk/wD4hCDNvJ5jKiZhBDFTBUjC0l8smW/zVqUWnWAUXjiy0OGDesQ1cKl2eTx3lZo8YY4N6B4vlfoSZ5DENJ80pV5DqdtJxyBckdhwC1cgfMwBPRxvkOPtnVwPVCeUqC9uGm5jI+bn2VZneSPcViSlRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208480; h=Content-Type:Content-Transfer-Encoding:Cc: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=+JdKoOrE618YJWPH81sbqyo9iJbS4pJ8MZuX4hTmACY=; b=hnMjEvcLVtnYla55KFOVMlg/sqJ+yqqPimB+7Kh36qDdd6NNaw4y7P7br2TlL7jzJaBeuCVDBPB+Vl5dnUhY3k88SIYG+F9TNpUZlA7kd24/aUfH/iSZQxJh45WFYI4qhaqvGD0ap464Aql6FqW724777G4Q9o36jc8lGNkSHXU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1586208480666511.7146621153032; Mon, 6 Apr 2020 14:28:00 -0700 (PDT) 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-293-qNJLVgaMO6-rTP5xgfIPUw-1; Mon, 06 Apr 2020 17:27:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D37D9149C4; Mon, 6 Apr 2020 21:27:50 +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 A6594A0A6F; Mon, 6 Apr 2020 21:27:50 +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 5EEFE18089CF; Mon, 6 Apr 2020 21:27:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LRniG015722 for ; Mon, 6 Apr 2020 17:27:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3DF7F118F50; Mon, 6 Apr 2020 21:27:49 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAA9CCDBCA; Mon, 6 Apr 2020 21:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208479; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=+JdKoOrE618YJWPH81sbqyo9iJbS4pJ8MZuX4hTmACY=; b=jEHUd8JX+Z7C12xm7ZjYJ7ONxAOlPX+7W3mRrzcfCE9f8T8peh/7l+0m3YGxhD8hJ/grGZ Mku4H9q/fT1C6synWg66iSjSGZ6UW8hdmAc8+eRmg00TsAlh5D71bRke7YUJ5hTFdC99ku e2fdhoghxBsm7qEd5GQd8SD39JXaHVQ= X-MC-Unique: qNJLVgaMO6-rTP5xgfIPUw-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 06/15] qemu-cgroup: remove unnecessary include Date: Mon, 6 Apr 2020 23:27:03 +0200 Message-Id: <20200406212712.1315604-7-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau The file doesn't use virSystemd functions directly. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_cgroup.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 23e52fa218..cec0a03889 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -36,7 +36,6 @@ #include "virfile.h" #include "virtypedparam.h" #include "virnuma.h" -#include "virsystemd.h" #include "virdevmapper.h" #include "virutil.h" =20 --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1586208488; cv=none; d=zohomail.com; s=zohoarc; b=d+RL4uFjWo3a8/MrN8gqU5YShPrcV8cpcpFTI8HxD/5SuTv0NoD6OYhgyOTL8ZEKC0xK4kaONTfsr1w+huf0FqA9xN0mfOJsHTBX52iXvs6y8n9SaRCArohrKR4Z1NK40g3HQSUoak2DyuCxGgbsgNJwGjeFp44oWjmc1JZjro0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208488; h=Content-Type:Content-Transfer-Encoding:Cc: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=6ch4/4wW8DCADmMuD/ywjtaeWb3fFbuQbKCAxu5+XME=; b=LzG0b78ZaC3kP538B9hcvDjNkikQIyAM1EDR418DLO/9lE5nUYDGXTmHYknC6loO+yNvuD3dS163Sv1+Kvm++L3Ud58t+Bw7HNukkqbx+pM8yO9yBY0+8UFb79aubdNokdiVwqbfu1vYynlwn0mqYneC89G9OHJVlOEaruMK3SU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 158620848821227.091896779742342; Mon, 6 Apr 2020 14:28:08 -0700 (PDT) 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-57-sju6xjocOLuPDZwFZgaypA-1; Mon, 06 Apr 2020 17:28:03 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0094D149C1; Mon, 6 Apr 2020 21:27:58 +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 CEAD75DA81; Mon, 6 Apr 2020 21:27:57 +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 8436593A70; Mon, 6 Apr 2020 21:27:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LRuPh015750 for ; Mon, 6 Apr 2020 17:27:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id D0B1D5DA81; Mon, 6 Apr 2020 21:27:56 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90D4D5DA82; Mon, 6 Apr 2020 21:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208487; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=6ch4/4wW8DCADmMuD/ywjtaeWb3fFbuQbKCAxu5+XME=; b=Ea8BO7tGzLvE+goreVOlVN11W+9MplCJfWtGrORP4whL1e5VleAnnPWikBmZopJIdJipsm BtYzyKScZCGxVjVWWWrcGq+I2n2RO0Ya4BbhTGJ5u92sbbhqR4DbKpFyZ9u/WZOBKmyz8D CDrIG4X7uUySlvqtM1kKwfC9Xf4Kv+w= X-MC-Unique: sju6xjocOLuPDZwFZgaypA-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 07/15] dbus: rename virDBusIs* -> virDBusSystemIs* Date: Mon, 6 Apr 2020 23:27:04 +0200 Message-Id: <20200406212712.1315604-8-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Those functions talk to system bus and have a special handling of system bus missing. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/util/virdbus.c | 12 ++++++------ src/util/virdbus.h | 4 ++-- src/util/virfirewalld.c | 2 +- src/util/virsystemd.c | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/util/virdbus.c b/src/util/virdbus.c index 77691cd2b0..858291e2ba 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -1700,12 +1700,12 @@ static int virDBusIsServiceInList(const char *listM= ethod, const char *name) } =20 /** - * virDBusIsServiceEnabled: + * virDBusSystemIsServiceEnabled: * @name: service name * * Returns 0 if service is available, -1 on fatal error, or -2 if service = is not available */ -int virDBusIsServiceEnabled(const char *name) +int virDBusSystemIsServiceEnabled(const char *name) { int ret =3D virDBusIsServiceInList("ListActivatableNames", name); =20 @@ -1715,12 +1715,12 @@ int virDBusIsServiceEnabled(const char *name) } =20 /** - * virDBusIsServiceRegistered + * virDBusSystemIsServiceRegistered * @name: service name * * Returns 0 if service is registered, -1 on fatal error, or -2 if service= is not registered */ -int virDBusIsServiceRegistered(const char *name) +int virDBusSystemIsServiceRegistered(const char *name) { int ret =3D virDBusIsServiceInList("ListNames", name); =20 @@ -1843,13 +1843,13 @@ int virDBusMessageDecode(DBusMessage* msg G_GNUC_UN= USED, return -1; } =20 -int virDBusIsServiceEnabled(const char *name G_GNUC_UNUSED) +int virDBusSystemIsServiceEnabled(const char *name G_GNUC_UNUSED) { VIR_DEBUG("DBus support not compiled into this binary"); return -2; } =20 -int virDBusIsServiceRegistered(const char *name G_GNUC_UNUSED) +int virDBusSystemIsServiceRegistered(const char *name G_GNUC_UNUSED) { VIR_DEBUG("DBus support not compiled into this binary"); return -2; diff --git a/src/util/virdbus.h b/src/util/virdbus.h index 083c074d59..b3b0260a4e 100644 --- a/src/util/virdbus.h +++ b/src/util/virdbus.h @@ -70,7 +70,7 @@ int virDBusMessageDecode(DBusMessage *msg, const char *types, ...); void virDBusMessageUnref(DBusMessage *msg); =20 -int virDBusIsServiceEnabled(const char *name); -int virDBusIsServiceRegistered(const char *name); +int virDBusSystemIsServiceEnabled(const char *name); +int virDBusSystemIsServiceRegistered(const char *name); =20 bool virDBusErrorIsUnknownMethod(virErrorPtr err); diff --git a/src/util/virfirewalld.c b/src/util/virfirewalld.c index c14a6b6e65..499f925b7e 100644 --- a/src/util/virfirewalld.c +++ b/src/util/virfirewalld.c @@ -66,7 +66,7 @@ VIR_ENUM_IMPL(virFirewallDBackend, int virFirewallDIsRegistered(void) { - return virDBusIsServiceRegistered(VIR_FIREWALL_FIREWALLD_SERVICE); + return virDBusSystemIsServiceRegistered(VIR_FIREWALL_FIREWALLD_SERVICE= ); } =20 /** diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 1d41ed34f7..9a659dad84 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -157,13 +157,13 @@ virSystemdHasMachined(void) if (val !=3D -1) return val; =20 - if ((ret =3D virDBusIsServiceEnabled("org.freedesktop.machine1")) < 0)= { + if ((ret =3D virDBusSystemIsServiceEnabled("org.freedesktop.machine1")= ) < 0) { if (ret =3D=3D -2) g_atomic_int_set(&virSystemdHasMachinedCachedValue, -2); return ret; } =20 - if ((ret =3D virDBusIsServiceRegistered("org.freedesktop.systemd1")) = =3D=3D -1) + if ((ret =3D virDBusSystemIsServiceRegistered("org.freedesktop.systemd= 1")) =3D=3D -1) return ret; g_atomic_int_set(&virSystemdHasMachinedCachedValue, ret); return ret; @@ -179,14 +179,14 @@ virSystemdHasLogind(void) if (val !=3D -1) return val; =20 - ret =3D virDBusIsServiceEnabled("org.freedesktop.login1"); + ret =3D virDBusSystemIsServiceEnabled("org.freedesktop.login1"); if (ret < 0) { if (ret =3D=3D -2) g_atomic_int_set(&virSystemdHasLogindCachedValue, -2); return ret; } =20 - if ((ret =3D virDBusIsServiceRegistered("org.freedesktop.login1")) =3D= =3D -1) + if ((ret =3D virDBusSystemIsServiceRegistered("org.freedesktop.login1"= )) =3D=3D -1) return ret; =20 g_atomic_int_set(&virSystemdHasLogindCachedValue, ret); --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586208499; cv=none; d=zohomail.com; s=zohoarc; b=QuEUXUYYuOwvedRxCsf8koDuMYIJtlY/ywYKau9jl5sWV3V5XP0smupvKWMJgaibp9h1P01kZnzxhJmd0JlEsdVYbzM+OMGNaQC7H67YvOLMsq1wJdEn2U/oRslhBMwM88CnWjpsFDNVvgg86cI3vBYi9G1w7Ea452PIx7pGr9w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208499; h=Content-Type:Content-Transfer-Encoding:Cc: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=D0oT0n5bEeK6Y0MwnzgHszf7Frf3e5CuTlKHlzoR1Fc=; b=NDx5TtIo5jJyuU35BFIxdsTzfFY37pzoAaqDERnMWwsCguYVxjNCTsfsidaUg9LruJfwq/Y4RZpHOzov9XWeOHRfsxVPj6wAkGDAR8AAtmlBxbUg94xYoceNlkUdUZgLkzMcsDc9eQGdTrLmFAhkxK8q7jIlkePZPbMM6xzsxQY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586208499074983.1557570372474; Mon, 6 Apr 2020 14:28:19 -0700 (PDT) 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-7-MYeAX3e1MjSWJqzaVMiLhA-1; Mon, 06 Apr 2020 17:28:15 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1D96149CE; Mon, 6 Apr 2020 21:28:09 +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 919B960C18; Mon, 6 Apr 2020 21:28:09 +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 3A3BE93A71; Mon, 6 Apr 2020 21:28:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LS7bj015784 for ; Mon, 6 Apr 2020 17:28:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 64EFA60C80; Mon, 6 Apr 2020 21:28:07 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9060A60BF7; Mon, 6 Apr 2020 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208497; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=D0oT0n5bEeK6Y0MwnzgHszf7Frf3e5CuTlKHlzoR1Fc=; b=KNkH6+sGwq670IZXioRvXxAZQRWVpV3Yds8y+qPC1Z1wUt70JSeCHjBWdGFPvcvRa7I4G1 pkmeoTZee8ZPsn3XmkDf1bDJ01hH6ee59w/X7QgF8MRuBaRmxWwMxSGKPBpVqjjv9kyEAV a6IvCtYVILsN668z9QARiwaxMjvABe8= X-MC-Unique: MYeAX3e1MjSWJqzaVMiLhA-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 08/15] dbus: add virDBusIsService{Enabled, Registered} with @conn argument Date: Mon, 6 Apr 2020 23:27:05 +0200 Message-Id: <20200406212712.1315604-9-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Learn to check presence of services on a given connection. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/util/virdbus.c | 65 +++++++++++++++++++++++++++++++++++----------- src/util/virdbus.h | 3 +++ 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/src/util/virdbus.c b/src/util/virdbus.c index 858291e2ba..03ed8fd87a 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -1650,19 +1650,14 @@ int virDBusCallMethod(DBusConnection *conn, } =20 =20 -static int virDBusIsServiceInList(const char *listMethod, const char *name) +static int virDBusIsServiceInList(DBusConnection *conn, + const char *listMethod, + const char *name) { - DBusConnection *conn; DBusMessage *reply =3D NULL; DBusMessageIter iter, sub; int ret =3D -1; =20 - if (!virDBusHasSystemBus()) - return -2; - - if (!(conn =3D virDBusGetSystemBus())) - return -1; - if (virDBusCallMethod(conn, &reply, NULL, @@ -1699,6 +1694,38 @@ static int virDBusIsServiceInList(const char *listMe= thod, const char *name) return ret; } =20 +/** + * virDBusIsServiceEnabled: + * @conn: a DBus connection + * @name: a service name + * + * Returns 0 if service is available, -1 on fatal error, or -2 if service = is not available + */ +int virDBusIsServiceEnabled(DBusConnection *conn, const char *name) +{ + int ret =3D virDBusIsServiceInList(conn, "ListActivatableNames", name); + + VIR_DEBUG("Service %s is %s", name, ret ? "unavailable" : "available"); + + return ret; +} + +/** + * virDBusIsServiceRegistered: + * @conn: a DBus connection + * @name: a service name + * + * Returns 0 if service is registered, -1 on fatal error, or -2 if service= is not available + */ +int virDBusIsServiceRegistered(DBusConnection *conn, const char *name) +{ + int ret =3D virDBusIsServiceInList(conn, "ListNames", name); + + VIR_DEBUG("Service %s is %s", name, ret ? "not registered" : "register= ed"); + + return ret; +} + /** * virDBusSystemIsServiceEnabled: * @name: service name @@ -1707,26 +1734,34 @@ static int virDBusIsServiceInList(const char *listM= ethod, const char *name) */ int virDBusSystemIsServiceEnabled(const char *name) { - int ret =3D virDBusIsServiceInList("ListActivatableNames", name); + DBusConnection *conn; =20 - VIR_DEBUG("Service %s is %s", name, ret ? "unavailable" : "available"); + if (!virDBusHasSystemBus()) + return -2; =20 - return ret; + if (!(conn =3D virDBusGetSystemBus())) + return -1; + + return virDBusIsServiceEnabled(conn, name); } =20 /** - * virDBusSystemIsServiceRegistered + * virDBusSystemIsServiceRegistered: * @name: service name * * Returns 0 if service is registered, -1 on fatal error, or -2 if service= is not registered */ int virDBusSystemIsServiceRegistered(const char *name) { - int ret =3D virDBusIsServiceInList("ListNames", name); + DBusConnection *conn; =20 - VIR_DEBUG("Service %s is %s", name, ret ? "not registered" : "register= ed"); + if (!virDBusHasSystemBus()) + return -2; =20 - return ret; + if (!(conn =3D virDBusGetSystemBus())) + return -1; + + return virDBusIsServiceRegistered(conn, name); } =20 void virDBusMessageUnref(DBusMessage *msg) diff --git a/src/util/virdbus.h b/src/util/virdbus.h index b3b0260a4e..2b2d273b1b 100644 --- a/src/util/virdbus.h +++ b/src/util/virdbus.h @@ -70,6 +70,9 @@ int virDBusMessageDecode(DBusMessage *msg, const char *types, ...); void virDBusMessageUnref(DBusMessage *msg); =20 +int virDBusIsServiceEnabled(DBusConnection *conn, const char *name); +int virDBusIsServiceRegistered(DBusConnection *conn, const char *name); + int virDBusSystemIsServiceEnabled(const char *name); int virDBusSystemIsServiceRegistered(const char *name); =20 --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1586208508; cv=none; d=zohomail.com; s=zohoarc; b=CQjSHT0FyL7WMSi5/gn8zKmzCsoXOEVF+E9tQalQtc89s0czVJGbL3pHxejueo/vdlnGqgdXShSzMQG3o9GgQ+fsJWhS3rCrXdOX0PZEuJKrZasFdXyC1c8jpl1TJwzyNitMTpqptEmd2pjCa8wf0XWUMnaerorAsU6MPRdgyic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208508; h=Content-Type:Content-Transfer-Encoding:Cc: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=ifmBDePo6CRQEH8xeA6Qk5cQpUvsn0SHZia40yXwpVk=; b=Zdk+cf8+9vvz9AcYTG2/w6WC2F+pVVGwWqCi2oQ7UApd3RQwStagT+azmUt3UBCq8+uywWZYwYAoVnbw5TmIZg5a86ejLo7V2qzIwAtJC+g22lwm/PjbLXr6+RwznDbr8YZxH/ofpQPANT1vkQ+iHmmC4vq46ZKC3yCtd/Xgpqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1586208508199761.2537591107283; Mon, 6 Apr 2020 14:28:28 -0700 (PDT) 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-363-J4X91-nEPBqZska-yZZ1KQ-1; Mon, 06 Apr 2020 17:28:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 98FD4149C2; Mon, 6 Apr 2020 21:28:18 +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 62F829D379; Mon, 6 Apr 2020 21:28:18 +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 1009B18089D5; Mon, 6 Apr 2020 21:28:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LSGe6015807 for ; Mon, 6 Apr 2020 17:28:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 91CFE10372C4; Mon, 6 Apr 2020 21:28:16 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01BF71036B47; Mon, 6 Apr 2020 21:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208507; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=ifmBDePo6CRQEH8xeA6Qk5cQpUvsn0SHZia40yXwpVk=; b=TKIQSr1uKQ0xXGFj1CWEiz7srXRfyTF6AHopeIPgYulnBmC2bRN+eqk7wO0HFbtifCEkK2 6mDKDSo8Wcmnn3hM+F6DIpOhDn8mJ8Ae06PEcntRk3REs6WkHlFwR6OQIHb/u9/L2COiAB sZrna7SXsnPi3zMFm9YfWSvh4lM+Yj4= X-MC-Unique: J4X91-nEPBqZska-yZZ1KQ-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 09/15] systemd: check org.freedesktop.machine1 registration Date: Mon, 6 Apr 2020 23:27:06 +0200 Message-Id: <20200406212712.1315604-10-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Since commit f10bd740e178c89f24d0b0298d0b5413537d0699 ("Cache the presence of machine1 service"), the code checks for systemd1 registration. Not totally unreasonable, but that seems odd since we actually check machined presence in this function. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/util/virsystemd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 9a659dad84..74d0d15ca7 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -163,7 +163,7 @@ virSystemdHasMachined(void) return ret; } =20 - if ((ret =3D virDBusSystemIsServiceRegistered("org.freedesktop.systemd= 1")) =3D=3D -1) + if ((ret =3D virDBusSystemIsServiceRegistered("org.freedesktop.machine= 1")) =3D=3D -1) return ret; g_atomic_int_set(&virSystemdHasMachinedCachedValue, ret); return ret; --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1586208514; cv=none; d=zohomail.com; s=zohoarc; b=IJk63bxgwnsf0upsGdFClB9Cp5eJR/615O96lnvont3BjUNo+YAjiC6YagXjHv7Bt8+R6MvEeEkLAmtUOl+VIXjcJLUx1mtLDG6ATuQ9zs1Rj0yjoml/r55gomVEYC8/Ly5Ru2IXX1AIjI1i0n2sxlWyXEnVCY8rjhFrXxsGHdg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208514; h=Content-Type:Content-Transfer-Encoding:Cc: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=qVKypYAhQyk5UzAWt/ERnejN7r5X8JHHW4/h5dgPbNY=; b=WgiqgKJROpgEmgnQKhTQ8r1sxCxBJ43yqLBUYF3h3YJNIwbNxkFLeCyEUlfGqE55F6fo0NtPfr3h+56P4oagau5MPqeU/IlamOZl63tElwfGKlvFo3m+IjOsJd10hgVIVInlq55XWri/xvQvnmguYUSXatjvA38KBAcq5RVPaPM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586208514558986.6859671401862; Mon, 6 Apr 2020 14:28:34 -0700 (PDT) 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-16-eMqEfWqgMdGL2aYwpPtfpg-1; Mon, 06 Apr 2020 17:28:30 -0400 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 7C3B4149C0; Mon, 6 Apr 2020 21:28:25 +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 4F0CB1036D12; Mon, 6 Apr 2020 21:28:25 +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 06B1E93A74; Mon, 6 Apr 2020 21:28:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LSOfk015822 for ; Mon, 6 Apr 2020 17:28:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0257C118F4F; Mon, 6 Apr 2020 21:28:24 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0D5C118F51; Mon, 6 Apr 2020 21:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208513; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=qVKypYAhQyk5UzAWt/ERnejN7r5X8JHHW4/h5dgPbNY=; b=Mn+A5HTso0VNPOm5WjKscrca4sz73yVlh3Nqhen8hYf6/FkIc7B3CHCSMFFrr9knb0PLHP Rh1wGgpN5+j9pOVbIISKPqQX0/xw4WoeOgxfjbjFfnjsJARE78NFGZZel6AmSa+3h96WfT OCraM6bhaIQp9MW+tDq9+zo+PdCIW5k= X-MC-Unique: eMqEfWqgMdGL2aYwpPtfpg-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 10/15] systemd: only check for activitable machine1 service Date: Mon, 6 Apr 2020 23:27:07 +0200 Message-Id: <20200406212712.1315604-11-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau The service is started on demand, checking if it's already registered on the bus defeat this purpose. Note: the same is probably true for login1, but I don't intent to look at the code path yet. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/util/virsystemd.c | 2 -- tests/virsystemdtest.c | 35 ----------------------------------- 2 files changed, 37 deletions(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 74d0d15ca7..14d680532f 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -163,8 +163,6 @@ virSystemdHasMachined(void) return ret; } =20 - if ((ret =3D virDBusSystemIsServiceRegistered("org.freedesktop.machine= 1")) =3D=3D -1) - return ret; g_atomic_int_set(&virSystemdHasMachinedCachedValue, ret); return ret; } diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c index 050941dce8..8518805f82 100644 --- a/tests/virsystemdtest.c +++ b/tests/virsystemdtest.c @@ -260,40 +260,6 @@ static int testCreateNoSystemd(const void *opaque G_GN= UC_UNUSED) return 0; } =20 -static int testCreateSystemdNotRunning(const void *opaque G_GNUC_UNUSED) -{ - unsigned char uuid[VIR_UUID_BUFLEN] =3D { - 1, 1, 1, 1, - 2, 2, 2, 2, - 3, 3, 3, 3, - 4, 4, 4, 4 - }; - int rv; - - g_setenv("FAIL_NOT_REGISTERED", "1", TRUE); - - if ((rv =3D virSystemdCreateMachine("demo", - "qemu", - uuid, - NULL, - 123, - false, - 0, NULL, - NULL, 0)) =3D=3D 0) { - g_unsetenv("FAIL_NOT_REGISTERED"); - fprintf(stderr, "%s", "Unexpected create machine success\n"); - return -1; - } - g_unsetenv("FAIL_NOT_REGISTERED"); - - if (rv !=3D -2) { - fprintf(stderr, "%s", "Unexpected create machine error\n"); - return -1; - } - - return 0; -} - static int testCreateBadSystemd(const void *opaque G_GNUC_UNUSED) { unsigned char uuid[VIR_UUID_BUFLEN] =3D { @@ -698,7 +664,6 @@ mymain(void) DO_TEST("Test create machine ", testCreateMachine); DO_TEST("Test terminate machine ", testTerminateMachine); DO_TEST("Test create no systemd ", testCreateNoSystemd); - DO_TEST("Test create systemd not running ", testCreateSystemdNotRunnin= g); DO_TEST("Test create bad systemd ", testCreateBadSystemd); DO_TEST("Test create with network ", testCreateNetwork); DO_TEST("Test getting machine name ", testGetMachineName); --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1586208523; cv=none; d=zohomail.com; s=zohoarc; b=CUs8RioraeQei56iK6cfu8pr+9uQnmDczrqDjwVxP1EPcXfGI7M9i4hP8KImAQEK91cQuT18wm15JCS726TkeqC+s5Ws42QNqxGMlHxgkOtJ4Tcxb88KY1CRHgZDTxmLXbNeHodmN9OQXkbkwfTQM7aZ9HdRyjXCUr07BTZm0+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208523; h=Content-Type:Content-Transfer-Encoding:Cc: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=MeM1epYPmnhu+g0zKFUj7CYeeWZ9CSkS4iaYdRgZtZE=; b=IW4pewyMznbfSJIA+8+yNCrVQzMZWF5X/oqGALgooaP6TftYeZEC1DHsJPqgtfXYtMAwvA6BubMLwrEaI8/gBP7WcumueyhazNOTz/85tqK2gh6ZDmdDmYGLe943hKxX5IifkJvOauuWDLAMSOzGdeF1vNHgZDSKFjeZH2YWQ5o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586208523729196.22356418783522; Mon, 6 Apr 2020 14:28:43 -0700 (PDT) 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-498-jPr3iHVeNo-eAcSAMWH0IA-1; Mon, 06 Apr 2020 17:28:40 -0400 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 9A69B190A7A1; Mon, 6 Apr 2020 21:28:34 +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 614B01036B47; Mon, 6 Apr 2020 21:28:34 +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 0950793A78; Mon, 6 Apr 2020 21:28:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LSW6R015850 for ; Mon, 6 Apr 2020 17:28:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 39696BEA62; Mon, 6 Apr 2020 21:28:32 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id E32215E015; Mon, 6 Apr 2020 21:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208522; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=MeM1epYPmnhu+g0zKFUj7CYeeWZ9CSkS4iaYdRgZtZE=; b=esJCeo/qCFIiATqkGF/pxVVqkdOLHbSKieWZe05VAstBge9QSEUa6CEzIEQFZn7MjP50iO JWWvWlIk/28qf+r7nSsEA6/kYHGunopDnxeA9z2rAq8UW0lANDDVDBcCqpcXtjg5U8vWht yBcBe7t7y5II2Xar9OzkwmqW63Iskc0= X-MC-Unique: jPr3iHVeNo-eAcSAMWH0IA-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 11/15] systemd: register machines against session service Date: Mon, 6 Apr 2020 23:27:08 +0200 Message-Id: <20200406212712.1315604-12-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau machined could quite easily support session management: https://github.com/systemd/systemd/pull/15312 Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/util/virsystemd.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 14d680532f..31f5498438 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -148,16 +148,18 @@ void virSystemdHasLogindResetCachedValue(void) * 0 =3D machine1 is available */ static int -virSystemdHasMachined(void) +virSystemdHasMachined(DBusConnection **conn) { int ret; int val; =20 + *conn =3D geteuid() ? virDBusGetSessionBus() : virDBusGetSystemBus(); + val =3D g_atomic_int_get(&virSystemdHasMachinedCachedValue); if (val !=3D -1) return val; =20 - if ((ret =3D virDBusSystemIsServiceEnabled("org.freedesktop.machine1")= ) < 0) { + if ((ret =3D virDBusIsServiceEnabled(*conn, "org.freedesktop.machine1"= )) < 0) { if (ret =3D=3D -2) g_atomic_int_set(&virSystemdHasMachinedCachedValue, -2); return ret; @@ -199,10 +201,7 @@ virSystemdGetMachineNameByPID(pid_t pid) DBusMessage *reply =3D NULL; char *name =3D NULL, *object =3D NULL; =20 - if (virSystemdHasMachined() < 0) - goto cleanup; - - if (!(conn =3D virDBusGetSystemBus())) + if (virSystemdHasMachined(&conn) < 0) goto cleanup; =20 if (virDBusCallMethod(conn, &reply, NULL, @@ -279,12 +278,9 @@ int virSystemdCreateMachine(const char *name, char *scopename =3D NULL; static int hasCreateWithNetwork =3D 1; =20 - if ((ret =3D virSystemdHasMachined()) < 0) + if ((ret =3D virSystemdHasMachined(&conn)) < 0) return ret; =20 - if (!(conn =3D virDBusGetSystemBus())) - return -1; - ret =3D -1; =20 creatorname =3D g_strdup_printf("libvirt-%s", drivername); @@ -459,14 +455,11 @@ int virSystemdTerminateMachine(const char *name) =20 memset(&error, 0, sizeof(error)); =20 - if ((ret =3D virSystemdHasMachined()) < 0) + if ((ret =3D virSystemdHasMachined(&conn)) < 0) goto cleanup; =20 ret =3D -1; =20 - if (!(conn =3D virDBusGetSystemBus())) - goto cleanup; - /* * The systemd DBus API we're invoking has the * following signature --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1586208530; cv=none; d=zohomail.com; s=zohoarc; b=dvPRxoIbbDcc12mv1aG+pSXpp5lzz0HnqNfOGHRAzPt1uj2XMRDW47W0XO1YTA7ktuRi8IHu+RoHkD8FbmLJGuJ6dTNiDlu0+j+33HTT+JvP9mFHgCWYyQ79tGCzV8B8yDyeoaljqVNkEdLl8PIqBdQmz0NheVz0yUX9f6svY+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208530; h=Content-Type:Content-Transfer-Encoding:Cc: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=KErxApbrDRThEGa/6BO9Te5Z2HwNzuEEBAppKXNYgog=; b=ZZSywEuyMeP69TCLnI2mVDrRx7RX9SXfAVgnIqgadu3BHPfZy28v1QZlEWmuS/DklQp8OvnS1XucHTnKQPyQ6K+0ExLPkrmQB8ye3vDRaDrQC4GJe9SZqc7ZPUuGkCE1bNq5ClPeUDTKaboT07AUjEuPAPcRjDS0iYun8F9D/o4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586208530855190.73144138504938; Mon, 6 Apr 2020 14:28:50 -0700 (PDT) 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-210-a4i-BS2TNk-MNdL1GpX9bQ-1; Mon, 06 Apr 2020 17:28:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 65CBC85EE6C; Mon, 6 Apr 2020 21:28:41 +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 348B35C541; Mon, 6 Apr 2020 21:28: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 E21E718089D0; Mon, 6 Apr 2020 21:28:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LSdD1015867 for ; Mon, 6 Apr 2020 17:28:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id A02D65DA7C; Mon, 6 Apr 2020 21:28:39 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DBC65DA60; Mon, 6 Apr 2020 21:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208529; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=KErxApbrDRThEGa/6BO9Te5Z2HwNzuEEBAppKXNYgog=; b=LmNOOZpsKmUldCn5OQTtktS1iV+XpBsX030COSwtHb6/YJPDpG74zHdR0olc43Hy7IHDJY jWz0USC359D/oQSvg0szu4wEjF4XQIwMdlqNvDD56yqJdnvzGiePBVf1tkG7ng3KkfN0SW rEcVz1LRsqeXmJyYCTmMKMIaNYm1mZo= X-MC-Unique: a4i-BS2TNk-MNdL1GpX9bQ-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 12/15] cgroup: return directly if there is nothing to remove Date: Mon, 6 Apr 2020 23:27:09 +0200 Message-Id: <20200406212712.1315604-13-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau This fixes an error path when virCgroupV2DevicesDetectProg() fails but wasn't needed in the first place on VM shutdown. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/util/vircgroupv2devices.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c index d62ee12a05..997ef82964 100644 --- a/src/util/vircgroupv2devices.c +++ b/src/util/vircgroupv2devices.c @@ -541,12 +541,13 @@ virCgroupV2DevicesPrepareProg(virCgroupPtr group) int virCgroupV2DevicesRemoveProg(virCgroupPtr group) { - if (virCgroupV2DevicesDetectProg(group) < 0) - return -1; - if (group->unified.devices.progfd <=3D 0 && group->unified.devices.map= fd <=3D 0) return 0; =20 + if (virCgroupV2DevicesDetectProg(group) < 0) { + return -1; + } + if (group->unified.devices.mapfd >=3D 0) VIR_FORCE_CLOSE(group->unified.devices.mapfd); =20 --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586208532; cv=none; d=zohomail.com; s=zohoarc; b=SspKivedN39m2vbNade9MpMhhFddNz27+6CujYp/jj0KXg9ni0LrAn4CsYYL2CYhJCICpZNdN1WtQRUr7MH8sx22Sj3qHfUp4IPAr3gHd5xC4sypmHU+E1myRI0OY+tcc1wleDk2MGJ/7364gdtEhBUUJdRVU0iHwyuhSmJlO8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208532; h=Content-Type:Content-Transfer-Encoding:Cc: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=15bwk1NG40PfL48635fzPo0nqKeS/zxF+XfNNkNgiBU=; b=CoxHkgq3t464JLmnvjoPz2VQA4rtVHA26dj6HOtqZpf3MKPqZk8IogWJkeEsFWzKyaDcNDn525A4UaW7RCD6ZFrnJIkYRk8DfN8RnfjH1hrklfCFgJb3eEJArNr1Lc5g3PqU+yMSZ/2zcXpc5L9IPaoGweG7UXiY5Ila8yV06gc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586208532929958.5417503316511; Mon, 6 Apr 2020 14:28:52 -0700 (PDT) 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-121-HdzXxpVZOc-5Y1Jn6kVG7A-1; Mon, 06 Apr 2020 17:28:49 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E72258017CE; Mon, 6 Apr 2020 21:28:43 +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 B34C85DA60; Mon, 6 Apr 2020 21:28:43 +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 665EB18089D6; Mon, 6 Apr 2020 21:28:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LSfU6015881 for ; Mon, 6 Apr 2020 17:28:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id B6921BEA69; Mon, 6 Apr 2020 21:28:41 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AC8DBEA65; Mon, 6 Apr 2020 21:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208531; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=15bwk1NG40PfL48635fzPo0nqKeS/zxF+XfNNkNgiBU=; b=F70FYVbjyALxUCYpq44fGF2d4AQp9OWFSJ6BaHKNlFrYgYJuZYSezzYrxNdHwxBk2M6QiR nJoTBSg/Mao0DaXkfV4pVaBhXZlrzQil9elDw9N3UPxbNwFeLVTKqbxcGA4Pfw7lo70ua8 1aSaj14uQYCjQHhtC1XjSTlxUX/3jNk= X-MC-Unique: HdzXxpVZOc-5Y1Jn6kVG7A-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 13/15] qemu-cgroup: register ext devices when cpu/cpuset controller are missing Date: Mon, 6 Apr 2020 23:27:10 +0200 Message-Id: <20200406212712.1315604-14-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau External devices registration can add processes to the process group, which allows basic process management or other tuning. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_cgroup.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index cec0a03889..c288519e62 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -1127,15 +1127,6 @@ qemuSetupCgroupForExtDevices(virDomainObjPtr vm, priv->cgroup =3D=3D NULL) return 0; /* Not supported, so claim success */ =20 - /* - * If CPU cgroup controller is not initialized here, then we need - * neither period nor quota settings. And if CPUSET controller is - * not initialized either, then there's nothing to do anyway. - */ - if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU) && - !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET= )) - return 0; - if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_EMULATOR, 0, false, &cgroup_temp) < 0) goto cleanup; --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1586208539; cv=none; d=zohomail.com; s=zohoarc; b=NZ05KXBzkOCgR1h1iJVsC1GV/rmwIEEb0I+vv1lk+s8E0cRyK5fHm/P94qnw+zDKXXKstDIcpEC02SZTdmXZb2Mc8BLRArAc6XLVFiBLjOCoBEk/GkBsRrK1pH6ZfKf3ERVFzuErz5kxfAdWqwrsSq5SNA03ZLY0IoiEzfydg+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208539; h=Content-Type:Content-Transfer-Encoding:Cc: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=P7OqMm8pMG+1Djp+ZD+GyyJnJyfnlaQh1SsE57Vb0nI=; b=j04CNUalaSrP+Hq8CNBfY1rJebvF1lxommAixvIWeq6B5Ij5UO9mp3zMNbjnPZiLjLZL79+l/NCWyi0/YX5AJ1G676woJYlPT9FnenFthq1kjgUneZ2TaM2vDahLAIDodhj1uzr6+REhCaxewEDGXRR2+UCTIxjxlDQgfgX9Seg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1586208539400752.9394220013476; Mon, 6 Apr 2020 14:28:59 -0700 (PDT) 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-469-1lNGYR77OCOBNq8O7Doq4g-1; Mon, 06 Apr 2020 17:28:55 -0400 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 6FC20800D53; Mon, 6 Apr 2020 21:28:50 +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 407061000325; Mon, 6 Apr 2020 21:28:50 +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 E255693A71; Mon, 6 Apr 2020 21:28:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LSnvd015894 for ; Mon, 6 Apr 2020 17:28:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 237A29D348; Mon, 6 Apr 2020 21:28:49 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id D69129D378; Mon, 6 Apr 2020 21:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208538; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=P7OqMm8pMG+1Djp+ZD+GyyJnJyfnlaQh1SsE57Vb0nI=; b=UaJpp1tv10WhQ15mCHvClRZDhmjJfc1D9FlKnhxhJ5vxYHDDYx6AcVG5TY9C6QRx/QDPL4 Jrdf3kMZKgkfQdF+P2U/VDx2X85ewGwWmLP5PvzF+c9S58N1hjTTf1fO0QrOoWFJLkTB4Q p8m5ehiMXa/JfgzR2eB6UwWOhEoiSIQ= X-MC-Unique: 1lNGYR77OCOBNq8O7Doq4g-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 14/15] qemu: create cgroup regardless of controller support Date: Mon, 6 Apr 2020 23:27:11 +0200 Message-Id: <20200406212712.1315604-15-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau This allow for basic process management, at least. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6b9f6fb860..0c33eab26c 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2674,6 +2674,9 @@ qemuProcessSetupPid(virDomainObjPtr vm, afinity_cpumask =3D hostcpumap; } =20 + if (priv->cgroup && virCgroupNewThread(priv->cgroup, nameval, id, true= , &cgroup) < 0) + goto cleanup; + /* * If CPU cgroup controller is not initialized here, then we need * neither period nor quota settings. And if CPUSET controller is @@ -2689,9 +2692,6 @@ qemuProcessSetupPid(virDomainObjPtr vm, &mem_mask, -1) < 0) goto cleanup; =20 - if (virCgroupNewThread(priv->cgroup, nameval, id, true, &cgroup) <= 0) - goto cleanup; - if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU= SET)) { if (use_cpumask && qemuSetupCgroupCpusetCpus(cgroup, use_cpumask) < 0) --=20 2.26.0.rc2.42.g98cedd0233 From nobody Wed May 15 13:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1586208547; cv=none; d=zohomail.com; s=zohoarc; b=Oe78t8Vvor4it1ansMtXwqyrpVPORzbr7qVMNQJoLa2cBs1wnkXjrwgOcIg1TKoIU5fzOQf+EZH9lV/GIqc+bEemY4JSFXfSIEnodHs4z8YLBNp3/EZ+SFSXp7bCp4wz5yw2Z3eKzuXUha6VwtDqBS/t0GpnkXisRbpSDuPMo1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586208547; h=Content-Type:Content-Transfer-Encoding:Cc: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=+ZO6kcpiZ7gTiGn/Zm0G20jcJu7yOEllAZU8RmXcR04=; b=VMV253GlyEdC8wVWGGu9hR8U5lo3A3Ch5c1xM9NJCM8Gk8AyH+wF21hSUclV66yNkBJSjdRWTHqxccE4yrwE2wdVBWBBbc4EiOs1H9VLNEbpFAce5X+28PtCnkVxuPLqno9sDmIyzUsw4HRjPp2QZ6oEFdI4DczM8h2ChjsJ74U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1586208547994518.37936031537; Mon, 6 Apr 2020 14:29:07 -0700 (PDT) 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-187-0eEldYgbPH6b5I0Gi1nwvA-1; Mon, 06 Apr 2020 17:29:04 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 984E0190A7A5; Mon, 6 Apr 2020 21:28:58 +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 6D5235DA7B; Mon, 6 Apr 2020 21:28:58 +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 18B8018089CE; Mon, 6 Apr 2020 21:28:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036LSvmF015909 for ; Mon, 6 Apr 2020 17:28:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5AD4A118F58; Mon, 6 Apr 2020 21:28:57 +0000 (UTC) Received: from localhost (unknown [10.36.110.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C39D118F55; Mon, 6 Apr 2020 21:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586208546; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=+ZO6kcpiZ7gTiGn/Zm0G20jcJu7yOEllAZU8RmXcR04=; b=GBK7FfNI432+bQogSitK46+TFPQ7Lk782SINNqJvUvuPRZoq7+SoNetm88bSXM3WiUQrBV 53McrzkZMgrwEDn5JPXUrW9LLcXjTFVSCQNq6AaaiwaT4fbdaopWnJQR2dAR+tTeKi4LcT C7OdeBYqBYAQKt0KBsR2pGtFBP5SiQc= X-MC-Unique: 0eEldYgbPH6b5I0Gi1nwvA-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH 15/15] qemu-cgroup: drop the need for privileges to use cgroup Date: Mon, 6 Apr 2020 23:27:12 +0200 Message-Id: <20200406212712.1315604-16-marcandre.lureau@redhat.com> In-Reply-To: <20200406212712.1315604-1-marcandre.lureau@redhat.com> References: <20200406212712.1315604-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , phrdina@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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau CGroup delegation can allow various processes or users to use cgroup. Further checks should be done by the various backends. With this series, a qemu:///session VM can have basic CGroupv2 support with machined --user help. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/qemu/qemu_cgroup.c | 3 --- src/util/vircgroup.c | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index c288519e62..0f80dd4214 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -914,9 +914,6 @@ qemuInitCgroup(virDomainObjPtr vm, qemuDomainObjPrivatePtr priv =3D vm->privateData; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(priv->dr= iver); =20 - if (!virQEMUDriverIsPrivileged(priv->driver)) - return 0; - if (!virCgroupAvailable()) return 0; =20 diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 70d85200cb..4e71677994 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1254,6 +1254,11 @@ virCgroupNewMachine(const char *name, if (rv =3D=3D -1) return -1; =20 + if (geteuid() !=3D 0) { + errno =3D EPERM; + return 0; + } + return virCgroupNewMachineManual(name, drivername, pidleader, --=20 2.26.0.rc2.42.g98cedd0233