From nobody Sun Apr 28 21:29:27 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-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=1582209223; cv=none; d=zohomail.com; s=zohoarc; b=hep8fZ+vUg0aIulSLelTK9RHrpo3gNbrMqAiiKtxhjb3Kds3kapOMhPvHPJB+fMzh+606r72sJAddrD2ahiVzXkgE6OGUBoHD9+36wRYgpUPCldbARwNcRRlcOnOoYJcYiaNPL5+9M73+99jmNUWpY3NY+7y/LrscT0eaGcYeUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209223; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/qSORoLeJHL5IohJtbBus1E1JKn6dfJ+I/M8sKTRtJE=; b=P9KNhpum2nxJMizr+GiNoC72ttP6FYPMp7sdhVNIHJAfsKwcPqlWNPcE1k3O0+rr4C3horQrWH2X8jKenkkIWxS00jkFl/BzA2U09iBawx0XtGxgCXyIqNg2tupQDFyNZJcAppbDVBj3bm3lQd3ib+yeDUDNrCGLGv6yf8lAw7s= 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1582209223363169.8608526272335; Thu, 20 Feb 2020 06:33:43 -0800 (PST) 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-M60Q9PLkMgaDBjbDtUd2IQ-1; Thu, 20 Feb 2020 09:33:37 -0500 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 4DDC9DB6D; Thu, 20 Feb 2020 14:33:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2551F5DA7C; Thu, 20 Feb 2020 14:33:31 +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 C59B78B2DB; Thu, 20 Feb 2020 14:33:30 +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 01KEWwgT021370 for ; Thu, 20 Feb 2020 09:32:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id D89C690F79; Thu, 20 Feb 2020 14:32:58 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E56590F71 for ; Thu, 20 Feb 2020 14:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209221; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/qSORoLeJHL5IohJtbBus1E1JKn6dfJ+I/M8sKTRtJE=; b=ACBhXUUwRkB5kzgQXWeCdscrGRqlpQtNgzWdNujUCEfRecsYns5akmIzF8+KFH9IkCYKev 3PrQSD46NXOuWof2MieSJQr3pgRfkeHyGNIlW7KfAYLvPgahmG17U/NzR3z0Zm5N21td6c +4HvaCgB+LCymzo2Kpu9a8n8kENhKtA= X-MC-Unique: M60Q9PLkMgaDBjbDtUd2IQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 01/15] docs: reduce excessive spacing in ToC for RST files Date: Thu, 20 Feb 2020 15:32:38 +0100 Message-Id: <5720973444a159b5ec5889eb53f2126acfbc39e0.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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: Daniel P. Berrang=C3=A9 The table of contents in the RST based files uses

