From nobody Tue Feb 10 01:35:55 2026 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