tags inside the

  • , which results in 1em's worth of spacing above & below each entry. This results in way too much whitespace in the ToC. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- docs/libvirt.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/libvirt.css b/docs/libvirt.css index 2fe123395c..18e55dac59 100644 --- a/docs/libvirt.css +++ b/docs/libvirt.css @@ -579,3 +579,7 @@ ul.news-section-content li dl dd { font-family: monospace; background: #eeeeee; } + +.contents li p { + margin: 2px; +} --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209197; cv=none; d=zohomail.com; s=zohoarc; b=n7/L94OC8RFrO0+OURVX5w2zIzGK4dK9jNM/Se4lV49AB96FnCMATiH2IN7hBm9IbxKDIWQpc+5zSV+MbzAtDDCuzOM6s0IV5QnYVZU5ecMaWQXA+J6JBU0/P22kKxp/Jlz0N28pnL1tdN44SVlN3dmi7KRYsBb/rxeMM283n/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209197; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N6yS6dDqMvz9yP0ArTb3YhIyJlqI0xnvI+9OuM3LNns=; b=dISQGS48ubS1IM46mbqjoNnnzsXEPIEpkKrLlRKcmXRXrKCw41kjQ64f104d8vGIWVUamqC/GpxB4BuW3idKkcFl5tM3Z9206IXVlk/yYervXpPXd2XrsfA5L+JsFqJHCBSjpe9u0Cq9dTbx8HtibMuhWpBufLZfe30bh46Mg8M= 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 1582209197485270.07737442397047; Thu, 20 Feb 2020 06:33:17 -0800 (PST) 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-174-H_Ev27AQOFutRFIk1OMUiw-1; Thu, 20 Feb 2020 09:33:12 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E97FA8017CC; Thu, 20 Feb 2020 14:33:05 +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 8232891820; Thu, 20 Feb 2020 14:33:05 +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 41B691809565; Thu, 20 Feb 2020 14:33:03 +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 01KEWxD7021380 for ; Thu, 20 Feb 2020 09:32:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id AEDB390F71; Thu, 20 Feb 2020 14:32:59 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33D0690F7C for ; Thu, 20 Feb 2020 14:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209194; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=N6yS6dDqMvz9yP0ArTb3YhIyJlqI0xnvI+9OuM3LNns=; b=dyTr2aRzmykYpJl9xAD+8YiVzYlhNZ9N6UrnpKzH9B01crt1WV49m42mQqx5LUm7ZgAgmr ts+0gQNH1Eqv8RBdvTJ7Zo6kBOWAqyLD2/0R3q5Iyom6HmFlslNLbnEvvaw/z7ZL8ad4Om og34o8JepEm41Laf0HNMp4iHaRSE2Dw= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 02/15] schema: wrap fsDriver in a choice group Date: Thu, 20 Feb 2020 15:32:39 +0100 Message-Id: <70e8ba96f6c37369f068542220f6d0db6665557d.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: H_Ev27AQOFutRFIk1OMUiw-1 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" Allow adding new groups without changing indentation. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/schemas/domaincommon.rng | 50 +++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 4be751461d..5b609a4756 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2620,29 +2620,33 @@ for this kind of info, and 'type' for the storage format. We need the latter too, so had to invent a new attribute name --> - - - - path - handle - loop - nbd - ploop - - - - - - - - - - - immediate - - - - + + + + + + path + handle + loop + nbd + ploop + + + + + + + + + + + immediate + + + + + + =20 --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209329; cv=none; d=zohomail.com; s=zohoarc; b=cNUaAflrb6a4ayI746P3QQFdtSBDBRKW+zHvXe3Pstx5atO71JyHdySAvbF1fVtwO+vkw6DwHhemHoUsHFRFHg6LcPQLbbMcn9vGc9ZCnVYKsytvmPHG0zf94qZh7yAWYx/mUOZ/9kJ1TXW1lyvGQ0uKZpQqh+5wUSeUiuBvZ3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209329; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LykQNgOpYwaQFxU4CubVzdcBJ12cbYRitJMw1A0NCBE=; b=E/GlZPef+Bd5TCbwkpBar0ZkiXgfVjzBzMyL6Oc6w6Jx1vWmj6lWanDYY/SMk/7xry1sXVzTV26M+f9KsGwxdCxGs0ipV3DeFe0+WkG7yZM/PGrm2pDGBmWQKaSgL4U9VS3jSqnpRyteGkXY48r/vuVDf1b/UvUtlF7NEfeHzA8= 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 1582209329934812.9665349837057; Thu, 20 Feb 2020 06:35:29 -0800 (PST) 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-308-edfL5_JIPXWFE8EicOmiwg-1; Thu, 20 Feb 2020 09:33:43 -0500 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 F110E1005512; Thu, 20 Feb 2020 14:33:34 +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 BAA1060C99; Thu, 20 Feb 2020 14:33: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 6728A18089D5; Thu, 20 Feb 2020 14:33: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 01KEX0Ce021386 for ; Thu, 20 Feb 2020 09:33:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8365090F79; Thu, 20 Feb 2020 14:33:00 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0961590F71 for ; Thu, 20 Feb 2020 14:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209328; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LykQNgOpYwaQFxU4CubVzdcBJ12cbYRitJMw1A0NCBE=; b=N8cZrwC5/BBg3N12J6JxCwo0iYdiELQJegGshhcHaO7aXvozjkoRYjlNV+ce581JaWNzGA xnoXKHsu8eoM/FCGK9dzMIYoHzY2QjdncfZYYpetnJADx3JYAqoi6dJ3JuOv4T/NCvy6u5 0kYZtgkp+wvyM7cbfDN9wzbBUnolyuU= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 03/15] qemuExtDevicesStart: pass logManager Date: Thu, 20 Feb 2020 15:32:40 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: edfL5_JIPXWFE8EicOmiwg-1 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" Pass logManager to qemuExtDevicesStart for future usage. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_extdevice.c | 1 + src/qemu/qemu_extdevice.h | 1 + src/qemu/qemu_process.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 9c0c0fd573..7f3bb104d9 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -153,6 +153,7 @@ qemuExtDevicesCleanupHost(virQEMUDriverPtr driver, int qemuExtDevicesStart(virQEMUDriverPtr driver, virDomainObjPtr vm, + virLogManagerPtr logManager G_GNUC_UNUSED, bool incomingMigration) { virDomainDefPtr def =3D vm->def; diff --git a/src/qemu/qemu_extdevice.h b/src/qemu/qemu_extdevice.h index 5cf777ab4b..df29968e16 100644 --- a/src/qemu/qemu_extdevice.h +++ b/src/qemu/qemu_extdevice.h @@ -46,6 +46,7 @@ void qemuExtDevicesCleanupHost(virQEMUDriverPtr driver, =20 int qemuExtDevicesStart(virQEMUDriverPtr driver, virDomainObjPtr vm, + virLogManagerPtr logManager, bool incomingMigration) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8c1ed76677..5d24dc1645 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6734,7 +6734,9 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuProcessGenID(vm, flags) < 0) goto cleanup; =20 - if (qemuExtDevicesStart(driver, vm, incoming !=3D NULL) < 0) + if (qemuExtDevicesStart(driver, vm, + qemuDomainLogContextGetManager(logCtxt), + incoming !=3D NULL) < 0) goto cleanup; =20 VIR_DEBUG("Building emulator command line"); --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209200; cv=none; d=zohomail.com; s=zohoarc; b=Z9tFjTdGwk3P9SHvGac9oZpkwm/kdsH6Va1ZbCVxwLYORyFbltoGR4uAl+zuzhF5Sx3LvQfxBJfwk6q2v2WhO+DN4gdRoq40VHzNLiMtoYl1lZTCYJXjdPHMujodsiz5M5iB9O+tKpGTRhK0h6MkdLsvj5zt+gO0SXT4VMryPJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209200; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OsZB3xgjfAgPrRTrYb/2TrpabjiazW26rejYQ0mhQe4=; b=ly5SADEuonP12eLLFMDz3d/1peT1mbvgBUpZZy0wncWvSoFlbIeWYlG7VyofbqJxzk63D3EDe7OoGwC8g5rVQaaX8bT+0yJK1n5pjdE/4mkbuMaTKW000Vi4UlJIunC0Fg/TA019IQouafYvJRS6wVO5yBGUsdZuLOr/ulfAaKA= 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 1582209200117687.5996012437406; Thu, 20 Feb 2020 06:33:20 -0800 (PST) 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-27-ffxj1XmOMPS3pmHJ0JCNgA-1; Thu, 20 Feb 2020 09:33:13 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1782B800D48; Thu, 20 Feb 2020 14:33:06 +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 8170490F7F; Thu, 20 Feb 2020 14:33:05 +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 5E8D48B2CC; Thu, 20 Feb 2020 14:33:02 +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 01KEX1ew021396 for ; Thu, 20 Feb 2020 09:33:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5A48E90F71; Thu, 20 Feb 2020 14:33:01 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id D33C890F7C for ; Thu, 20 Feb 2020 14:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209195; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OsZB3xgjfAgPrRTrYb/2TrpabjiazW26rejYQ0mhQe4=; b=h304vcNe4jRPOvaBfqA5TUhnsQ34ITB3Vc7s1OJpvBbF0lQ+0OzELuM5dXZssKraakLAtz q/GhiGibPzD+0hMj8kMEDTzk68ArZEsZrDpouPbuGNQqooQBf2cLVqRbgnIrFkZjcQPlF6 E/RK+zgoj17CnyANe2tJ2mvMnb/mtYE= X-MC-Unique: ffxj1XmOMPS3pmHJ0JCNgA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 04/15] qemu: add QEMU_CAPS_VHOST_USER_FS Date: Thu, 20 Feb 2020 15:32:41 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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" Introduced by QEMU commit 98fc1ada4cf70af0f1df1a2d7183cf786fc7da05 virtio: add vhost-user-fs base device Released in QEMU v4.2.0. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 3 +++ tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + 7 files changed, 12 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 0e727093bc..13f9a08eb2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -560,6 +560,9 @@ VIR_ENUM_IMPL(virQEMUCaps, "virtio-net.failover", "tpm-spapr", "cpu.kvm-no-adjvtime", + + /* 355 */ + "vhost-user-fs", ); =20 =20 @@ -1277,6 +1280,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "i8042", QEMU_CAPS_DEVICE_I8042 }, { "rng-builtin", QEMU_CAPS_OBJECT_RNG_BUILTIN }, { "tpm-spapr", QEMU_CAPS_DEVICE_TPM_SPAPR }, + { "vhost-user-fs-device", QEMU_CAPS_DEVICE_VHOST_USER_FS }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[]= =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 7b6ed53863..5b483a2419 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -543,6 +543,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_DEVICE_TPM_SPAPR, /* -device tpm-spapr */ QEMU_CAPS_CPU_KVM_NO_ADJVTIME, /* cpu.kvm-no-adjvtime */ =20 + /* 355 */ + QEMU_CAPS_DEVICE_VHOST_USER_FS, /* -device vhost-user-fs */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_4.2.0.aarch64.xml index d0faa4c471..640ce29c8c 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -178,6 +178,7 @@ + 4001050 0 61700242 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_4.2.0.s390x.xml index 9275bf36fa..37776e1bbe 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -137,6 +137,7 @@ + 4001050 0 39100242 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.2.0.x86_64.xml index faed23f5c1..83e804ea36 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -222,6 +222,7 @@ + 4002000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_5.0.0.aarch64.xml index c05cea2eb7..e52c60607d 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -180,6 +180,7 @@ + 4002050 0 61700241 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.0.0.x86_64.xml index 1eef7197ef..6902cffd17 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -223,6 +223,7 @@ + 4002050 0 43100241 --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209230; cv=none; d=zohomail.com; s=zohoarc; b=UWOhN39bJx9UmFmvyqwaRV+1luNFxXo14XC3IkH1dv0n8dAR996mrbmBdgwJmsCpb5u5sw70j0sRLcD//z1xmDti/wDcq7Jq5+tm+Jb3f1yghzXhYQfdw5eJHAD1RymDF9LWqJex6azFNOM+9jZpDsM7OXlgfXtMjV38NCaYrOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209230; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SDbbA6WSq1n5USF8lKVjf1OKntY35bSmgCoJ0ut1PbQ=; b=dWQTU/hyjQROT2vSx1eXDVZVTghG+32sw2ohRq8vUPqWdTxcW6usGNLX6YAganbEBJYfZx83EXEdcTLanicyX+FDLqMnQ/F2IhjcNgZWGQGHXxSwHAklmeJLUq8ylqI4fovzDceuL1L5b6EIbEcuMrp7AdyVhU7VjxIeBoHcQc0= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1582209230353256.8790151614588; Thu, 20 Feb 2020 06:33:50 -0800 (PST) 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-297-NJyZ2wOTPh2XxaUt1HnU9w-1; Thu, 20 Feb 2020 09:33:46 -0500 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 B9462800D4E; Thu, 20 Feb 2020 14:33:38 +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 7CAD68ECFC; Thu, 20 Feb 2020 14:33:38 +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 30CCA180887A; Thu, 20 Feb 2020 14:33:38 +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 01KEX2db021402 for ; Thu, 20 Feb 2020 09:33:02 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3028990F79; Thu, 20 Feb 2020 14:33:02 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id A989790F71 for ; Thu, 20 Feb 2020 14:33:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209228; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SDbbA6WSq1n5USF8lKVjf1OKntY35bSmgCoJ0ut1PbQ=; b=VfOO2GiKZap0G6xZ5Ec3myriwIyJOj/LealEwWtyIzZ59TVFGg5uJAM6XQjAu2D1/1JsZa aSbOA6mU09zyGdjEnWHCLURSBt4aw4KmvzzdxXE8gKGyP+mlcOPPoOedzhL78pkRN4T85C Q5NY2GTjdTvFOlK5hjXgIrySH2TBqi4= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 05/15] docs: add virtiofs kbase Date: Thu, 20 Feb 2020 15:32:42 +0100 Message-Id: <0182b037b7ec9079b87576900857f2f0ab3a19ff.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: NJyZ2wOTPh2XxaUt1HnU9w-1 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" Add a document describing the usage of virtiofs. Reviewed-by: Peter Krempa --- docs/kbase.html.in | 3 + docs/kbase/virtiofs.rst | 152 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 docs/kbase/virtiofs.rst diff --git a/docs/kbase.html.in b/docs/kbase.html.in index c156414c41..7d6caf3cb1 100644 --- a/docs/kbase.html.in +++ b/docs/kbase.html.in @@ -29,6 +29,9 @@
    Backing chain management=
    Explanation of how disk backing chain specification impacts li= bvirt's behaviour and basic troubleshooting steps of disk problems.
    + +
    Virtio-FS
    +
    Share a filesystem between the guest and the host
    =20 diff --git a/docs/kbase/virtiofs.rst b/docs/kbase/virtiofs.rst new file mode 100644 index 0000000000..fe6885d139 --- /dev/null +++ b/docs/kbase/virtiofs.rst @@ -0,0 +1,152 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D +Sharing files with Virtio-FS +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D + +=3D=3D=3D 8< delete before merging 8< =3D=3D=3D +NOTE: if you're looking at this note, this is just a proposal. +See the up-to-date version on: https://libvirt.org/kbase/virtiofs.html +=3D=3D=3D 8< --------------------- 8< =3D=3D=3D + +.. contents:: + +=3D=3D=3D=3D=3D=3D=3D=3D=3D +Virtio-FS +=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Virtio-FS is a shared file system that lets virtual machines access +a directory tree on the host. Unlike existing approaches, it +is designed to offer local file system semantics and performance. + +See https://virtio-fs.gitlab.io/ + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Host setup +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The host-side virtiofsd daemon, like other vhost-user backed devices, +requires shared memory between the host and the guest. As of QEMU 4.2, this +requires specifying a NUMA topology for the guest and explicitly specifying +a memory backend. Multiple options are available: + +Either of the following: + +* Use file-backed memory + + Configure the directory where the files backing the memory will be stored + with the ``memory_backing_dir`` option in ``/etc/libvirt/qemu.conf`` + + :: + + # This directory is used for memoryBacking source if configured as fil= e. + # NOTE: big files will be stored here + memory_backing_dir =3D "/dev/shm/" + +* Use hugepage-backed memory + + Make sure there are enough huge pages allocated for the requested guest = memory. + For example, for one guest with 2 GiB of RAM backed by 2 MiB hugepages: + + :: + + # virsh allocpages 2M 1024 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Guest setup +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +#. Specify the NUMA topology + + in the domain XML of the guest. + For the simplest one-node topology for a guest with 2GiB of RAM and 8 v= CPUs: + + :: + + + ... + + + + + + ... + + + Note that the CPU element might already be specified and only one is al= lowed. + +#. Specify the memory backend + + Either of the following: + + * File-backed memory + + :: + + + ... + + + + ... + + + This will create a file in the directory specified in ``qemu.conf`` + + * Hugepage-backed memory + + :: + + + ... + + + + + + + ... + + +#. Add the ``vhost-user-fs`` QEMU device via the ``filesystem`` element + + :: + + + ... + + ... + + + + + + ... + + + + Note that despite its name, the ``target dir`` is actually a mount tag = and does + not have to correspond to the desired mount point in the guest. + + So far, ``passthrough`` is the only supported access mode and it requir= es + running the ``virtiofsd`` daemon as root. + +#. Boot the guest and mount the filesystem + + :: + + guest# mount -t virtiofs mount_tag /mnt/mount/path + + Note: this requires virtiofs support in the guest kernel (Linux v5.4 or= later) + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Optional parameters +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +More optional elements can be specified + +:: + + + + + + --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209376; cv=none; d=zohomail.com; s=zohoarc; b=OfVaG480OTMVMFw4dxO3Eki8odf+Ijqa7stmepPO+NmLy4RaP9HX2aKI3ySwfle8DhNIANJ/CBvsRZZHppr5VToMqinPoX0M/j2hk6IMHnUX1pz/4odOhaC0GAFQ5F/X4U3wH6IMA2f91Cx86TtFBd5Jvlt4Ey4VjsHLMx9bUnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209376; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=URH/wzV31dsp5+vfLlW4w8CW+Nn1bo+xcHT8vzP4LGQ=; b=i7kOC2ljrMyeXFTSEntBOzyaRU13pjxvI/MQMdofKDQo8EKnNa+5MRr0iBkX9iqduDpNUHFm8Ay0nE7SBthx3etp/Qa53HCVnFssN223SPdHIjrBFmPbTtJlm7cIVaIkUkq9RbGxNYJE5wzEOwFHtlUDJxXUaV+aCq/Hy2suaGA= 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 1582209376219996.7580899007787; Thu, 20 Feb 2020 06:36:16 -0800 (PST) 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-130-DXszCRQ4NniuflD-hejqMA-1; Thu, 20 Feb 2020 09:33:36 -0500 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 2A9261005513; Thu, 20 Feb 2020 14:33:30 +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 F174D19E9C; Thu, 20 Feb 2020 14:33:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 97C368B2D8; Thu, 20 Feb 2020 14:33:29 +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 01KEX3VL021415 for ; Thu, 20 Feb 2020 09:33:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 06EB090F79; Thu, 20 Feb 2020 14:33:03 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8066F90F71 for ; Thu, 20 Feb 2020 14:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209375; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=URH/wzV31dsp5+vfLlW4w8CW+Nn1bo+xcHT8vzP4LGQ=; b=Zr3ffy89ZQkQQ/wIjaxtcbhCbSYpbU1d4Ff0WFXwLLHpt8wz3MhqLYY8I/jPPZngae1afU 3Zc1KsQJgrxXk+3f8AW7vX/Zjw51KcUvco+mXe+EwpFJBVOvQ8ZjpM/+5m+CGxTLc6o8T9 Q3PvRjAnzKJxHnv7QDEWMdJqMES11bM= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 06/15] conf: qemu: add virtiofs fsdriver type Date: Thu, 20 Feb 2020 15:32:43 +0100 Message-Id: <0b20437ae3687f4a9f5348624a02d2619748ad1b.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: DXszCRQ4NniuflD-hejqMA-1 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" Introduce a new 'virtiofs' driver type for filesystem.
    Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- docs/formatdomain.html.in | 12 ++- docs/schemas/domaincommon.rng | 6 ++ src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 4 + src/qemu/qemu_domain.c | 4 + src/qemu/qemu_domain_address.c | 4 + .../vhost-user-fs-fd-memory.xml | 39 ++++++++++ .../vhost-user-fs-hugepages.xml | 74 +++++++++++++++++++ .../vhost-user-fs-fd-memory.x86_64-latest.xml | 1 + .../vhost-user-fs-hugepages.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 3 + 12 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml create mode 120000 tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64= -latest.xml create mode 120000 tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64= -latest.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index f4af65f13f..dab8fb8f6b 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3935,6 +3935,11 @@ <target dir=3D'/import/from/host'/> <readonly/> </filesystem> + <filesystem type=3D'mount' accessmode=3D'passthrough'> + <driver type=3D'virtiofs'/> + <source dir=3D'/path'/> + <target dir=3D'mount_tag'/> + </filesystem> ... </devices> ... @@ -3963,6 +3968,9 @@ while the value immediate means that a host writeback is immediately triggered for all pages touched during a guest file write operation (since 0.9.10). + Since 6.1.0, type=3D'virtiofs'<= /code> + is also supported. Using virtiofs requires setting up shared memor= y, + see the guide: Virtio-FS
    template
    @@ -3998,7 +4006,9 @@ The filesystem element has an optional attribute accessmode which specifies the security mode for accessing the source (since 0.8.5). Currently this only works - with type=3D'mount' for the QEMU/KVM driver. The possib= le + with type=3D'mount' for the QEMU/KVM driver. + For driver type virtiofs, only passthrough= is + supported. For other driver types, the possible values are: =20
    diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 5b609a4756..f7125e401a 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2645,6 +2645,12 @@ + + + virtiofs + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index dcd070d2ad..d78ea92ead 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -477,6 +477,7 @@ VIR_ENUM_IMPL(virDomainFSDriver, "loop", "nbd", "ploop", + "virtiofs", ); =20 VIR_ENUM_IMPL(virDomainFSAccessMode, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 867a9c7661..0ef1746e2a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -773,6 +773,7 @@ typedef enum { VIR_DOMAIN_FS_DRIVER_TYPE_LOOP, VIR_DOMAIN_FS_DRIVER_TYPE_NBD, VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP, + VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS, =20 VIR_DOMAIN_FS_DRIVER_TYPE_LAST } virDomainFSDriverType; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f69a9e651c..9fcd06f8c3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2680,6 +2680,10 @@ qemuBuildFilesystemCommandLine(virCommandPtr cmd, return -1; break; =20 + case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: + /* TODO: vhost-user-fs-pci */ + break; + case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP: case VIR_DOMAIN_FS_DRIVER_TYPE_NBD: case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index af6817cc05..c3fc3fed1c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8298,6 +8298,10 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs, _("Filesystem driver type not supported")); return -1; =20 + case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: + /* TODO: vhost-user-fs-pci */ + return 0; + case VIR_DOMAIN_FS_DRIVER_TYPE_LAST: default: virReportEnumRangeError(virDomainFSDriverType, fs->fsdriver); diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index c7d8a3ac3b..ab6bce19f4 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -699,6 +699,10 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevi= ceDefPtr dev, } break; =20 + case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: + /* vhost-user-fs-pci */ + return virtioFlags; + case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP: case VIR_DOMAIN_FS_DRIVER_TYPE_NBD: case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP: diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml b/tests/qem= uxml2argvdata/vhost-user-fs-fd-memory.xml new file mode 100644 index 0000000000..a6b6279fb8 --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml @@ -0,0 +1,39 @@ + + guest + 126f2720-6f8e-45ab-a886-ec9277079a67 + 14680064 + 14680064 + + + + + 2 + + hvm + + + + qemu64 + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + +
    + + + + + + diff --git a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml b/tests/qem= uxml2argvdata/vhost-user-fs-hugepages.xml new file mode 100644 index 0000000000..70df7b890d --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml @@ -0,0 +1,74 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 4194304 + 4194304 + + + + + + + 2 + + hvm + + + + + + + + qemu64 + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
    + + + +
    + + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + + +
    + + + + + + diff --git a/tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest= .xml b/tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest.xml new file mode 120000 index 0000000000..fbc552ef94 --- /dev/null +++ b/tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/vhost-user-fs-fd-memory.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest= .xml b/tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml new file mode 120000 index 0000000000..0c0f05b254 --- /dev/null +++ b/tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/vhost-user-fs-hugepages.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index daf9b53ce8..2c96bd5e7b 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1432,6 +1432,9 @@ mymain(void) DO_TEST("vhost-vsock-ccw-auto", QEMU_CAPS_DEVICE_VHOST_VSOCK, QEMU_CAPS_CCW); =20 + DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory"); + DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages"); + DO_TEST("riscv64-virt", QEMU_CAPS_DEVICE_VIRTIO_MMIO); DO_TEST("riscv64-virt-pci", --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209373; cv=none; d=zohomail.com; s=zohoarc; b=cI0b+ZvVt5D409pZtbBHbdQ8y3iWLBuoM2Adga4ZcFU9+K5p10fuwjcGdj560rVcFdmdOqNcZGlgmso9LuwtYfki6o92Kq6UYQimOC4QQt0pa9Vk0dDBbGqiIUh9lXJNVGtY+vCtup1cjRuNKGfzfX5o+tLJwU4Yqs2IGz5nlGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209373; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M6CCIGgGad0LCstvgP0g0jI+dCBpPp0qS0QmCbvGkyc=; b=YihJT8YzMWYEPrYLD9mfb4YXwmAea2Y9gv7vU4S8a4bgd2y3TVvfbwwZqx0zUSHTWYidZSuM/O9S7iCkx71Iaab5NysugDoR/n/+z+g9V1QIh1bTdbzzyhrPP3b4gaskLAk9ZS2XboqdorK7oj2r0c9yMeJEgOF/6XXPIDt/jsY= 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 1582209373178181.17684054793358; Thu, 20 Feb 2020 06:36:13 -0800 (PST) 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-411-5RV6M7QKM2WF-O1lBIjxeQ-1; Thu, 20 Feb 2020 09:33:39 -0500 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 D587718C43C9; Thu, 20 Feb 2020 14:33:33 +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 AFF0A19756; Thu, 20 Feb 2020 14:33:33 +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 6A88918089CF; Thu, 20 Feb 2020 14:33:33 +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 01KEX3tk021425 for ; Thu, 20 Feb 2020 09:33:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id D295790F79; Thu, 20 Feb 2020 14:33:03 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57F7F90F71 for ; Thu, 20 Feb 2020 14:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209371; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=M6CCIGgGad0LCstvgP0g0jI+dCBpPp0qS0QmCbvGkyc=; b=LoeZ9494OPKgQPg6/EhTpA0kmV0Mr3/IcGj89b4FRCvIhy1uSIAz7eFIKz2lLyY+MwEVdn va50sbDnbBYNe/NDLUC4wpWGXhK8dJ7d96jNWZzqDfqHwoD3Xjvw/fewM71AaHRf1UaEdu gA14tf1UuBhaCNVu1+SIHh3DUCTQPIU= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 07/15] conf: add virtiofs-related elements and attributes Date: Thu, 20 Feb 2020 15:32:44 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 5RV6M7QKM2WF-O1lBIjxeQ-1 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" Add more elements for tuning the virtiofsd daemon and the vhost-user-fs device: Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Masayoshi Mizuma Reviewed-by: Peter Krempa --- docs/formatdomain.html.in | 25 +++- docs/schemas/domaincommon.rng | 48 ++++++++ src/conf/domain_conf.c | 107 +++++++++++++++++- src/conf/domain_conf.h | 15 +++ src/libvirt_private.syms | 1 + .../vhost-user-fs-fd-memory.xml | 6 +- .../vhost-user-fs-hugepages.xml | 1 + 7 files changed, 200 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index dab8fb8f6b..7c4153c7ce 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3936,10 +3936,15 @@ <readonly/> </filesystem> <filesystem type=3D'mount' accessmode=3D'passthrough'> - <driver type=3D'virtiofs'/> + <driver type=3D'virtiofs queue=3D'1024'/> + <binary path=3D'/usr/libexec/virtiofsd' xattr=3D'on'> + <cache mode=3D'always'/> + <lock posix=3D'on' flock=3D'on'/> + </binary> <source dir=3D'/path'/> <target dir=3D'mount_tag'/> </filesystem> + ... </devices> ... @@ -4063,9 +4068,27 @@ Virtio-specific options can also= be set. (Since 3.5.0)
  • +
  • + For virtiofs, the queue attribute ca= n be used + to specify the queue size (i.e. how many requests can the queu= e fit). + (Since 6.1.0) +
  • =20 +
    binary
    +
    + The optional binary element can tune the options for = virtiofsd. + The attribute path can be used to override the path t= o the daemon. + Attribute xattr enables the use of filesystem extende= d attributes. + Caching can be tuned via the cache element, possible = mode + values being none and always. + Locking can be controlled via the lock + element - attributes posix and flock bot= h accepting + values yes or no. + (Since 6.1.0) +
    +
    source
    The resource on the host that is being accessed in the guest. The diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index f7125e401a..a3e60a6430 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2500,6 +2500,9 @@ + + + @@ -2649,12 +2652,57 @@ virtiofs + + + + + + + + + + + + + + + + + + + + + + + none + always + + + + + + + + + + + + + + + + + + + + + =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d78ea92ead..8e7400294b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -501,6 +501,14 @@ VIR_ENUM_IMPL(virDomainFSModel, "virtio-non-transitional", ); =20 +VIR_ENUM_IMPL(virDomainFSCacheMode, + VIR_DOMAIN_FS_CACHE_MODE_LAST, + "default", + "none", + "always", +); + + VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST, "user", @@ -2325,6 +2333,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def) VIR_FREE(def->dst); virDomainDeviceInfoClear(&def->info); VIR_FREE(def->virtio); + VIR_FREE(def->binary); =20 VIR_FREE(def); } @@ -11311,6 +11320,64 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlop= t, } } =20 + if (def->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + g_autofree char *queue_size =3D virXPathString("string(./driver/@q= ueue)", ctxt); + g_autofree char *binary =3D virXPathString("string(./binary/@path)= ", ctxt); + g_autofree char *xattr =3D virXPathString("string(./binary/@xattr)= ", ctxt); + g_autofree char *cache =3D virXPathString("string(./binary/cache/@= mode)", ctxt); + g_autofree char *posix_lock =3D virXPathString("string(./binary/lo= ck/@posix)", ctxt); + g_autofree char *flock =3D virXPathString("string(./binary/lock/@f= lock)", ctxt); + int val; + + + if (queue_size && virStrToLong_ull(queue_size, NULL, 10, &def->que= ue_size) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse queue size '%s' for virtiofs"), + queue_size); + goto error; + } + + if (binary) + def->binary =3D virFileSanitizePath(binary); + + if (xattr) { + if ((val =3D virTristateSwitchTypeFromString(xattr)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown xattr value '%s'"), xattr); + goto error; + } + def->xattr =3D val; + } + + if (cache) { + if ((val =3D virDomainFSCacheModeTypeFromString(cache)) <=3D 0= ) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse cache mode '%s' for virtiof= s"), + cache); + goto error; + } + def->cache =3D val; + } + + if (posix_lock) { + if ((val =3D virTristateSwitchTypeFromString(posix_lock)) <=3D= 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown posix lock value '%s'"), posix_l= ock); + goto error; + } + def->posix_lock =3D val; + } + + if (flock) { + if ((val =3D virTristateSwitchTypeFromString(flock)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown flock value '%s'"), flock); + goto error; + } + def->flock =3D val; + } + } + if (format) { if ((def->format =3D virStorageFileFormatTypeFromString(format)) <= =3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -25142,6 +25209,9 @@ virDomainFSDefFormat(virBufferPtr buf, const char *wrpolicy =3D virDomainFSWrpolicyTypeToString(def->wrpolicy= ); const char *src =3D def->src->path; g_auto(virBuffer) driverAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) driverBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) binaryAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) binaryBuf =3D VIR_BUFFER_INIT_CHILD(buf); =20 if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -25165,6 +25235,8 @@ virDomainFSDefFormat(virBufferPtr buf, virBufferAddLit(buf, ">\n"); =20 virBufferAdjustIndent(buf, 2); + virBufferAdjustIndent(&driverBuf, 2); + virBufferAdjustIndent(&binaryBuf, 2); if (def->fsdriver) { virBufferAsprintf(&driverAttrBuf, " type=3D'%s'", fsdriver); =20 @@ -25176,11 +25248,44 @@ virDomainFSDefFormat(virBufferPtr buf, if (def->wrpolicy) virBufferAsprintf(&driverAttrBuf, " wrpolicy=3D'%s'", wrpolicy= ); =20 + if (def->queue_size) + virBufferAsprintf(&driverAttrBuf, " queue=3D'%llu'", def->queu= e_size); + + } + + if (def->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + g_auto(virBuffer) lockAttrBuf =3D VIR_BUFFER_INITIALIZER; + virBufferEscapeString(&binaryAttrBuf, " path=3D'%s'", def->binary); + + if (def->xattr !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&binaryAttrBuf, " xattr=3D'%s'", + virTristateSwitchTypeToString(def->xattr)); + } + + if (def->cache !=3D VIR_DOMAIN_FS_CACHE_MODE_DEFAULT) { + virBufferAsprintf(&binaryBuf, "\n", + virDomainFSCacheModeTypeToString(def->cache)= ); + } + + if (def->posix_lock !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&lockAttrBuf, " posix=3D'%s'", + virTristateSwitchTypeToString(def->posix_loc= k)); + } + + if (def->flock !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&lockAttrBuf, " flock=3D'%s'", + virTristateSwitchTypeToString(def->flock)); + } + + virXMLFormatElement(&binaryBuf, "lock", &lockAttrBuf, NULL); } =20 + virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio); =20 - virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL); + virXMLFormatElement(buf, "driver", &driverAttrBuf, &driverBuf); + virXMLFormatElement(buf, "binary", &binaryAttrBuf, &binaryBuf); + virXMLFormatElement(buf, "driver", &driverAttrBuf, &driverBuf); =20 switch (def->type) { case VIR_DOMAIN_FS_TYPE_MOUNT: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0ef1746e2a..07815537d8 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -804,6 +804,14 @@ typedef enum { VIR_DOMAIN_FS_MODEL_LAST } virDomainFSModel; =20 +typedef enum { + VIR_DOMAIN_FS_CACHE_MODE_DEFAULT =3D 0, + VIR_DOMAIN_FS_CACHE_MODE_NONE, + VIR_DOMAIN_FS_CACHE_MODE_ALWAYS, + + VIR_DOMAIN_FS_CACHE_MODE_LAST +} virDomainFSCacheMode; + struct _virDomainFSDef { int type; int fsdriver; /* enum virDomainFSDriverType */ @@ -819,6 +827,12 @@ struct _virDomainFSDef { unsigned long long space_hard_limit; /* in bytes */ unsigned long long space_soft_limit; /* in bytes */ bool symlinksResolved; + char *binary; + unsigned long long queue_size; + virTristateSwitch xattr; + virDomainFSCacheMode cache; + virTristateSwitch posix_lock; + virTristateSwitch flock; virDomainVirtioOptionsPtr virtio; virObjectPtr privateData; }; @@ -3446,6 +3460,7 @@ VIR_ENUM_DECL(virDomainFSDriver); VIR_ENUM_DECL(virDomainFSAccessMode); VIR_ENUM_DECL(virDomainFSWrpolicy); VIR_ENUM_DECL(virDomainFSModel); +VIR_ENUM_DECL(virDomainFSCacheMode); VIR_ENUM_DECL(virDomainNet); VIR_ENUM_DECL(virDomainNetBackend); VIR_ENUM_DECL(virDomainNetVirtioTxMode); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 125d1836dd..49eb8ab7cb 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -395,6 +395,7 @@ virDomainDiskSourceFormat; virDomainDiskTranslateSourcePool; virDomainFeatureTypeFromString; virDomainFeatureTypeToString; +virDomainFSCacheModeTypeToString; virDomainFSDefFree; virDomainFSDefNew; virDomainFSDriverTypeToString; diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml b/tests/qem= uxml2argvdata/vhost-user-fs-fd-memory.xml index a6b6279fb8..f6bb663e97 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml @@ -27,7 +27,11 @@ - + + + + +
    diff --git a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml b/tests/qem= uxml2argvdata/vhost-user-fs-hugepages.xml index 70df7b890d..96b9774704 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml @@ -63,6 +63,7 @@ +
    --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209232; cv=none; d=zohomail.com; s=zohoarc; b=i9V85ROxJkws4+JXpPxixEjXJz6HY53xpCYtlGobpUGfdmjWxDpsXWVMFGjgTbn7QAIa+fhFe3Jr/Dd2E25JAwn8GF7KDLMIgZ8x2YPypzsFDdJirWVXc0sYbl6Kd92FAD5b/jhGflDsTs6H+iv85HGtKLPwcK6Gzx+0jlMiPXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209232; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sMRLzsriFmA25wRF5BX0ALdpu96qQXpGm1J7EFqzdWQ=; b=NitoOAMnsEYau2G/xUhgTdIHyJfo2z1rNF1TNRjKpVsjWK0OW9NTlI3JhIg8vj3tIlkid3ohqYY9bdQ6AjBZ4vVIJmjYjnTIsGGtf6jU+LoEZTbKK+AOj2I+knfjXtSYAppazGjQcH4F+8CKgc5OW1sUzalI/ywG9rEyMGZS2bg= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1582209232704218.09593169184268; Thu, 20 Feb 2020 06:33:52 -0800 (PST) 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-313-jWZi3LsRP261R-ErWU1RiQ-1; Thu, 20 Feb 2020 09:33:48 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 51E8818C43CB; Thu, 20 Feb 2020 14:33:42 +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 27FC310001AE; Thu, 20 Feb 2020 14:33:42 +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 D780F866AD; Thu, 20 Feb 2020 14:33:41 +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 01KEX4VB021432 for ; Thu, 20 Feb 2020 09:33:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id AB8FE90F79; Thu, 20 Feb 2020 14:33:04 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E93890F71 for ; Thu, 20 Feb 2020 14:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209231; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=sMRLzsriFmA25wRF5BX0ALdpu96qQXpGm1J7EFqzdWQ=; b=f4PaSO+ecmPwWdH0+d0fsRfCPGxSnW3PXj+w5MW6mIMf+XCsxnl01Mjebrqhm0XiaK6NB5 dBPkKdL4chxZKWSyslwMRV9A8dEexHIeBxqInqsGNQalcfdKFeKlmJV68B+xNOLg7+OxGR 94ChkkPdQSSMP0PQtu6Ez4hP8+H5epI= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 08/15] qemu: add virtiofsd_debug to qemu.conf Date: Thu, 20 Feb 2020 15:32:45 +0100 Message-Id: <85ba60d18595315b2aa308ef4d0e58f5645836b4.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: jWZi3LsRP261R-ErWU1RiQ-1 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" Add a 'virtiofsd_debug' option for tuning whether to run virtiofsd in debug mode. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 7 +++++++ src/qemu/qemu_conf.c | 2 ++ src/qemu/qemu_conf.h | 1 + src/qemu/test_libvirtd_qemu.aug.in | 1 + 5 files changed, 12 insertions(+) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index 557b6f38f8..3014fa6b86 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -116,6 +116,7 @@ module Libvirtd_qemu =3D let nvram_entry =3D str_array_entry "nvram" =20 let debug_level_entry =3D int_entry "gluster_debug_level" + | bool_entry "virtiofsd_debug" =20 let memory_entry =3D str_entry "memory_backing_dir" =20 diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index b6805ffc41..e82c1b5bd5 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -809,6 +809,13 @@ # #gluster_debug_level =3D 9 =20 +# virtiofsd debug +# +# Whether to enable the debugging output of the virtiofsd daemon. +# Possible values are 0 or 1. +# +#virtiofsd_debug =3D 1 + # To enhance security, QEMU driver is capable of creating private namespac= es # for each domain started. Well, so far only "mount" namespace is supporte= d. If # enabled it means qemu process is unable to see all the devices on the sy= stem, diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 0357501dc6..08c2fffce3 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -835,6 +835,8 @@ virQEMUDriverConfigLoadDebugEntry(virQEMUDriverConfigPt= r cfg, { if (virConfGetValueUInt(conf, "gluster_debug_level", &cfg->glusterDebu= gLevel) < 0) return -1; + if (virConfGetValueBool(conf, "virtiofsd_debug", &cfg->virtiofsdDebug)= < 0) + return -1; =20 return 0; } diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index cedf232223..3ce9566b71 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -202,6 +202,7 @@ struct _virQEMUDriverConfig { virFirmwarePtr *firmwares; size_t nfirmwares; unsigned int glusterDebugLevel; + bool virtiofsdDebug; =20 char *memoryBackingDir; =20 diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index dd90edf687..fca9a942c9 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -98,6 +98,7 @@ module Test_libvirtd_qemu =3D } { "stdio_handler" =3D "logd" } { "gluster_debug_level" =3D "9" } +{ "virtiofsd_debug" =3D "1" } { "namespaces" { "1" =3D "mount" } } --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209231; cv=none; d=zohomail.com; s=zohoarc; b=Wvv/d9zx3iCA7N+0yQiE9F4mVhHD8qKYFa9kvGg7o4rR+NtWxatjADhMMU9QUPoKGiqakVMz3U9D8cVZ5FrNg9jLZNBGz1W+g6D7eiI0Z4i4n3PFR/qmullw1AcDwywFRdsCOUK9UkEriw5wJTempeksY13hKP2END3A8qkiyAk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209231; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zpB+Pjqou0P2XBiS2GLR3KOr8F9xDS4nz+YGpcST7V0=; b=OhUW5o7eoB3dwbyP8wNIALox9vAxrnh467DJjs5HCMi6qIbFpU7JtfEv67dfJd0eFk6mMrFE2ByfIkMlA3WC8g9y5D9JMhX8PLC9Y4zeDLiR7KnHFYCFsxbABhH9sKraIET49bYVeG+wbWloV2QLMuUVH6NkduDG1CRyaLcmD5o= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1582209231672706.7317851608116; Thu, 20 Feb 2020 06:33:51 -0800 (PST) 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-179-fXfRju2VMsWWp8set2up5g-1; Thu, 20 Feb 2020 09:33:47 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9A338010F3; Thu, 20 Feb 2020 14:33:37 +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 8852610001AE; Thu, 20 Feb 2020 14:33: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 3269618089D8; Thu, 20 Feb 2020 14:33:37 +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 01KEX5na021444 for ; Thu, 20 Feb 2020 09:33:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8366D91821; Thu, 20 Feb 2020 14:33:05 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0746A90F71 for ; Thu, 20 Feb 2020 14:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209230; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zpB+Pjqou0P2XBiS2GLR3KOr8F9xDS4nz+YGpcST7V0=; b=XH5zmfVjoZi/enu7HbaCQvpszh9LJib+RLiOCvu1F9m4JNtQy3l04p2hcQkoFhPtR/PJlx XBL0bmIrDLlTlhuOySEbGclhNRLltxjQWTLptShtCEvmLpfEVPINpmPBk7oXmnSRTQk5HC ThuacA7VTumhtbxuwto/gyzEg4Xev34= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 09/15] qemu: validate virtiofs filesystems Date: Thu, 20 Feb 2020 15:32:46 +0100 Message-Id: <4726312a4cfa200001a0df3cc90b380b878837ff.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: fXfRju2VMsWWp8set2up5g-1 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" Reject unsupported configurations. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 61 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c3fc3fed1c..7cb283123d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8266,10 +8266,44 @@ qemuDomainDeviceDefValidateIOMMU(const virDomainIOM= MUDef *iommu, return 0; } =20 +static int +qemuDomainDefValidateVirtioFSSharedMemory(const virDomainDef *def) +{ + size_t numa_nodes =3D virDomainNumaGetNodeCount(def->numa); + size_t i; + + for (i =3D 0; i < numa_nodes; i++) { + virDomainMemoryAccess node_access =3D + virDomainNumaGetNodeMemoryAccessMode(def->numa, i); + + switch (node_access) { + case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT: + if (def->mem.access !=3D VIR_DOMAIN_MEMORY_ACCESS_SHARED) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs requires shared memory")); + return -1; + } + break; + case VIR_DOMAIN_MEMORY_ACCESS_SHARED: + break; + case VIR_DOMAIN_MEMORY_ACCESS_PRIVATE: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs requires shared memory")); + return -1; + + case VIR_DOMAIN_MEMORY_ACCESS_LAST: + default: + virReportEnumRangeError(virDomainMemoryAccess, node_access); + return -1; + + } + } + return 0; +} =20 static int qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs, - const virDomainDef *def G_GNUC_UNUSED, + const virDomainDef *def, virQEMUCapsPtr qemuCaps G_GNUC_UNUSED) { if (fs->type !=3D VIR_DOMAIN_FS_TYPE_MOUNT) { @@ -8299,8 +8333,29 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs, return -1; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: - /* TODO: vhost-user-fs-pci */ - return 0; + if (fs->accessmode !=3D VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs only supports passthrough accessmod= e")); + return -1; + } + if (fs->wrpolicy !=3D VIR_DOMAIN_FS_WRPOLICY_DEFAULT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs does not support wrpolicy")); + return -1; + } + if (fs->model !=3D VIR_DOMAIN_FS_MODEL_DEFAULT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs does not support model")); + return -1; + } + if (fs->format !=3D VIR_STORAGE_FILE_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs does not support format")); + return -1; + } + if (qemuDomainDefValidateVirtioFSSharedMemory(def) < 0) + return -1; + break; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_LAST: default: --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209236; cv=none; d=zohomail.com; s=zohoarc; b=fkRTa+7AnfiHBk/Q3touFkNhkL0uuf4vd29YPNqRgqByLbcM13NGgdW4voiQ1/v8CfZsbxDeikwxBkrXd+VwEYe1qmycxxAv5C4Y42JokIDTwPr8DC+iX5DNnjiRpExoznN8AdswrHrWK2MQZg+kdCMTiFJgLSe0gw/iC6hkxsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209236; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IYNmi31X2JUdt5pVCY98NJ4ZeJA1UY7EA9JEVdhmtk4=; b=gJ///dFy94gF1s5sahkXBPvSxiDISbwS4+hiZV9/kIcOD6s6zd/We6qgKXJHO3XjhDCoG1O3rxusT7KVd9NIApHSD22MRZF9WCzmKdNtc3uvmU3LwCZKRumvJDb26ajo23W2+ChG84qVJdy7RiqTpBYRuRGDze5bWjGrqRqlzGI= 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 1582209236757150.20836600161704; Thu, 20 Feb 2020 06:33:56 -0800 (PST) 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-194-BMG4Yl27PsGGzQowjaBUzw-1; Thu, 20 Feb 2020 09:33:51 -0500 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 0E1C8DB61; Thu, 20 Feb 2020 14:33:46 +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 D6B8D5DA83; Thu, 20 Feb 2020 14:33: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 7810186160; Thu, 20 Feb 2020 14:33:45 +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 01KEX6hL021456 for ; Thu, 20 Feb 2020 09:33:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 584BF90F79; Thu, 20 Feb 2020 14:33:06 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1C2B90F71 for ; Thu, 20 Feb 2020 14:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209234; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IYNmi31X2JUdt5pVCY98NJ4ZeJA1UY7EA9JEVdhmtk4=; b=eUUIfHns7KYw8ka4di1ntttieLNMTAhYNDKRQVpdyhyv95K3UxVtSqYscGfY+lOPFe2a+9 iFzwufLpGDMVURNhDKrHIeszKvrTmxE67iF6NNMJeRyN93AOsfcvN/6Psx/J6j1TuoRN9P lAClqvQ6CfQuDSCTYJM5lbp97++It5Y= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 10/15] qemu: forbid migration with vhost-user-fs device Date: Thu, 20 Feb 2020 15:32:47 +0100 Message-Id: <33a721e38c8be35edaa6347af64bf75c8d7e2cc0.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: BMG4Yl27PsGGzQowjaBUzw-1 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" This is not yet supported. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- src/qemu/qemu_migration.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index a307c5ebe2..2624a7388c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1280,6 +1280,16 @@ qemuMigrationSrcIsAllowed(virQEMUDriverPtr driver, return false; } } + + for (i =3D 0; i < vm->def->nfss; i++) { + virDomainFSDefPtr fs =3D vm->def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("migration with virtiofs device is not su= pported")); + return false; + } + } } =20 return true; --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209232; cv=none; d=zohomail.com; s=zohoarc; b=OA3ywosHOwuBQ+XwvsCysj3z1FCOaGSlAmgIkW4AUAZhSCozdcpBehdb6hE03yEit/9fS8EQzHRnYHw6adjkqBZ8yvynz7yNZBKkhUcBWdKUGkUZZe8z+G6imKeVHZhqNnfRkL1kIw42IsT6BedfqsBuxSvEFHqvFZGHmSfxCTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209232; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R5iuAe1CdF5Gi4PItee/LOJ1UxUhJ1MPftTbKF9S2jg=; b=ZB5e+S54mARBy724omBeX8tlcaG7+b1nI8VCumXyCuPmGlVOBCxYdJJ4DQj5+ZNEGmbKIwHbIfaK/bOju9dMjD+kYdq3YTWTTruOGHySK2REMeF6KklFbFI4L7Ttwf0m3q3+x7z7GxWvbZbuRmhaOBYeiRMZjzTxT+YrAOf68go= 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 1582209232850296.09060716752083; Thu, 20 Feb 2020 06:33:52 -0800 (PST) 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-130-n4E3OCXPNrebottdGGYb-Q-1; Thu, 20 Feb 2020 09:33:48 -0500 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 979B1101FC65; Thu, 20 Feb 2020 14:33:41 +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 6D1425C1B0; Thu, 20 Feb 2020 14:33: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 CB11035B17; Thu, 20 Feb 2020 14:33:40 +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 01KEX71b021464 for ; Thu, 20 Feb 2020 09:33:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 58F6290F79; Thu, 20 Feb 2020 14:33:07 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id A944290F71 for ; Thu, 20 Feb 2020 14:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209231; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=R5iuAe1CdF5Gi4PItee/LOJ1UxUhJ1MPftTbKF9S2jg=; b=U0JaEtkCInN+LzJ38hewPH4TTuYjG9dNmev7nrTQ4vQmDkXYvaANMrKzdxu4JWBLWaWU57 fUZo0YymMB3XAu6Yo9G7QCVUp6LCL9RhyMeQP9hUuHtsjhbTP+oE9d/4/HcFK4Iwa8FX3a rYVk67CNX7/1vqjs7XFGtzsfZ7pef/c= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 11/15] qemu: add code for handling virtiofsd Date: Thu, 20 Feb 2020 15:32:48 +0100 Message-Id: <91d6e885c8684c28f08518b547cad70cf3e7d6c1.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: n4E3OCXPNrebottdGGYb-Q-1 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" Start virtiofsd for each device using it. Pre-create the socket for communication with QEMU and pass it to virtiofsd. Note that virtiofsd needs to run as root. https://bugzilla.redhat.com/show_bug.cgi?id=3D1694166 Introduced by QEMU commit a43efa34c7d7b628cbf1ec0fe60043e5c91043ea Signed-off-by: J=C3=A1n Tomko --- po/POTFILES.in | 1 + src/qemu/Makefile.inc.am | 2 + src/qemu/qemu_domain.c | 5 +- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_extdevice.c | 20 ++- src/qemu/qemu_virtiofs.c | 300 ++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_virtiofs.h | 38 +++++ tests/qemuxml2argvtest.c | 11 ++ 8 files changed, 376 insertions(+), 3 deletions(-) create mode 100644 src/qemu/qemu_virtiofs.c create mode 100644 src/qemu/qemu_virtiofs.h diff --git a/po/POTFILES.in b/po/POTFILES.in index dba0d3a12e..bb97110e83 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -168,6 +168,7 @@ @SRCDIR@/src/qemu/qemu_tpm.c @SRCDIR@/src/qemu/qemu_vhost_user.c @SRCDIR@/src/qemu/qemu_vhost_user_gpu.c +@SRCDIR@/src/qemu/qemu_virtiofs.c @SRCDIR@/src/remote/remote_daemon.c @SRCDIR@/src/remote/remote_daemon_config.c @SRCDIR@/src/remote/remote_daemon_dispatch.c diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am index b9c0c6ea9c..baa324dc4b 100644 --- a/src/qemu/Makefile.inc.am +++ b/src/qemu/Makefile.inc.am @@ -67,6 +67,8 @@ QEMU_DRIVER_SOURCES =3D \ qemu/qemu_vhost_user.h \ qemu/qemu_vhost_user_gpu.c \ qemu/qemu_vhost_user_gpu.h \ + qemu/qemu_virtiofs.c \ + qemu/qemu_virtiofs.h \ qemu/qemu_checkpoint.c \ qemu/qemu_checkpoint.h \ qemu/qemu_backup.c \ diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7cb283123d..d0b2bff775 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1432,8 +1432,11 @@ qemuDomainFSPrivateNew(void) =20 =20 static void -qemuDomainFSPrivateDispose(void *obj G_GNUC_UNUSED) +qemuDomainFSPrivateDispose(void *obj) { + qemuDomainFSPrivatePtr priv =3D obj; + + g_free(priv->vhostuser_fs_sock); } =20 static virClassPtr qemuDomainVideoPrivateClass; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f8fb48f2ff..476056c73f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -568,7 +568,7 @@ typedef qemuDomainFSPrivate *qemuDomainFSPrivatePtr; struct _qemuDomainFSPrivate { virObject parent; =20 - int dummy; + char *vhostuser_fs_sock; }; =20 =20 diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 7f3bb104d9..5103d4921c 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -20,11 +20,13 @@ =20 #include =20 +#include "qemu_command.h" #include "qemu_extdevice.h" #include "qemu_vhost_user_gpu.h" #include "qemu_domain.h" #include "qemu_tpm.h" #include "qemu_slirp.h" +#include "qemu_virtiofs.h" =20 #include "viralloc.h" #include "virlog.h" @@ -153,7 +155,7 @@ qemuExtDevicesCleanupHost(virQEMUDriverPtr driver, int qemuExtDevicesStart(virQEMUDriverPtr driver, virDomainObjPtr vm, - virLogManagerPtr logManager G_GNUC_UNUSED, + virLogManagerPtr logManager, bool incomingMigration) { virDomainDefPtr def =3D vm->def; @@ -183,6 +185,15 @@ qemuExtDevicesStart(virQEMUDriverPtr driver, return -1; } =20 + for (i =3D 0; i < def->nfss; i++) { + virDomainFSDefPtr fs =3D def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + if (qemuVirtioFSStart(logManager, driver, vm, fs) < 0) + return -1; + } + } + return 0; } =20 @@ -214,6 +225,13 @@ qemuExtDevicesStop(virQEMUDriverPtr driver, if (slirp) qemuSlirpStop(slirp, vm, driver, net, false); } + + for (i =3D 0; i < def->nfss; i++) { + virDomainFSDefPtr fs =3D def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) + qemuVirtioFSStop(driver, vm, fs); + } } =20 =20 diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c new file mode 100644 index 0000000000..600a3644bd --- /dev/null +++ b/src/qemu/qemu_virtiofs.c @@ -0,0 +1,300 @@ +/* + * qemu_virtiofs.c: virtiofs support + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include +#include +#include + +#include "logging/log_manager.h" +#include "virlog.h" +#include "qemu_command.h" +#include "qemu_conf.h" +#include "qemu_extdevice.h" +#include "qemu_security.h" +#include "qemu_virtiofs.h" +#include "virpidfile.h" + +#define VIR_FROM_THIS VIR_FROM_QEMU + + +char * +qemuVirtioFSCreatePidFilename(virQEMUDriverConfigPtr cfg, + const virDomainDef *def, + const char *alias) +{ + g_autofree char *shortName =3D NULL; + g_autofree char *name =3D NULL; + + if (!(shortName =3D virDomainDefGetShortName(def))) + return NULL; + + name =3D g_strdup_printf("%s-%s-virtiofsd", shortName, alias); + + return virPidFileBuildPath(cfg->stateDir, name); +} + + +char * +qemuVirtioFSCreateSocketFilename(virDomainObjPtr vm, + const char *alias) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + + return virFileBuildPath(priv->libDir, alias, "-virtiofsd.sock"); +} + + +static char * +qemuVirtioFSCreateLogFilename(virQEMUDriverConfigPtr cfg, + const virDomainDef *def, + const char *alias) +{ + g_autofree char *name =3D NULL; + + name =3D g_strdup_printf("%s-%s", def->name, alias); + + return virFileBuildPath(cfg->logDir, name, "-virtiofsd.log"); +} + + +static int +qemuVirtioFSOpenChardev(virQEMUDriverPtr driver, + virDomainObjPtr vm, + const char *socket_path) +{ + virDomainChrSourceDefPtr chrdev =3D virDomainChrSourceDefNew(NULL); + virDomainChrDef chr =3D { .source =3D chrdev }; + VIR_AUTOCLOSE fd =3D -1; + int ret =3D -1; + + chrdev->type =3D VIR_DOMAIN_CHR_TYPE_UNIX; + chrdev->data.nix.listen =3D true; + chrdev->data.nix.path =3D g_strdup(socket_path); + + if (qemuSecuritySetDaemonSocketLabel(driver->securityManager, vm->def)= < 0) + goto cleanup; + fd =3D qemuOpenChrChardevUNIXSocket(chrdev); + if (fd < 0) { + ignore_value(qemuSecurityClearSocketLabel(driver->securityManager,= vm->def)); + goto cleanup; + } + if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0) + goto cleanup; + + if (qemuSecuritySetChardevLabel(driver, vm, &chr) < 0) + goto cleanup; + + ret =3D fd; + fd =3D -1; + + cleanup: + virObjectUnref(chrdev); + return ret; +} + +static virCommandPtr +qemuVirtioFSBuildCommandLine(virQEMUDriverConfigPtr cfg, + virDomainFSDefPtr fs, + int *fd) +{ + g_autoptr(virCommand) cmd =3D NULL; + g_auto(virBuffer) opts =3D VIR_BUFFER_INITIALIZER; + + if (!(cmd =3D virCommandNew(fs->binary))) + return NULL; + + virCommandAddArgFormat(cmd, "--fd=3D%d", *fd); + virCommandPassFD(cmd, *fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); + *fd =3D -1; + + virCommandAddArg(cmd, "-o"); + virBufferAsprintf(&opts, "source=3D%s,", fs->src->path); + if (fs->cache) + virBufferAsprintf(&opts, "cache=3D%s,", virDomainFSCacheModeTypeTo= String(fs->cache)); + + if (fs->xattr =3D=3D VIR_TRISTATE_SWITCH_ON) + virBufferAddLit(&opts, "xattr,"); + else if (fs->xattr =3D=3D VIR_TRISTATE_SWITCH_OFF) + virBufferAddLit(&opts, "no_xattr,"); + + if (fs->flock =3D=3D VIR_TRISTATE_SWITCH_ON) + virBufferAddLit(&opts, "flock,"); + else if (fs->flock =3D=3D VIR_TRISTATE_SWITCH_OFF) + virBufferAddLit(&opts, "no_flock,"); + + if (fs->posix_lock =3D=3D VIR_TRISTATE_SWITCH_ON) + virBufferAddLit(&opts, "posix_lock,"); + else if (fs->posix_lock =3D=3D VIR_TRISTATE_SWITCH_OFF) + virBufferAddLit(&opts, "no_posix_lock,"); + + virBufferTrim(&opts, ","); + + virCommandAddArgBuffer(cmd, &opts); + if (cfg->virtiofsdDebug) + virCommandAddArg(cmd, "-d"); + + return g_steal_pointer(&cmd); +} + +int +qemuVirtioFSStart(virLogManagerPtr logManager, + virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainFSDefPtr fs) +{ + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virCommand) cmd =3D NULL; + g_autofree char *socket_path =3D NULL; + g_autofree char *pidfile =3D NULL; + g_autofree char *logpath =3D NULL; + pid_t pid =3D (pid_t) -1; + VIR_AUTOCLOSE fd =3D -1; + VIR_AUTOCLOSE logfd =3D -1; + int ret =3D -1; + int rc; + + if (!virFileExists(fs->src->path)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("the virtiofs export directory '%s' does not exis= t"), + fs->src->path); + return -1; + } + + if (!(pidfile =3D qemuVirtioFSCreatePidFilename(cfg, vm->def, fs->info= .alias))) + goto cleanup; + + if (!(socket_path =3D qemuVirtioFSCreateSocketFilename(vm, fs->info.al= ias))) + goto cleanup; + + if ((fd =3D qemuVirtioFSOpenChardev(driver, vm, socket_path)) < 0) + goto cleanup; + + logpath =3D qemuVirtioFSCreateLogFilename(cfg, vm->def, fs->info.alias= ); + + if (cfg->stdioLogD) { + if ((logfd =3D virLogManagerDomainOpenLogFile(logManager, + "qemu", + vm->def->uuid, + vm->def->name, + logpath, + 0, + NULL, NULL)) < 0) + goto cleanup; + } else { + if ((logfd =3D open(logpath, O_WRONLY | O_CREAT | O_APPEND, S_IRUS= R | S_IWUSR)) < 0) { + virReportSystemError(errno, _("failed to create logfile %s"), + logpath); + goto cleanup; + } + if (virSetCloseExec(logfd) < 0) { + virReportSystemError(errno, _("failed to set close-on-exec fla= g on %s"), + logpath); + goto error; + } + } + + if (!(cmd =3D qemuVirtioFSBuildCommandLine(cfg, fs, &fd))) + goto cleanup; + + /* so far only running as root is supported */ + virCommandSetUID(cmd, 0); + virCommandSetGID(cmd, 0); + + virCommandSetPidFile(cmd, pidfile); + virCommandSetOutputFD(cmd, &logfd); + virCommandSetErrorFD(cmd, &logfd); + virCommandNonblockingFDs(cmd); + virCommandDaemonize(cmd); + + if (qemuExtDeviceLogCommand(driver, vm, cmd, "virtiofsd") < 0) + goto cleanup; + + rc =3D virCommandRun(cmd, NULL); + + if (rc < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not start 'virtiofsd'")); + goto error; + } + + rc =3D virPidFileReadPath(pidfile, &pid); + if (rc < 0) { + virReportSystemError(-rc, + _("Unable to read virtiofsd pidfile '%s'"), + pidfile); + goto error; + } + + if (virProcessKill(pid, 0) !=3D 0) { + virReportSystemError(errno, "%s", + _("virtiofsd died unexpectedly")); + goto error; + } + + QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock =3D g_steal_pointer(&soc= ket_path); + ret =3D 0; + + cleanup: + if (socket_path) + unlink(socket_path); + return ret; + + error: + if (pid !=3D -1) + virProcessKillPainfully(pid, true); + if (pidfile) + unlink(pidfile); + goto cleanup; +} + + +void +qemuVirtioFSStop(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainFSDefPtr fs) +{ + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + g_autofree char *pidfile =3D NULL; + virErrorPtr orig_err; + pid_t pid =3D -1; + int rc; + + virErrorPreserveLast(&orig_err); + + if (!(pidfile =3D qemuVirtioFSCreatePidFilename(cfg, vm->def, fs->info= .alias))) + goto cleanup; + + rc =3D virPidFileReadPathIfAlive(pidfile, &pid, NULL); + if (rc >=3D 0 && pid !=3D (pid_t) -1) + virProcessKillPainfully(pid, true); + + if (unlink(pidfile) < 0 && + errno !=3D ENOENT) { + virReportSystemError(errno, + _("Unable to remove stale pidfile %s"), + pidfile); + } + + if (QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock) + unlink(QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock); + + cleanup: + virErrorRestore(&orig_err); +} diff --git a/src/qemu/qemu_virtiofs.h b/src/qemu/qemu_virtiofs.h new file mode 100644 index 0000000000..49db807b19 --- /dev/null +++ b/src/qemu/qemu_virtiofs.h @@ -0,0 +1,38 @@ +/* + * qemu_virtiofs.h: virtiofs support + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#pragma once + + +char * +qemuVirtioFSCreatePidFilename(virQEMUDriverConfigPtr cfg, + const virDomainDef *def, + const char *alias); +char * +qemuVirtioFSCreateSocketFilename(virDomainObjPtr vm, + const char *alias); + +int +qemuVirtioFSStart(virLogManagerPtr logManager, + virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainFSDefPtr fs); +void +qemuVirtioFSStop(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainFSDefPtr fs); diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 038fd97580..abbc273889 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -496,6 +496,17 @@ testCompareXMLToArgv(const void *data) } } =20 + for (i =3D 0; i < vm->def->nfss; i++) { + virDomainFSDefPtr fs =3D vm->def->fss[i]; + char *s; + + if (fs->fsdriver !=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) + continue; + + s =3D g_strdup_printf("/tmp/lib/domain--1-guest/fs%zu.vhost-fs.soc= k", i); + QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock =3D s; + } + if (vm->def->vsock) { virDomainVsockDefPtr vsock =3D vm->def->vsock; qemuDomainVsockPrivatePtr vsockPriv =3D --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209323; cv=none; d=zohomail.com; s=zohoarc; b=dwd98vCxG+2rSDdt4TtXpRYMApjzMEUSmupv3ByoBrCuPgabJDwEbRZu6WiRe0o8z1NgGdIKBrkiKsXFxRzfmvccFClPO3Fyl9uk3QTfb4LTDE7MKOrGIDKaFB1B0Hnv1TtDodmcX9jXxhoiNFXjlCMHT4+15p1fEWx6F8c2B04= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209323; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rGK0mXQ+BeDcuP4i5KmdSkJDJtfORh9Q6RvWgSKpkKM=; b=k3wyt6jHvaiOPo7x6Hgk/K/xOvUWceXzaU3GYTcymxgIBic6e8cZm8XN99v9hRR0pVf1nvSL1kRrtCMn3A+sceW8I5tlan9AmKqJhBQkwwQDNwusxHzwy42nCvEEc806sULCYyUGSmXQLHvo2/DlSjpiJl9I1IiaDEQ5km6zg2A= 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 1582209323063753.2755695325296; Thu, 20 Feb 2020 06:35:23 -0800 (PST) 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-349-YGi-YO3pNFqrMbtPCqKRGg-1; Thu, 20 Feb 2020 09:33:51 -0500 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 D19DB18C43C5; Thu, 20 Feb 2020 14:33: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 A695B89F17; Thu, 20 Feb 2020 14:33: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 5C3D7180880C; Thu, 20 Feb 2020 14:33:44 +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 01KEX8cA021473 for ; Thu, 20 Feb 2020 09:33:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2E3B990F79; Thu, 20 Feb 2020 14:33:08 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id A717290F71 for ; Thu, 20 Feb 2020 14:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209322; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rGK0mXQ+BeDcuP4i5KmdSkJDJtfORh9Q6RvWgSKpkKM=; b=Jdj+0TdGaUAJMVpYCaz2f7rhDCkfEhQRhHIG2h44jryk2NFF+AOsX4t1FeHX5sjb0RmeYS YexdKwUp1Ig3wWrd6DVYe799uZNmAqKyyL0rEdcTZtNl7Op2ZgE0/Ejrs7x0Uu7vgqcOXy DfoS0l/PmpooSfbmDaOGGanACBj9Sn4= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 12/15] qemu: put virtiofsd in the emulator cgroup Date: Thu, 20 Feb 2020 15:32:49 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: YGi-YO3pNFqrMbtPCqKRGg-1 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" Wire up the code to put virtiofsd in the emulator cgroup on domain startup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_extdevice.c | 15 +++++++++++++++ src/qemu/qemu_virtiofs.c | 28 ++++++++++++++++++++++++++++ src/qemu/qemu_virtiofs.h | 6 ++++++ 3 files changed, 49 insertions(+) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 5103d4921c..31655b7f0a 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -248,6 +248,13 @@ qemuExtDevicesHasDevice(virDomainDefPtr def) if (def->tpm && def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) return true; =20 + for (i =3D 0; i < def->nfss; i++) { + virDomainFSDefPtr fs =3D def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) + return true; + } + return false; } =20 @@ -271,5 +278,13 @@ qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver, qemuExtTPMSetupCgroup(driver, def, cgroup) < 0) return -1; =20 + for (i =3D 0; i < def->nfss; i++) { + virDomainFSDefPtr fs =3D def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS && + qemuVirtioFSSetupCgroup(driver, def, fs, cgroup) < 0) + return -1; + } + return 0; } diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 600a3644bd..9e354a30c6 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -298,3 +298,31 @@ qemuVirtioFSStop(virQEMUDriverPtr driver, cleanup: virErrorRestore(&orig_err); } + + +int +qemuVirtioFSSetupCgroup(virQEMUDriverPtr driver, + virDomainDefPtr def, + virDomainFSDefPtr fs, + virCgroupPtr cgroup) +{ + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + g_autofree char *pidfile =3D NULL; + pid_t pid =3D -1; + int rc; + + if (!(pidfile =3D qemuVirtioFSCreatePidFilename(cfg, def, fs->info.ali= as))) + return -1; + + rc =3D virPidFileReadPathIfAlive(pidfile, &pid, NULL); + if (rc < 0 || pid =3D=3D (pid_t) -1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("virtiofsd died unexpectedly")); + return -1; + } + + if (virCgroupAddProcess(cgroup, pid) < 0) + return -1; + + return 0; +} diff --git a/src/qemu/qemu_virtiofs.h b/src/qemu/qemu_virtiofs.h index 49db807b19..341fed1def 100644 --- a/src/qemu/qemu_virtiofs.h +++ b/src/qemu/qemu_virtiofs.h @@ -36,3 +36,9 @@ void qemuVirtioFSStop(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainFSDefPtr fs); + +int +qemuVirtioFSSetupCgroup(virQEMUDriverPtr driver, + virDomainDefPtr def, + virDomainFSDefPtr fs, + virCgroupPtr cgroup); --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209313; cv=none; d=zohomail.com; s=zohoarc; b=FJw3bdGfL/ejD47vR/PsezLye+xt/Wmo1ITOhNAXjdwlLX+YHpfiFYHAjA8+lzz4S+VMgdPLy5pSUGLoBK30BAOFOi33+L2P/p3KMkSIkH1L4lx6HcHxQwAjWGwy1YFhMy4zydBc5CpYyZOAVAbaiDvUo92of6hLAnPn+mou6Uo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209313; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MJYJ4gNL98P1KwRp6UyK1kPE04Td0AIgRP6cqhA3+Uc=; b=BYmwSjbtuxnxifhjDv2ia5Ka+Bv5vJEevWT/4GyStD9wrI485SNPULDx5PmlMgAqfhQPwjm+xE1iZwZQ+TJUndeKPkbAxr/sfqgPY332HP4dfRYma5+RFH0N5JCnNTU4Uz8FB9MoZJICyN2Io83beW4wjuHcc+XsgAlIOvlUFOE= 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 1582209313719336.0674110907928; Thu, 20 Feb 2020 06:35:13 -0800 (PST) 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-236-rkktiHckOd6j2RyWBTVm6Q-1; Thu, 20 Feb 2020 09:33:55 -0500 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 6654CDB62; Thu, 20 Feb 2020 14:33: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 3BA055DA7C; Thu, 20 Feb 2020 14:33: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 E1F0486164; Thu, 20 Feb 2020 14:33:49 +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 01KEX970021488 for ; Thu, 20 Feb 2020 09:33:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 02E0690F79; Thu, 20 Feb 2020 14:33:09 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D6F290F71 for ; Thu, 20 Feb 2020 14:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209312; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MJYJ4gNL98P1KwRp6UyK1kPE04Td0AIgRP6cqhA3+Uc=; b=LdTRPCXptuEZCKvz2YBtj+YULlfcy85sYPj3rrq/yGZ2/5a3eEInWbeo/8HHu2XH5Xjd8j Elph90lPcbq1ssHFfh78vqdcsaIgOiXYpNBiuSmfDN91k1NNyLeeWZLGhu85ZlVHoeQhWh L4nCuQRGXFPq4znqTdNvaeymukpz1LY= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 13/15] qemu: use the vhost-user schemas to find binary Date: Thu, 20 Feb 2020 15:32:50 +0100 Message-Id: <31da98a51774cd923c5aab0665c9005e29d43d90.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: rkktiHckOd6j2RyWBTVm6Q-1 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" Look into /usr/share/qemu/vhost-user to see whether we can find a suitable virtiofsd binary, in case the user did not provide one in the domain XML. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- src/qemu/qemu_extdevice.c | 9 +++++++++ src/qemu/qemu_vhost_user.c | 40 ++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_vhost_user.h | 4 ++++ src/qemu/qemu_virtiofs.c | 11 +++++++++++ src/qemu/qemu_virtiofs.h | 4 ++++ 5 files changed, 68 insertions(+) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 31655b7f0a..699b4daade 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -105,6 +105,15 @@ qemuExtDevicesPrepareDomain(virQEMUDriverPtr driver, } } =20 + for (i =3D 0; i < vm->def->nfss; i++) { + virDomainFSDefPtr fs =3D vm->def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + if (qemuVirtioFSPrepareDomain(driver, fs) < 0) + return -1; + } + } + return ret; } =20 diff --git a/src/qemu/qemu_vhost_user.c b/src/qemu/qemu_vhost_user.c index 4c25b30664..d437fd1bd5 100644 --- a/src/qemu/qemu_vhost_user.c +++ b/src/qemu/qemu_vhost_user.c @@ -416,3 +416,43 @@ qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver, VIR_FREE(vus); return ret; } + + +int +qemuVhostUserFillDomainFS(virQEMUDriverPtr driver, + virDomainFSDefPtr fs) +{ + qemuVhostUserPtr *vus =3D NULL; + ssize_t nvus =3D 0; + ssize_t i; + int ret =3D -1; + + if ((nvus =3D qemuVhostUserFetchParsedConfigs(driver->privileged, + &vus, NULL)) < 0) + goto end; + + for (i =3D 0; i < nvus; i++) { + qemuVhostUserPtr vu =3D vus[i]; + + if (vu->type !=3D QEMU_VHOST_USER_TYPE_FS) + continue; + + g_free(fs->binary); + fs->binary =3D g_strdup(vu->binary); + break; + } + + if (i =3D=3D nvus) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("Unable to find a satisfying virtiofsd")); + goto end; + } + + ret =3D 0; + + end: + for (i =3D 0; i < nvus; i++) + qemuVhostUserFree(vus[i]); + g_free(vus); + return ret; +} diff --git a/src/qemu/qemu_vhost_user.h b/src/qemu/qemu_vhost_user.h index 369ba00caa..e505c8a473 100644 --- a/src/qemu/qemu_vhost_user.h +++ b/src/qemu/qemu_vhost_user.h @@ -45,3 +45,7 @@ qemuVhostUserFetchConfigs(char ***configs, int qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver, virDomainVideoDefPtr video); + +int +qemuVhostUserFillDomainFS(virQEMUDriverPtr driver, + virDomainFSDefPtr fs); diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 9e354a30c6..b53e5b0806 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -28,6 +28,7 @@ #include "qemu_conf.h" #include "qemu_extdevice.h" #include "qemu_security.h" +#include "qemu_vhost_user.h" #include "qemu_virtiofs.h" #include "virpidfile.h" =20 @@ -326,3 +327,13 @@ qemuVirtioFSSetupCgroup(virQEMUDriverPtr driver, =20 return 0; } + +int +qemuVirtioFSPrepareDomain(virQEMUDriverPtr driver, + virDomainFSDefPtr fs) +{ + if (fs->binary) + return 0; + + return qemuVhostUserFillDomainFS(driver, fs); +} diff --git a/src/qemu/qemu_virtiofs.h b/src/qemu/qemu_virtiofs.h index 341fed1def..b70b2f1b6a 100644 --- a/src/qemu/qemu_virtiofs.h +++ b/src/qemu/qemu_virtiofs.h @@ -42,3 +42,7 @@ qemuVirtioFSSetupCgroup(virQEMUDriverPtr driver, virDomainDefPtr def, virDomainFSDefPtr fs, virCgroupPtr cgroup); + +int +qemuVirtioFSPrepareDomain(virQEMUDriverPtr driver, + virDomainFSDefPtr fs); --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209240; cv=none; d=zohomail.com; s=zohoarc; b=nm9oTt5uXxtUKq8sTQXk1azQ/NRjbDX7bV2FSuYIAGDWOwUrFA99hDGill9uNARJYB9LGalvezGwMXVBbbmLvcoNkH8jkekaiGN9OMO2YZLRXUaJAx13AVcx8FttjgHUcx0MUhecb5obbzsdUqtWY8ne3j8+ASVZDbOkcAz3jV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209240; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c4ccvLWgK4+l1mjY/CF3uPi/iB4Vv/nNx55LsEijoEs=; b=HbsvzunP0Uu72x+s8I2LV0UnUxgBpDRGPgD2pxWlUWxR44SZ9qhbqygBgTEpSYpFWGBlt0piRlImFXKIE41Sb6YThv9ZKGO9RCcOajjdw3sqsqOfTycvbDvJbW9vnb5vxyy5Md+ZpAGYMlURDq8YfY4WiV/pi77XvA92RxEt2M4= 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 158220924012530.94591137358543; Thu, 20 Feb 2020 06:34:00 -0800 (PST) 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-412-ZJ2vWWrxPm-shoKOV22fKg-1; Thu, 20 Feb 2020 09:33:55 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B209B101FC66; Thu, 20 Feb 2020 14:33:48 +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 865121001B2C; Thu, 20 Feb 2020 14:33:48 +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 37C9F180203B; Thu, 20 Feb 2020 14:33:48 +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 01KEX9Bx021499 for ; Thu, 20 Feb 2020 09:33:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id CD5E190F71; Thu, 20 Feb 2020 14:33:09 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52B5290F7B for ; Thu, 20 Feb 2020 14:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209238; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=c4ccvLWgK4+l1mjY/CF3uPi/iB4Vv/nNx55LsEijoEs=; b=AIsxObSEfl6DAwIigsAno9fLK+J9hqnuplJDtCFgzzjKJ5UsRUW7Uy4H6d3WrCxxa1aflf Oa3ykgbON746D95f+gE8jjXdf9dD5Fuea3R7ByBDpeLzwBBIfj1klCCPwJqV2X5VtfpwY/ yDbw3OQ3+5ACRer2WGWF9VaGtJMrY3k= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 14/15] qemu: build vhost-user-fs device command line Date: Thu, 20 Feb 2020 15:32:51 +0100 Message-Id: <0cb4b6b2c49694c7abf4675df28b0e7aac956c21.1582207771.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: ZJ2vWWrxPm-shoKOV22fKg-1 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" Format the 'vhost-user-fs' device on the QEMU command line. This device provides shared file system access using the FUSE protocol carried over virtio. The actual file server is implemented in an external vhost-user-fs device backend process. https://bugzilla.redhat.com/show_bug.cgi?id=3D1694166 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_command.c | 45 +++++++++++++++++- ...vhost-user-fs-fd-memory.x86_64-latest.args | 39 +++++++++++++++ ...vhost-user-fs-hugepages.x86_64-latest.args | 47 +++++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ 4 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-l= atest.args create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-l= atest.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9fcd06f8c3..272a0b8d44 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2574,6 +2574,45 @@ qemuBuildDisksCommandLine(virCommandPtr cmd, } =20 =20 +static int +qemuBuildVHostUserFsCommandLine(virCommandPtr cmd, + virDomainFSDef *fs, + const virDomainDef *def, + qemuDomainObjPrivatePtr priv) +{ + g_autofree char *chardev_alias =3D NULL; + g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; + + chardev_alias =3D g_strdup_printf("chr-vu-%s", fs->info.alias); + + virCommandAddArg(cmd, "-chardev"); + virBufferAddLit(&opt, "socket"); + virBufferAsprintf(&opt, ",id=3D%s", chardev_alias); + virBufferEscapeString(&opt, ",path=3D%s", QEMU_DOMAIN_FS_PRIVATE(fs)->= vhostuser_fs_sock); + virCommandAddArg(cmd, virBufferContentAndReset(&opt)); + + virCommandAddArg(cmd, "-device"); + + if (qemuBuildVirtioDevStr(&opt, "vhost-user-fs", priv->qemuCaps, + VIR_DOMAIN_DEVICE_FS, fs) < 0) + return -1; + + virBufferAsprintf(&opt, ",chardev=3D%s", chardev_alias); + if (fs->queue_size) + virBufferAsprintf(&opt, ",queue-size=3D%llu", fs->queue_size); + virBufferAddLit(&opt, ",tag=3D"); + virQEMUBuildBufferEscapeComma(&opt, fs->dst); + if (qemuBuildVirtioOptionsStr(&opt, fs->virtio, priv->qemuCaps) < 0) + return -1; + + if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, priv->qemuCaps) < = 0) + return -1; + + virCommandAddArg(cmd, virBufferContentAndReset(&opt)); + return 0; +} + + static char * qemuBuildFSStr(virDomainFSDefPtr fs) { @@ -2666,7 +2705,7 @@ static int qemuBuildFilesystemCommandLine(virCommandPtr cmd, const virDomainDef *def, virQEMUCapsPtr qemuCaps, - qemuDomainObjPrivatePtr priv G_GNUC_UNUSED) + qemuDomainObjPrivatePtr priv) { size_t i; =20 @@ -2681,7 +2720,9 @@ qemuBuildFilesystemCommandLine(virCommandPtr cmd, break; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: - /* TODO: vhost-user-fs-pci */ + /* vhost-user-fs-pci */ + if (qemuBuildVHostUserFsCommandLine(cmd, def->fss[i], def, pri= v) < 0) + return -1; break; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP: diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.a= rgs b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args new file mode 100644 index 0000000000..a7df45a7f0 --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args @@ -0,0 +1,39 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-guest \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-guest/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-guest/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dguest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-guest/master-key.aes \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ +-m 14336 \ +-overcommit mem-lock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-object memory-backend-file,id=3Dram-node0,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-guest/ram-node0,share= =3Dyes,\ +size=3D15032385536 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ +-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-chardev socket,id=3Dchr-vu-fs0,path=3D/tmp/lib/domain--1-guest/fs0.vhost-= fs.sock \ +-device vhost-user-fs-pci,chardev=3Dchr-vu-fs0,queue-size=3D1024,tag=3Dmou= nt_tag,\ +bus=3Dpci.0,addr=3D0x2 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.a= rgs b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args new file mode 100644 index 0000000000..39190b8d3e --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args @@ -0,0 +1,47 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-guest \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-guest/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-guest/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dguest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-guest/master-key.aes \ +-machine q35,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ +-m 2048 \ +-overcommit mem-lock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-object memory-backend-file,id=3Dram-node0,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-guest,share=3Dyes,size=3D21474= 83648 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult= ifunction=3Don,\ +addr=3D0x1 \ +-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr= =3D0x1.0x1 \ +-device pcie-root-port,port=3D0xa,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr= =3D0x1.0x2 \ +-device pcie-root-port,port=3D0xb,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr= =3D0x1.0x3 \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/guest.qcow= 2",\ +"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qco= w2",\ +"file":"libvirt-1-storage"}' \ +-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.4,addr=3D0x0,drive=3Dlibvirt-1= -format,\ +id=3Dvirtio-disk0,bootindex=3D1 \ +-chardev socket,id=3Dchr-vu-fs0,path=3D/tmp/lib/domain--1-guest/fs0.vhost-= fs.sock \ +-device vhost-user-fs-pci,chardev=3Dchr-vu-fs0,tag=3Dmount_tag,bus=3Dpci.1= ,addr=3D0x0 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index abbc273889..35d413d40b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3061,6 +3061,9 @@ mymain(void) =20 DO_TEST_CAPS_VER("launch-security-sev", "2.12.0"); =20 + DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory"); + DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages"); + DO_TEST("riscv64-virt", QEMU_CAPS_DEVICE_VIRTIO_MMIO); DO_TEST("riscv64-virt-pci", --=20 2.24.1 From nobody Sun Apr 28 21:29:27 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=1582209223; cv=none; d=zohomail.com; s=zohoarc; b=OlTTrBNkk8sCtqs0XbMMDw2WIQWY8owbQPw1oMkTrTR/9U3o/cfM1XT6y1S/lcAXtigaZFSmUzu0XZTQwfn9ZRqV5SKvCYK3Ac++oz0s8pvzOLtnDCtuO1GYwv62YX2ET5iISvTfwEhD7vhYPUV+X2FFnK/G37zmqCOZo2RoiWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582209223; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eLShON6VWhzGNVGRydVEFWpGdi2Lf1boMDnjYWfaScA=; b=Qt+nWKmrdcBzPzKFTthqr7ex9qTm9pqD5+dXNtLQRl/8OHPEwpwFwov5S3a4Afy8bxL1TbLLGtbHdkOJKcBqkNeqRry8QGOTSAjIOH6jesyBGO/uky9ReSZt5shdygRmv1Lctumv2TDole5Fnu3k62DJBravEQkZKzq5AxMUB8A= 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 158220922373192.62322090010571; Thu, 20 Feb 2020 06:33:43 -0800 (PST) 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-89-BUy5X7MsOOO_nkaPz22smQ-1; Thu, 20 Feb 2020 09:33:38 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 27D50477; Thu, 20 Feb 2020 14:33:32 +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 ED2D790F7C; Thu, 20 Feb 2020 14:33:31 +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 9F5D78B2DE; Thu, 20 Feb 2020 14:33:31 +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 01KEXA3C021506 for ; Thu, 20 Feb 2020 09:33:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id A460690F79; Thu, 20 Feb 2020 14:33:10 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28E4D90F7F for ; Thu, 20 Feb 2020 14:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582209222; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eLShON6VWhzGNVGRydVEFWpGdi2Lf1boMDnjYWfaScA=; b=LaugsRanzoBQiTJSdcr8xYTPVvm8kCh4TTpInvZME7G4UqU9lmEEyi/TOFo0NM+XjUes2e bT7BUR6a+Zu4IL1nQh0WhsR3bCRPZz8lILWGjQ8lhegdkDEWVfQmPaw7AXp8M0/sx8Rjti nUEa/6GyAoQjMskmtlWIXxiooyusWBc= X-MC-Unique: BUy5X7MsOOO_nkaPz22smQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv4 15/15] wip: SELinux integration for virtiofsd Date: Thu, 20 Feb 2020 15:32:52 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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" This patch attempts to run virtiofsd with libvirtd's label and the category of the currently ran domain, which obviously does nothing without a corresponding policy. Per: https://www.redhat.com/archives/libvir-list/2020-February/msg00108.html a new type might be needed. TODO: file a SELinux policy bug --- src/libvirt_private.syms | 1 + src/qemu/qemu_security.c | 40 +++++++++++++++++++ src/qemu/qemu_security.h | 7 ++++ src/qemu/qemu_virtiofs.c | 4 +- src/security/security_dac.c | 20 ++++++++++ src/security/security_driver.h | 2 + src/security/security_manager.c | 12 ++++++ src/security/security_manager.h | 4 ++ src/security/security_nop.c | 1 + src/security/security_selinux.c | 69 +++++++++++++++++++++++++++++++++ src/security/security_stack.c | 19 +++++++++ 11 files changed, 178 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 49eb8ab7cb..aaba15297a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1504,6 +1504,7 @@ virSecurityManagerSetSavedStateLabel; virSecurityManagerSetSocketLabel; virSecurityManagerSetTapFDLabel; virSecurityManagerSetTPMLabels; +virSecurityManagerSetVirtioFSProcessLabel; virSecurityManagerStackAddNested; virSecurityManagerTransactionAbort; virSecurityManagerTransactionCommit; diff --git a/src/qemu/qemu_security.c b/src/qemu/qemu_security.c index 2aa2b5b9c6..834556c910 100644 --- a/src/qemu/qemu_security.c +++ b/src/qemu/qemu_security.c @@ -475,6 +475,46 @@ qemuSecurityStartVhostUserGPU(virQEMUDriverPtr driver, } =20 =20 +/* + * qemuSecurityStartVhostUserGPU: + * + * @driver: the QEMU driver + * @vm: the domain object + * @cmd: the command to run + * @existstatus: pointer to int returning exit status of process + * @cmdret: pointer to int returning result of virCommandRun + * + * Start the vhost-user-gpu process with approriate labels. + * This function returns -1 on security setup error, 0 if all the + * setup was done properly. In case the virCommand failed to run + * 0 is returned but cmdret is set appropriately with the process + * exitstatus also set. + */ +int +qemuSecurityStartVirtioFS(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virCommandPtr cmd, + int *exitstatus, + int *cmdret) +{ + if (virSecurityManagerSetVirtioFSProcessLabel(driver->securityManager, + vm->def, cmd) < 0) + return -1; + + if (virSecurityManagerPreFork(driver->securityManager) < 0) + return -1; + + *cmdret =3D virCommandRun(cmd, exitstatus); + + virSecurityManagerPostFork(driver->securityManager); + + if (*cmdret < 0) + return -1; + + return 0; +} + + /* * qemuSecurityStartTPMEmulator: * diff --git a/src/qemu/qemu_security.h b/src/qemu/qemu_security.h index a8c648ece1..dbb3bdbc9b 100644 --- a/src/qemu/qemu_security.h +++ b/src/qemu/qemu_security.h @@ -84,6 +84,13 @@ int qemuSecurityStartVhostUserGPU(virQEMUDriverPtr drive= r, int *exitstatus, int *cmdret); =20 +int qemuSecurityStartVirtioFS(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virCommandPtr cmd, + int *exitstatus, + int *cmdret); + + int qemuSecurityStartTPMEmulator(virQEMUDriverPtr driver, virDomainObjPtr vm, virCommandPtr cmd, diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index b53e5b0806..17afe27535 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -34,6 +34,7 @@ =20 #define VIR_FROM_THIS VIR_FROM_QEMU =20 +VIR_LOG_INIT("qemu.virtiofs"); =20 char * qemuVirtioFSCreatePidFilename(virQEMUDriverConfigPtr cfg, @@ -227,7 +228,8 @@ qemuVirtioFSStart(virLogManagerPtr logManager, if (qemuExtDeviceLogCommand(driver, vm, cmd, "virtiofsd") < 0) goto cleanup; =20 - rc =3D virCommandRun(cmd, NULL); + if (qemuSecurityStartVirtioFS(driver, vm, cmd, NULL, &rc) < 0) + goto error; =20 if (rc < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/security/security_dac.c b/src/security/security_dac.c index d75b18170b..64e00b0127 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -2263,6 +2263,24 @@ virSecurityDACSetChildProcessLabel(virSecurityManage= rPtr mgr, if (virSecurityDACGetIds(secdef, priv, &user, &group, NULL, NULL) < 0) return -1; =20 + VIR_DEBUG("Setting child to drop privileges to %u:%u", + (unsigned int)user, (unsigned int)group); + + virCommandSetUID(cmd, user); + virCommandSetGID(cmd, group); + return 0; +} + + +static int +virSecurityDACSetVirtioFSProcessLabel(virSecurityManagerPtr mgr G_GNUC_UNU= SED, + virDomainDefPtr def G_GNUC_UNUSED, + virCommandPtr cmd) +{ + /* only running as root:root is supported */ + uid_t user =3D 0; + gid_t group =3D 0; + VIR_DEBUG("Setting child to drop privileges to %u:%u", (unsigned int)user, (unsigned int)group); =20 @@ -2581,4 +2599,6 @@ virSecurityDriver virSecurityDriverDAC =3D { =20 .domainSetSecurityChardevLabel =3D virSecurityDACSetChardevLabel, .domainRestoreSecurityChardevLabel =3D virSecurityDACRestoreChardevLa= bel, + + .domainSetSecurityVirtioFSProcessLabel =3D virSecurityDACSetVirtioFSPr= ocessLabel, }; diff --git a/src/security/security_driver.h b/src/security/security_driver.h index 3353955813..d145922198 100644 --- a/src/security/security_driver.h +++ b/src/security/security_driver.h @@ -217,6 +217,8 @@ struct _virSecurityDriver { =20 virSecurityDomainSetTPMLabels domainSetSecurityTPMLabels; virSecurityDomainRestoreTPMLabels domainRestoreSecurityTPMLabels; + + virSecurityDomainSetChildProcessLabel domainSetSecurityVirtioFSProcess= Label; }; =20 virSecurityDriverPtr virSecurityDriverLookup(const char *name, diff --git a/src/security/security_manager.c b/src/security/security_manage= r.c index fe9def7fb9..13e6380ed6 100644 --- a/src/security/security_manager.c +++ b/src/security/security_manager.c @@ -945,6 +945,18 @@ virSecurityManagerSetChildProcessLabel(virSecurityMana= gerPtr mgr, } =20 =20 +int virSecurityManagerSetVirtioFSProcessLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virCommandPtr cmd) +{ + if (mgr->drv->domainSetSecurityVirtioFSProcessLabel) + return mgr->drv->domainSetSecurityVirtioFSProcessLabel(mgr, def, cm= d); + + virReportUnsupportedError(); + return -1; +} + + int virSecurityManagerVerify(virSecurityManagerPtr mgr, virDomainDefPtr def) diff --git a/src/security/security_manager.h b/src/security/security_manage= r.h index f835356b7e..0465f99203 100644 --- a/src/security/security_manager.h +++ b/src/security/security_manager.h @@ -137,6 +137,10 @@ int virSecurityManagerSetProcessLabel(virSecurityManag= erPtr mgr, int virSecurityManagerSetChildProcessLabel(virSecurityManagerPtr mgr, virDomainDefPtr def, virCommandPtr cmd); +int virSecurityManagerSetVirtioFSProcessLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virCommandPtr cmd); + int virSecurityManagerVerify(virSecurityManagerPtr mgr, virDomainDefPtr def); int virSecurityManagerSetImageFDLabel(virSecurityManagerPtr mgr, diff --git a/src/security/security_nop.c b/src/security/security_nop.c index c1856eb421..f783bfa7ee 100644 --- a/src/security/security_nop.c +++ b/src/security/security_nop.c @@ -328,4 +328,5 @@ virSecurityDriver virSecurityDriverNop =3D { =20 .domainSetSecurityChardevLabel =3D virSecurityDomainSetChardevLab= elNop, .domainRestoreSecurityChardevLabel =3D virSecurityDomainRestoreCharde= vLabelNop, + .domainSetSecurityVirtioFSProcessLabel =3D virSecurityDomainSetChildPr= ocessLabelNop, }; diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index 3f6968a57a..853f5beb67 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -2941,6 +2941,73 @@ virSecuritySELinuxSetChildProcessLabel(virSecurityMa= nagerPtr mgr G_GNUC_UNUSED, return 0; } =20 +static int +virSecuritySELinuxSetVirtioFSProcessLabel(virSecurityManagerPtr mgr G_GNUC= _UNUSED, + virDomainDefPtr def, + virCommandPtr cmd) +{ + virSecurityLabelDefPtr secdef; + security_context_t daemon_ctx; + g_auto(GStrv) daemon_label =3D NULL; + g_auto(GStrv) domain_label =3D NULL; + g_autofree char *frankenlabel =3D NULL; + + VIR_ERROR("WE got here"); + + secdef =3D virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME); + if (!secdef || !secdef->label) + return 0; + + if (getcon_raw(&daemon_ctx) =3D=3D -1) { + virReportSystemError(errno, "%s", + _("unable to get security context")); + return -1; + } + + VIR_ERROR("domain_label=3D%s daemon_label=3D%s", secdef->label, (char = *)daemon_ctx); + + daemon_label =3D g_strsplit((char *)daemon_ctx, ":", 6); + domain_label =3D g_strsplit((char *)secdef->label, ":", 6); + + freecon(daemon_ctx); + + if (STRNEQ(SECURITY_SELINUX_NAME, secdef->model)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label driver mismatch: " + "'%s' model configured for domain, but " + "hypervisor driver is '%s'."), + secdef->model, SECURITY_SELINUX_NAME); + if (security_getenforce() =3D=3D 1) + return -1; + } + + if (!domain_label || !daemon_label || + g_strv_length(domain_label) !=3D 5 || g_strv_length(daemon_label) = !=3D 5) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed security label")); + return -1; + } + + frankenlabel =3D g_strdup_printf("%s:%s:%s:%s:%s", + daemon_label[0], + daemon_label[1], + daemon_label[2], + domain_label[3], + domain_label[4]); + + VIR_ERROR("frankenlabel=3D%s", frankenlabel); + + if (strlen(frankenlabel) >=3D VIR_SECURITY_LABEL_BUFLEN) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label exceeds maximum length: %d"), + VIR_SECURITY_LABEL_BUFLEN - 1); + return -1; + } + + virCommandSetSELinuxLabel(cmd, frankenlabel); + return 0; +} + static int virSecuritySELinuxSetDaemonSocketLabel(virSecurityManagerPtr mgr G_GNUC_UN= USED, virDomainDefPtr def) @@ -3576,4 +3643,6 @@ virSecurityDriver virSecurityDriverSELinux =3D { =20 .domainSetSecurityTPMLabels =3D virSecuritySELinuxSetTPMLabels, .domainRestoreSecurityTPMLabels =3D virSecuritySELinuxRestoreTPMLa= bels, + + .domainSetSecurityVirtioFSProcessLabel =3D virSecuritySELinuxSetVirtio= FSProcessLabel, }; diff --git a/src/security/security_stack.c b/src/security/security_stack.c index 073876daff..28982b4ba1 100644 --- a/src/security/security_stack.c +++ b/src/security/security_stack.c @@ -476,6 +476,23 @@ virSecurityStackSetChildProcessLabel(virSecurityManage= rPtr mgr, return rc; } =20 +static int +virSecurityStackSetVirtioFSProcessLabel(virSecurityManagerPtr mgr, + virDomainDefPtr vm, + virCommandPtr cmd) +{ + virSecurityStackDataPtr priv =3D virSecurityManagerGetPrivateData(mgr); + virSecurityStackItemPtr item =3D priv->itemsHead; + int rc =3D 0; + + for (; item; item =3D item->next) { + if (virSecurityManagerSetVirtioFSProcessLabel(item->securityManage= r, vm, cmd) < 0) + rc =3D -1; + } + + return rc; +} + static int virSecurityStackGetProcessLabel(virSecurityManagerPtr mgr, virDomainDefPtr vm, @@ -991,4 +1008,6 @@ virSecurityDriver virSecurityDriverStack =3D { =20 .domainSetSecurityTPMLabels =3D virSecurityStackSetTPMLabels, .domainRestoreSecurityTPMLabels =3D virSecurityStackRestoreTPMLabe= ls, + + .domainSetSecurityVirtioFSProcessLabel =3D virSecurityStackSetVirtioFS= ProcessLabel, }; --=20 2.24.1