From nobody Tue Apr 30 03:49:07 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=1579801603; cv=none; d=zohomail.com; s=zohoarc; b=XJWq7NcLlrjWzDe1L1TOsx+DMXO0lIJ9WqW646GdYg76brJE0Y0I1Fio7EP0kjyRVE3qpXMQoQBZDetSZVBUjE5lNrdJczhSC88cLnXIxDSLO9JHEeNQu5Yb46DRWHPLd7ogoMI4JECihEge3QsARSphaKG2YFlAlsOojjQEVLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801603; 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=AjovZydJx+MxDrObSThqXD6CRaNTq3uH6EWtsJQ26V4=; b=CVaymdkQak92Fj7yuDrpFKiAOwX8YuLWiO6BLk1vuGkh+PSjzFSwCjJf3xD03DQzFaA6D3oQT5iAj1cc9zQhvtV03J6MgVs7Y0Ln3uCtEgibUjV3WqvgBW4TrDBvOXZQjg0uNkuaLvdZBTPV9DxhSe6BLK73TJrbq3Q6QPxXaZA= 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 1579801603312112.41315651836476; Thu, 23 Jan 2020 09:46: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-245-CmEwPC_AO_uN0nWfodkFzw-1; Thu, 23 Jan 2020 12:46:29 -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 9BC841800D78; Thu, 23 Jan 2020 17:46:21 +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 815F73B0; Thu, 23 Jan 2020 17:46:20 +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 4E4A48594E; Thu, 23 Jan 2020 17:46:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkHi6020876 for ; Thu, 23 Jan 2020 12:46:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1FEC05D9E2; Thu, 23 Jan 2020 17:46:17 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E34E5DA87 for ; Thu, 23 Jan 2020 17:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801602; 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=AjovZydJx+MxDrObSThqXD6CRaNTq3uH6EWtsJQ26V4=; b=io1NmUGQMaaAVG/C6tkjF1dzGwipTczM1OWRYRAOebg+A4w8cXOkiJ1h7YvqZGenAllUlt OlzbnQfSuJDObTRyH00khmFUuOnv2etNstq3gIFluQKXP8r+AMN+Jy2wSooa3RAI8B87tn k07lx94sles1O1h03e2yxAoFVUe1LUo= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 01/10] conf: use virXMLFormatElement in virDomainFSDefFormat Date: Thu, 23 Jan 2020 18:46:02 +0100 Message-Id: <13043555377a88e4199cd7fc046a825e3e2346b8.1579801508.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: CmEwPC_AO_uN0nWfodkFzw-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" Use the virXMLFormatElement helper to format the driver element to simplify adding further sub-elements. Signed-off-by: J=C3=A1n Tomko Acked-by: Stefan Hajnoczi Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 707d58e1a4..6deb8e5434 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24996,7 +24996,7 @@ virDomainFSDefFormat(virBufferPtr buf, const char *fsdriver =3D virDomainFSDriverTypeToString(def->fsdriver); const char *wrpolicy =3D virDomainFSWrpolicyTypeToString(def->wrpolicy= ); const char *src =3D def->src->path; - g_auto(virBuffer) driverBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) driverAttrBuf =3D VIR_BUFFER_INITIALIZER; =20 if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -25021,25 +25021,21 @@ virDomainFSDefFormat(virBufferPtr buf, =20 virBufferAdjustIndent(buf, 2); if (def->fsdriver) { - virBufferAsprintf(&driverBuf, " type=3D'%s'", fsdriver); + virBufferAsprintf(&driverAttrBuf, " type=3D'%s'", fsdriver); =20 if (def->format) - virBufferAsprintf(&driverBuf, " format=3D'%s'", + virBufferAsprintf(&driverAttrBuf, " format=3D'%s'", virStorageFileFormatTypeToString(def->format= )); =20 /* Don't generate anything if wrpolicy is set to default */ if (def->wrpolicy) - virBufferAsprintf(&driverBuf, " wrpolicy=3D'%s'", wrpolicy); + virBufferAsprintf(&driverAttrBuf, " wrpolicy=3D'%s'", wrpolicy= ); =20 } =20 - virDomainVirtioOptionsFormat(&driverBuf, def->virtio); + virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio); =20 - if (virBufferUse(&driverBuf)) { - virBufferAddLit(buf, "\n"); - } + virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL); =20 switch (def->type) { case VIR_DOMAIN_FS_TYPE_MOUNT: --=20 2.21.0 From nobody Tue Apr 30 03:49:07 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=1579801703; cv=none; d=zohomail.com; s=zohoarc; b=D9Rgns0QnP8qLh+ye8o6oodpq+utrTKGkfJjobJ4yvUYzy7qqFt0YjPXU5IQYK3wkTD729PJzYDtanocWoNsQXJX4bNLilrVCAf9J75tRde27iB9M8yPpFKSK7eeQoFFbTjFpxiS6RmkXdQFAK6CaOsyYnMXYiY8uSxUG48hR10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801703; 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=9DpeqHLI9GOpYzIbsbsBYC5ytMXMd+te9FKn6hFf/lM=; b=fKQAL1zDQpUeU+i8o5c4J4/HpyUs/aHa+hww/N9XYSphuRX7YLmaRVQlyDo1foph7+cFgt9VmjzRWX0vJfKNA6FCTc/cPG5WCtXLb5H4J/pXQwxGi65LB82ACBwqFUJKYBeHk+TrxcwX8UxUPmLMIMgWKvb7XZ6ywyMix++jJc8= 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 1579801703440542.5293975168285; Thu, 23 Jan 2020 09:48: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-148-QEuWT9HuOSGl5DWO27iJKw-1; Thu, 23 Jan 2020 12:46:27 -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 9853F10054E3; Thu, 23 Jan 2020 17:46:21 +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 C34EF100164D; Thu, 23 Jan 2020 17:46:20 +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 697AD18089CD; Thu, 23 Jan 2020 17:46:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkHZL020884 for ; Thu, 23 Jan 2020 12:46:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id E34E65DA2C; Thu, 23 Jan 2020 17:46:17 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C81D5D9E2 for ; Thu, 23 Jan 2020 17:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801702; 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=9DpeqHLI9GOpYzIbsbsBYC5ytMXMd+te9FKn6hFf/lM=; b=OhZkk/TTaRWCIYCaKRgNY4rBWLG0POgKFL0oNawAI8GrgCV8DyiACtucLzwpjEjAQ7aTdV xHcgTSPmICu2k0sxtFsyB+3bm/L1sefB/gIGVBWtiXNUgBVcjHa5zRovNcjXPJpjBiNmZg P28SlEkPIr6h7KXmsq9SJU+EUOlvR3I= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 02/10] qemu: add QEMU_CAPS_VHOST_USER_FS Date: Thu, 23 Jan 2020 18:46:03 +0100 Message-Id: <55246560a591ed056b3a385897a14f70c9c860cb.1579801508.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: QEuWT9HuOSGl5DWO27iJKw-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" 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 Acked-by: Stefan Hajnoczi Reviewed-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + 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 + 5 files changed, 6 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 17b0134ab8..425e7d2fb9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -557,6 +557,7 @@ VIR_ENUM_IMPL(virQEMUCaps, =20 /* 350 */ "i8042", + "vhost-user-fs", ); =20 =20 @@ -1249,6 +1250,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "ramfb", QEMU_CAPS_DEVICE_RAMFB }, { "max-arm-cpu", QEMU_CAPS_ARM_MAX_CPU }, { "i8042", QEMU_CAPS_DEVICE_I8042 }, + { "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 ebfdb4b981..7963514a40 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -538,6 +538,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ =20 /* 350 */ QEMU_CAPS_DEVICE_I8042, /* PS/2 controller */ + QEMU_CAPS_DEVICE_VHOST_USER_FS, /* -device vhost-user-fs */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_4.2.0.aarch64.xml index 184bb7ff77..ef058266a4 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -176,6 +176,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 c8746f05ef..49963b7020 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -136,6 +136,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 c41df184be..f971021c8a 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -220,6 +220,7 @@ + 4002000 0 43100242 --=20 2.21.0 From nobody Tue Apr 30 03:49:07 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=1579801600; cv=none; d=zohomail.com; s=zohoarc; b=Epb7bCMmrm5Lhw5cDhNnnkZCKg9+DqSZL/9PBZjRcmP2d9zELIAFlT9b6qvMZJfM/7SoT2od4AIAJghByBu/zNuZf+o9Tb0Ge2+8NQPK1n7PKphQuqQ9/QuGJqBJKJ2Jjwy/LyWNdQyKlVjsDxpBQug6wClMtogX0sGmnmj+Ozo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801600; 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=B5GYf4avbhn1eFjkJyD93kaL83x7L3XhXC8Z8wPs4TU=; b=NaM8Dm3Zk/s0Ml+CgeY+bFi1Fb19sF9HnM08UK7hn1YtY7+T2BjHsdXKXX+niab0M73KH4RaTGxSXenjWCsIsKso3Km1LILFb6S/cxdybQbE0F3cr62+TrfuEBN5+WduLeXmgW2WFTa7/UXQ494snrJNL3wx4kWRWXB5YCkqdJc= 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 1579801600319631.5603479408941; Thu, 23 Jan 2020 09:46:40 -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-175-G7RvTtqZPF6AT0UhhtSFOA-1; Thu, 23 Jan 2020 12:46:37 -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 896401882CCC; Thu, 23 Jan 2020 17:46:28 +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 628C85C1BB; Thu, 23 Jan 2020 17:46:28 +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 165F718089D6; Thu, 23 Jan 2020 17:46:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkIvi020894 for ; Thu, 23 Jan 2020 12:46:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id AFD565DA2C; Thu, 23 Jan 2020 17:46:18 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A67D5D9E2 for ; Thu, 23 Jan 2020 17:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801599; 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=B5GYf4avbhn1eFjkJyD93kaL83x7L3XhXC8Z8wPs4TU=; b=WZUwHY/k7SxXD0Lg9iy62IOIaQEaHP9wlxLsjpq8fIovCSQihy/yrzIBzTZjzxuZYcuNf0 DqrmXMJyKIoH7Lu5DWih8BTf5lHRT1GsSFm9rL4FXCjn/ohsfXUzUMLSygwzg+YMOB8yJQ E0T2vOabDk3TLzstUy0Dl3MPaQ0r3Mc= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 03/10] schema: wrap fsDriver in a choice group Date: Thu, 23 Jan 2020 18:46:04 +0100 Message-Id: <0ce39a91742c8594c3eb4451719e7be84a7b65f0.1579801508.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: G7RvTtqZPF6AT0UhhtSFOA-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 Acked-by: Stefan Hajnoczi Reviewed-by: Peter Krempa --- 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 76d94b156f..04854bf816 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2600,29 +2600,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.21.0 From nobody Tue Apr 30 03:49:07 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=1579801647; cv=none; d=zohomail.com; s=zohoarc; b=m2Ib6kYzbUcOtlXO0AUdswRb72xnKQMh04Mx4Lwrb8DBGQL+TMkN4eOVPd7j7XWRA/u62SzWCxCQrMibz+NXZYHid41o1nU6J9sNcJvKxzNfrMaPp+voqMXLTF3pZpUkDZpfgQTLFZSW6b4L5lCRyjwbvqu11xOQUYfldUCI13g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801647; 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=XrIsdc/b3pbq6ag5M4EZ3t3hT36WOLtH0/Y0D/D3DyE=; b=ntmdDYgnrfFyr4eOBAKt3p2mJksnHnRy37C5oLn5zKd4VdlFI11YIbQTRm5aYv81187HNjQqDXXnr1WyKmaE80NBFDiFlAWzkrIEM7/exOgSKLIEieqI/LIHVRzEzMXlQrRPRgYVePGyu70NzdYvUIySvJyI+3ocoeOiF2TSDiI= 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 1579801647215206.20458666419427; Thu, 23 Jan 2020 09:47:27 -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-207-jYqoXaD1OXa3sOuZsAJzMA-1; Thu, 23 Jan 2020 12:46:39 -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 20F45107ACCA; Thu, 23 Jan 2020 17:46:32 +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 EC3DD5C298; Thu, 23 Jan 2020 17:46: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 9DD231808855; Thu, 23 Jan 2020 17:46:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkJlU020905 for ; Thu, 23 Jan 2020 12:46:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7C5AF5DA2C; Thu, 23 Jan 2020 17:46:19 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 074575D9E2 for ; Thu, 23 Jan 2020 17:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801645; 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=XrIsdc/b3pbq6ag5M4EZ3t3hT36WOLtH0/Y0D/D3DyE=; b=fdvup9o2jkP3ObBT0DXKIB7/MzuyWzvgBqf4OCB9sX/HMmNcK+NzRvAQwc4osYutBu2Zpw ZN1j25KE98VzV/HJl1QNKf0lmf9yVo7+lDZlVd5Xef5i5BxhV7d3YI4F20oBgYYmPYM3Sy A6LiU59xCxK2lnGDQqCkpt85Sc/kLSg= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 04/10] conf: qemu: add virtiofs fsdriver type Date: Thu, 23 Jan 2020 18:46:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: jYqoXaD1OXa3sOuZsAJzMA-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 Acked-by: Stefan Hajnoczi --- docs/formatdomain.html.in | 7 ++ docs/schemas/domaincommon.rng | 16 ++++ 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 | 38 ++++++++++ .../vhost-user-fs-hugepages.xml | 73 +++++++++++++++++++ .../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, 153 insertions(+) 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 4db9c292b7..21f2a92ed6 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3921,6 +3921,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> ... @@ -3949,6 +3954,8 @@ 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.
template
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 04854bf816..66757d3b63 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2625,6 +2625,22 @@ + + + virtiofs + + + + + + + + + immediate + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6deb8e5434..94e1fd64b5 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 9ae8411f6c..6ee95ac653 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -771,6 +771,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 c66b60fd21..974c2b79af 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2687,6 +2687,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 38addc7b61..eb8e82b545 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8275,6 +8275,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 9e3bcc434d..3c6ac62ff5 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -690,6 +690,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..b02eb5cb2b --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml @@ -0,0 +1,38 @@ + + guest + 126f2720-6f8e-45ab-a886-ec9277079a67 + 14680064 + 14680064 + + + + + 2 + + hvm + + + + + + + + + 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..8a4b1c7c0b --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml @@ -0,0 +1,73 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 4194304 + 4194304 + + + + + + + 2 + + hvm + + + + + + + + + + + + + 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 3cefc64833..bff71e2a9d 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1417,6 +1417,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.21.0 From nobody Tue Apr 30 03:49:07 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=1579801600; cv=none; d=zohomail.com; s=zohoarc; b=Qehg6ePZOSi4rLgOXT9dlKaNcxvrmVU2KbzyAj8UAJ1Sc5ROyhLDa4aiDWnLsdH8XVLVzmOGCkOojS5KcYlNIQC2rmem8182ZHzybH+eBqA846zTRsVjmEkgPCjuvDhyRLBnY7aATj9/jlnPbsGwS7N3BSepUV8JJFaM5e06XHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801600; 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=5RYBiZUtTlIPDk8RXVir+rITmOJJH4MjcXd3rRvdgMI=; b=IgDmT621Xjv86c/6VYjQbdD+yp6timsjiXTADCUr2YlwksHjN6Za6yzXrBy/xBIw/NAWLuaVG9QmM2rPZ20FSfZodKQxsWM4c2J10NQ+kHobcIaCCixbK9Oz42VQqXwfiK0IhGE/Ieeu5Ul5gdzEDvNIbvc7rgQinWGRX6ZB/0w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1579801600057723.4146182860377; Thu, 23 Jan 2020 09:46:40 -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-140-Jwhfs-CrOYupvmQ-wkW8AQ-1; Thu, 23 Jan 2020 12:46:35 -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 D5F408017CC; Thu, 23 Jan 2020 17:46:29 +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 AFA275C1BB; Thu, 23 Jan 2020 17:46: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 6606E85951; Thu, 23 Jan 2020 17:46:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkKRm020912 for ; Thu, 23 Jan 2020 12:46:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6EBD15D9E2; Thu, 23 Jan 2020 17:46:20 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id C86845DA87 for ; Thu, 23 Jan 2020 17:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801598; 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=5RYBiZUtTlIPDk8RXVir+rITmOJJH4MjcXd3rRvdgMI=; b=Ljt3vNJlro7Sm0QKLDurNuKwAOl2Bs7K43quqlzRXFMz7b8+JW8Nb5xH60coBTIM+T34xW d/gFo7T6/3Y4BsqzruyxrnWn/nCQbCBgRwLaeuz0urTUKRW1OABHxRnBb+Micbn5COPpA4 8oJ85IHkAFzLhNcb0hfBj0Z3LP0kd78= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 05/10] conf: add virtiofs-related elements and attributes Date: Thu, 23 Jan 2020 18:46:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: Jwhfs-CrOYupvmQ-wkW8AQ-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: /usr/libexec/virtiofsd Signed-off-by: J=C3=A1n Tomko Acked-by: Stefan Hajnoczi --- docs/formatdomain.html.in | 18 ++- docs/schemas/domaincommon.rng | 51 ++++++ src/conf/domain_conf.c | 146 +++++++++++++++++- src/conf/domain_conf.h | 16 ++ src/libvirt_private.syms | 1 + .../vhost-user-fs-fd-memory.xml | 6 +- .../vhost-user-fs-hugepages.xml | 4 +- 7 files changed, 238 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 21f2a92ed6..cfdb1a7a9a 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3922,10 +3922,15 @@ <readonly/> </filesystem> <filesystem type=3D'mount' accessmode=3D'passthrough'> - <driver type=3D'virtiofs'/> + <driver type=3D'virtiofs queue=3D'1024' xattr=3D'on''> + <binary>/usr/libexec/virtiofsd</binary> + <cache mode=3D'always' size=3D'2097152' unit=3D'KiB'/> + <lock posix=3D'off' flock=3D'off'/> + </driver> <source dir=3D'/path'/> <target dir=3D'mount_tag'> </filesystem> + ... </devices> ... @@ -4046,6 +4051,17 @@ 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, xattr enables the use = of filesystem + extended attributes. The binary sub-element conta= ins the path + to the virtiofs daemon. + Caching can be tuned via the cache element, possi= ble mode + values being none and always. + Locking can be controlled via the lock + element - attributes posix and flock= both accepting + values yes or no. (Since 6.1.0) +
  • =20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 66757d3b63..a67c56d1c7 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2629,6 +2629,57 @@ virtiofs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + none + always + + + + + + + + + + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 94e1fd64b5..e4f20bb0bf 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", @@ -2314,6 +2322,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def) VIR_FREE(def->dst); virDomainDeviceInfoClear(&def->info); VIR_FREE(def->virtio); + VIR_FREE(def->binary); =20 VIR_FREE(def); } @@ -11116,6 +11125,14 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlop= t, g_autofree char *usage =3D NULL; g_autofree char *units =3D NULL; g_autofree char *model =3D NULL; + g_autofree char *binary =3D NULL; + g_autofree char *queue_size =3D NULL; + g_autofree char *xattr =3D NULL; + g_autofree char *cache =3D NULL; + g_autofree char *cache_size =3D NULL; + g_autofree char *cache_unit =3D NULL; + g_autofree char *posix_lock =3D NULL; + g_autofree char *flock =3D NULL; =20 ctxt->node =3D node; =20 @@ -11193,12 +11210,39 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlo= pt, } else if (virXMLNodeNameEqual(cur, "readonly")) { def->readonly =3D true; } else if (virXMLNodeNameEqual(cur, "driver")) { + xmlNodePtr child; + if (!fsdriver) fsdriver =3D virXMLPropString(cur, "type"); if (!wrpolicy) wrpolicy =3D virXMLPropString(cur, "wrpolicy"); if (!format) format =3D virXMLPropString(cur, "format"); + if (!queue_size) + queue_size =3D virXMLPropString(cur, "queue"); + if (!xattr) + xattr =3D virXMLPropString(cur, "xattr"); + + child =3D cur->children; + while (child !=3D NULL) { + if (virXMLNodeNameEqual(child, "cache")) { + if (!cache) + cache =3D virXMLPropString(child, "mode"); + if (!cache_size) + cache_size =3D virXMLPropString(child, "size"); + if (!cache_unit) + cache_unit =3D virXMLPropString(child, "unit"); + } else if (virXMLNodeNameEqual(child, "lock")) { + if (!posix_lock) + posix_lock =3D virXMLPropString(child, "posix"= ); + if (!flock) + flock =3D virXMLPropString(child, "flock"); + } else if (virXMLNodeNameEqual(child, "binary")) { + if (!binary) + binary =3D virXMLNodeContentString(child); + } + child =3D child->next; + } =20 if (virDomainVirtioOptionsParseXML(cur, &def->virtio) < 0) goto error; @@ -11208,11 +11252,72 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlo= pt, } =20 if (fsdriver) { + int val; + if ((def->fsdriver =3D virDomainFSDriverTypeFromString(fsdriver)) = <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown fs driver type '%s'"), fsdriver); goto error; } + + if (binary) + def->binary =3D virFileSanitizePath(binary); + + 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"), + cache_size); + goto error; + } + + 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 (cache_size && virStrToLong_ull(cache_size, NULL, 10, &def->cac= he_size) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse cache size '%s' for virtiofs"), + cache_size); + goto error; + } + + if (virScaleInteger(&def->cache_size, cache_unit, + 1024, ULLONG_MAX) < 0) + goto error; + def->cache_size =3D VIR_DIV_UP(def->cache_size, 1024); + + 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; + } } =20 if (format) { @@ -24998,6 +25103,7 @@ 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); =20 if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -25021,7 +25127,11 @@ virDomainFSDefFormat(virBufferPtr buf, virBufferAddLit(buf, ">\n"); =20 virBufferAdjustIndent(buf, 2); + virBufferAdjustIndent(&driverBuf, 2); if (def->fsdriver) { + g_auto(virBuffer) lockAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) cacheAttrBuf =3D VIR_BUFFER_INITIALIZER; + virBufferAsprintf(&driverAttrBuf, " type=3D'%s'", fsdriver); =20 if (def->format) @@ -25032,11 +25142,45 @@ 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->xattr) { + virBufferAsprintf(&driverAttrBuf, " xattr=3D'%s'", + virTristateSwitchTypeToString(def->xattr)); + } + + virBufferEscapeString(&driverBuf, "%s\n", def->bi= nary); + + if (def->cache) { + virBufferAsprintf(&cacheAttrBuf, " mode=3D'%s'", + virDomainFSCacheModeTypeToString(def->cache)= ); + } + + if (def->cache_size) { + virBufferAsprintf(&cacheAttrBuf, " size=3D'%llu' unit=3D'KiB'", + def->cache_size); + } + + virXMLFormatElement(&driverBuf, "cache", &cacheAttrBuf, NULL); + + if (def->posix_lock) { + virBufferAsprintf(&lockAttrBuf, " posix=3D'%s'", + virTristateSwitchTypeToString(def->posix_loc= k)); + } + + if (def->flock) { + virBufferAsprintf(&lockAttrBuf, " flock=3D'%s'", + virTristateSwitchTypeToString(def->flock)); + } + + virXMLFormatElement(&driverBuf, "lock", &lockAttrBuf, NULL); } =20 + virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio); =20 - virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL); + 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 6ee95ac653..b90ccbdba8 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -802,6 +802,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 */ @@ -817,6 +825,13 @@ 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; + unsigned long long cache_size; + virTristateSwitch posix_lock; + virTristateSwitch flock; virDomainVirtioOptionsPtr virtio; virObjectPtr privateData; }; @@ -3425,6 +3440,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 907640b684..75f145a9de 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -389,6 +389,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 b02eb5cb2b..3a578ae126 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml @@ -26,7 +26,11 @@ - + + /usr/libexec/virtiofsd + + +
    diff --git a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml b/tests/qem= uxml2argvdata/vhost-user-fs-hugepages.xml index 8a4b1c7c0b..fb9c4cc6c3 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml @@ -61,7 +61,9 @@
    - + + /usr/libexec/virtiofsd +
    --=20 2.21.0 From nobody Tue Apr 30 03:49:07 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=1579801601; cv=none; d=zohomail.com; s=zohoarc; b=lRpa2t1ad3gy1VUvKrVqUM425/lsz5Ag+PXrvYPcgIhe2Qf88JR6/K3RaGBOQHl96rG1DSK3HmjxZqzMMZ5x1qoDZuO5nbKHCvl6BECercbV9ZE7q0z++EQkD21r2ikfI5UMp1T2RLQR0hhKXTv55XOlaQK+vMCBrQTvX7sGYa0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801601; 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=0phtzumfEkdLsf+JemqDl0+gNCRZ7KP+YzbgYyHQ8xQ=; b=XbFQLoQjp9KOX505BOchtvJHAwALXq+sGC2feoxQ8MQCqLkzU5tTP7RUPfT7qsKaxJvfsXEqi0fcUfSJClyywlHwMfmVd4KNAzQLapCVjqIzhWK5Vfikp3DLLhhqbcVg80axDLLN9e8cU1yRMq/E9o5MyE2HSDFjpiWsIQ5h5YA= 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 157980160162351.92313604334754; Thu, 23 Jan 2020 09:46:41 -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-139-M3ozR4JRN92KqhCpew4Dgw-1; Thu, 23 Jan 2020 12:46:36 -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 914731882CCD; Thu, 23 Jan 2020 17:46:28 +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 654B286459; Thu, 23 Jan 2020 17:46:28 +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 1F12F18089D7; Thu, 23 Jan 2020 17:46:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkLWu020920 for ; Thu, 23 Jan 2020 12:46:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3B4805D9E2; Thu, 23 Jan 2020 17:46:21 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA3D05DA2C for ; Thu, 23 Jan 2020 17:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801600; 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=0phtzumfEkdLsf+JemqDl0+gNCRZ7KP+YzbgYyHQ8xQ=; b=G2NPMG82AXa5nBi76vBH1chJZdLsPKX1GThn86fTpVzg3p4SNBDj2nh89PsiiTuAFsqSkM bOdUCqmw8gDSJKHj6gB6aTtYArTbTwF6YN33ZrEKkZvS8YDDXS+a+kAJyC3zp7iECOEFqj BWsofHxrVDYG8muZH/RKEFWkeEVV6gA= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 06/10] qemu: add virtiofs_debug to qemu.conf Date: Thu, 23 Jan 2020 18:46:07 +0100 Message-Id: <0f0ba26556d2265cc604a34917d2ca5279dddca5.1579801508.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: M3ozR4JRN92KqhCpew4Dgw-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 'virtiofs_debug' option for tuning whether to run virtiofsd in debug mode. Signed-off-by: J=C3=A1n Tomko Acked-by: Stefan Hajnoczi --- 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..32d79f20db 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 "virtiofs_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..84f01a126d 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -809,6 +809,13 @@ # #gluster_debug_level =3D 9 =20 +# virtiofs debug +# +# Whether to pass the debug option to virtiofsd command line. +# Possible values are 0 or 1. +# +#virtiofs_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 b62dd1df52..3ff02988ad 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -801,6 +801,8 @@ virQEMUDriverConfigLoadDebugEntry(virQEMUDriverConfigPt= r cfg, { if (virConfGetValueUInt(conf, "gluster_debug_level", &cfg->glusterDebu= gLevel) < 0) return -1; + if (virConfGetValueBool(conf, "virtiofs_debug", &cfg->virtiofsDebug) <= 0) + return -1; =20 return 0; } diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index b9401635d7..4162d06bf4 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 virtiofsDebug; =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..7290a0004f 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" } +{ "virtiofs_debug" =3D "1" } { "namespaces" { "1" =3D "mount" } } --=20 2.21.0 From nobody Tue Apr 30 03:49:07 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=1579801606; cv=none; d=zohomail.com; s=zohoarc; b=lhpMDxuwVQwIYroZ/9WWSQMUEVQEAuQeS/ypgC0C3fZDXRreKiq0U72vLEdPZxyME9QYfLG06rKfDeQZzGCyoXz55Q5zDZBNUYogD3FSAgqiRjzjw80oifpld85wtF7wgBKH/kBUrePrCbJy8ftytpdbnJbBF+e1GLfu9LdhUv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801606; 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=nsX3CZeGNf6/CrKbmXld7Zu32XIbsXcdjdwwFrBPisY=; b=l0vglWev264b1EbDmMqR4vXtit8DCIwNaJxC2yQ1+OmzTUBUbQX8lRfE/sCodUHnrQ+X6dZV96OnQleTXuxkZZ4wBZUK9opeySdRxrqq0TjZccOJ7/igzLFKjhgBX+kwWICFJq7VJc/O61WIs5zUpKeZvBzFkKHqEFahIJHQF1E= 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 1579801606782357.61567374929245; Thu, 23 Jan 2020 09:46:46 -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-161-z4AciN47PoeXD62sHphUHw-1; Thu, 23 Jan 2020 12:46:40 -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 918EF8D3CA1; Thu, 23 Jan 2020 17:46: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 6A31D8CCF0; Thu, 23 Jan 2020 17:46: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 2C815180880C; Thu, 23 Jan 2020 17:46:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkM4M020933 for ; Thu, 23 Jan 2020 12:46:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0915D5DA2C; Thu, 23 Jan 2020 17:46:22 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86D275D9E2 for ; Thu, 23 Jan 2020 17:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801605; 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=nsX3CZeGNf6/CrKbmXld7Zu32XIbsXcdjdwwFrBPisY=; b=hjnEe5SmqTH2Oa7W32OsakI+TKoLKTT7sZdksXdR0JIqHse3hGL21X7oGqmGhCqqubLCfi SiMxOwdyGA2f+YP+jHCJVFdxqgLjieGWmgAcrat0hY3NR1CnDP9HtaVrDGBrMfYyjdDJeV gffRJlx1X3hs2wncf+hbb/xtgPnaTKg= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 07/10] qemu: validate virtiofs filesystems Date: Thu, 23 Jan 2020 18:46:08 +0100 Message-Id: <0bd57dfe550552dbbdd3f60b331721d008712097.1579801508.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: z4AciN47PoeXD62sHphUHw-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 Acked-by: Stefan Hajnoczi --- src/qemu/qemu_domain.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index eb8e82b545..4db0075b89 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8276,8 +8276,37 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs, return -1; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: - /* TODO: vhost-user-fs-pci */ - return 0; + if (!fs->binary) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("missing virtiofs binary")); + return -1; + } + 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 (def->mem.access !=3D VIR_DOMAIN_MEMORY_ACCESS_SHARED) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs requires shared memory")); + return -1; + } + break; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_LAST: default: --=20 2.21.0 From nobody Tue Apr 30 03:49:07 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=1579801610; cv=none; d=zohomail.com; s=zohoarc; b=EDv2L2z5ogNu43Zwz7aA3NbKc1r24+MKMHHA9iGx+ivyWGSpBN1tih8sYqeHgLhYZ0Bi10a8F0MA36yGQWmHCLRl6WBLBZVU1z9aphNNNTYPD1DS0A7l1StrhGCLoLCJgWnSSD4pLC047G9WYZ/OhfwQZ4Sz9pXZalYYQRsFva0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801610; 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=kEqClgAwdNGNBuiW2fQopOINeKzW9IBLvq6QsW8gvWc=; b=elrQknBYz6Cmy2LHvoZ0VByQfSPoQdNKDox4kuhNBouW02kv7yJfpUxHXECgq/lKG1FootUUkWTchiCGUwpw6d7+b8Bq76UT3EfxeZl0t3OBYgfshTjW/GZqWAbfhFzSZ62rDCaSupbmc9zW3SC1T4N3oA4kQVV/eWX7+cp8V90= 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 1579801610635450.6891632829946; Thu, 23 Jan 2020 09:46: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-358-RTBlaVfrMFmRy7JYxWtkRQ-1; Thu, 23 Jan 2020 12:46:46 -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 5CB35801E77; Thu, 23 Jan 2020 17:46: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 356D35DA75; Thu, 23 Jan 2020 17:46: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 E9A0E1803C33; Thu, 23 Jan 2020 17:46:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkMuc020943 for ; Thu, 23 Jan 2020 12:46:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id CA0B25D9E2; Thu, 23 Jan 2020 17:46:22 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 555AA5DA89 for ; Thu, 23 Jan 2020 17:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801609; 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=kEqClgAwdNGNBuiW2fQopOINeKzW9IBLvq6QsW8gvWc=; b=PY9AyHRsqPPafj0533v8nFMZ3rgfQpmPeGIZzDaUiANNeYTznNgwSVsGQxAAlEmDG05lHE VrvS7Jye06LffWrUkV5HWbP9D6G0UzVQzi4eo540rVXXc6CUlZhp2oKqhW75B4+wRwDIG4 K2KXmsYA3uFbFWYUcM+dpZ3ZYUzD6B4= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 08/10] qemu: add code for handling virtiofsd Date: Thu, 23 Jan 2020 18:46:09 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: RTBlaVfrMFmRy7JYxWtkRQ-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 TBD, pull request here: https://lists.nongnu.org/archive/html/qemu-devel/2020-01/msg05389.html Signed-off-by: J=C3=A1n Tomko Acked-by: Stefan Hajnoczi --- po/POTFILES.in | 1 + src/qemu/Makefile.inc.am | 2 + src/qemu/qemu_domain.c | 3 + src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_extdevice.c | 19 +++ src/qemu/qemu_virtiofs.c | 241 ++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_virtiofs.h | 37 ++++++ tests/qemuxml2argvtest.c | 6 + 8 files changed, 310 insertions(+), 1 deletion(-) 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 e266871907..4ea646e127 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -169,6 +169,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 967f6e75a2..77786526ea 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 4db0075b89..19b3eb0fab 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1442,6 +1442,9 @@ qemuDomainFSPrivateNew(void) static void qemuDomainFSPrivateDispose(void *obj G_GNUC_UNUSED) { + 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 21ece23177..ea50c687d4 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 463f76c21a..1f4b605eb3 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" @@ -184,6 +186,16 @@ 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(driver, vm, fs) < 0) + return -1; + } + } + + return ret; } =20 @@ -215,6 +227,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..1a3bfd53f5 --- /dev/null +++ b/src/qemu/qemu_virtiofs.c @@ -0,0 +1,241 @@ +/* + * 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 "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 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; + + virCommandAddArg(cmd, "--syslog"); + 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) + virBufferAsprintf(&opts, "%sxattr,", fs->xattr =3D=3D VIR_TRISTATE= _SWITCH_OFF ? "no_" : ""); + if (fs->flock) + virBufferAsprintf(&opts, "%sflock,", fs->flock =3D=3D VIR_TRISTATE= _SWITCH_OFF ? "no_" : ""); + if (fs->posix_lock) + virBufferAsprintf(&opts, "%sposix_lock,", fs->posix_lock =3D=3D VI= R_TRISTATE_SWITCH_OFF ? "no_" : ""); + virBufferTrim(&opts, ",", -1); + + virCommandAddArgBuffer(cmd, &opts); + if (cfg->virtiofsDebug) + virCommandAddArg(cmd, "-d"); + + return g_steal_pointer(&cmd); +} + +int +qemuVirtioFSStart(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; + char errbuf[1024] =3D { 0 }; + pid_t pid =3D (pid_t) -1; + VIR_AUTOCLOSE errfd =3D -1; + VIR_AUTOCLOSE fd =3D -1; + int exitstatus =3D 0; + int cmdret =3D 0; + int ret =3D -1; + int rc; + + 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; + + if (!(cmd =3D qemuVirtioFSBuildCommandLine(cfg, fs, &fd))) + goto cleanup; + + virCommandSetPidFile(cmd, pidfile); + virCommandSetErrorFD(cmd, &errfd); + virCommandDaemonize(cmd); + + if (qemuExtDeviceLogCommand(driver, vm, cmd, "virtiofsd") < 0) + goto cleanup; + + cmdret =3D virCommandRun(cmd, &exitstatus); + + if (cmdret < 0 || exitstatus !=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not start 'virtiofsd'. exitstatus: %d"), e= xitstatus); + 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) { + if (saferead(errfd, errbuf, sizeof(errbuf) - 1) < 0) { + virReportSystemError(errno, "%s", + _("virtiofsd died unexpectedly")); + } else { + virReportError(VIR_ERR_OPERATION_FAILED, + _("virtiofsd died and reported: %s"), errbuf); + } + 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..ffaeee0275 --- /dev/null +++ b/src/qemu/qemu_virtiofs.h @@ -0,0 +1,37 @@ +/* + * 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(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 b923590930..5a517a4982 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -496,6 +496,12 @@ testCompareXMLToArgv(const void *data) } } =20 + for (i =3D 0; i < vm->def->nfss; i++) { + virDomainFSDefPtr fs =3D vm->def->fss[i]; + char *s =3D g_strdup_printf("/tmp/lib/domain--1-guest/fs%zu.vhost-= fs.sock", 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.21.0 From nobody Tue Apr 30 03:49:07 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=1579801625; cv=none; d=zohomail.com; s=zohoarc; b=D0pjKFFh0upBzK1uYWMa63kfJyW7g/F4cWWDmfjSlVgoWYBbSta98aPIhwvhDDQ5DyvQMcHwFO8WbRY+Sp7jAxYnnsn57i592Jz9g/PsqvBfZujNB70tG6JOI4U5UsBDMw4q2ceokE22/ATav/mU2/svW2Q3S/xOXFuOHiuMGco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801625; 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=w5+ueeZ8UrzUpxkSjQy3URaiipmsu7+I+bA49UtO9zY=; b=Ng/djfZ/dQnqQi7ur+qh+Pca8Oir4pUquyxOCahdR9JQADj19h42/EonbtO2vEWQpD9huyDktEf2FeyUOPe7kSdKXhBupNp2j+RVkgwD2qyQP3EmVXYtVwh9+WboMqigTYMjGpmTqsFSkMNtuMmeuEZ5UdWNP97kJQKtluoP2h4= 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 1579801625337511.97823452669013; Thu, 23 Jan 2020 09:47:05 -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-60-abgHGgcXPyS0jIf-T5W1AA-1; Thu, 23 Jan 2020 12:46:39 -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 417E4DB60; Thu, 23 Jan 2020 17:46: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 1760687EDC; Thu, 23 Jan 2020 17:46:32 +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 C01F48594B; Thu, 23 Jan 2020 17:46:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkN8P020950 for ; Thu, 23 Jan 2020 12:46:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9897F5DA2C; Thu, 23 Jan 2020 17:46:23 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 225B45D9E2 for ; Thu, 23 Jan 2020 17:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801624; 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=w5+ueeZ8UrzUpxkSjQy3URaiipmsu7+I+bA49UtO9zY=; b=IpLamfCVLtsZuZyoZ5wGcG0wILF3V04aKj6g8dBEGizPmKq3YYDv2Qy76qugRgyk1C6jmX fJ2hwn92KfaksQgLpTeoAYlcXEqe+udXAf6IrAUC72ph2rN2bTByQCeNILi3NGtAiqhijh 5/a4HLPhWQ8llRzxTB0MEkSTG3CXZiw= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 09/10] qemu: build vhost-user-fs device command line Date: Thu, 23 Jan 2020 18:46:10 +0100 Message-Id: <8e29c5c4478d70b311c21470795a1f39e4f32f08.1579801508.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: abgHGgcXPyS0jIf-T5W1AA-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. https://bugzilla.redhat.com/show_bug.cgi?id=3D1694166 Signed-off-by: J=C3=A1n Tomko Acked-by: Stefan Hajnoczi --- src/qemu/qemu_command.c | 47 ++++++++++++++++++- ...vhost-user-fs-fd-memory.x86_64-latest.args | 38 +++++++++++++++ ...vhost-user-fs-hugepages.x86_64-latest.args | 46 ++++++++++++++++++ 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 974c2b79af..31573860dd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2581,6 +2581,47 @@ qemuBuildDisksCommandLine(virCommandPtr cmd, } =20 =20 +static int +qemuBuildVHostUserFsCommandLine(virCommandPtr cmd, + virDomainFSDef *fs, + const virDomainDef *def G_GNUC_UNUSED, + qemuDomainObjPrivatePtr priv) +{ + g_autofree char *chardev_alias =3D NULL; + g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; + const char *tag =3D fs->dst; + + 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); + virBufferEscapeString(&opt, ",tag=3D%s", tag); + if (fs->cache_size) + virBufferAsprintf(&opt, ",cache-size=3D%lluK", fs->cache_size); + 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) { @@ -2673,7 +2714,7 @@ static int qemuBuildFilesystemCommandLine(virCommandPtr cmd, const virDomainDef *def, virQEMUCapsPtr qemuCaps, - qemuDomainObjPrivatePtr priv G_GNUC_UNUSED) + qemuDomainObjPrivatePtr priv) { size_t i; =20 @@ -2688,7 +2729,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..5b992b8c62 --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args @@ -0,0 +1,38 @@ +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 \ +-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,\ +cache-size=3D2097152K,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..3137d97e1f --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args @@ -0,0 +1,46 @@ +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 \ +-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 5a517a4982..0b9acb2891 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3040,6 +3040,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.21.0 From nobody Tue Apr 30 03:49:07 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=1579801788; cv=none; d=zohomail.com; s=zohoarc; b=Gp6XPmSZnKD/J4MCMNWfZUZ+AG0ay+cw/fruYK+5b7e2XtFy+F91eRBpzwNZFfsBHYZDgacfBdM8k5VGX9gbXMGH4nhbuO/OX+ZSH4UCdxjEq3mKECkW3z5pk6t0WrnMwby1LfG/032aAo6lEczLv6s2UFN4nuLQDgwy8NsYcNU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801788; 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=yJDbV0dVMJVYK5BHA8eeOUpZPc/qwodyk4amyCYijHo=; b=M+QWKuN350iAF5scKhFsk+vvUcaSK7Q0lqhY8sgY48NTBs+V1bwRK33C0t3+9al5WvlnK6LxR8DIy2TSKI5ABpNnRWjBUds3zYn/vh/wZy7tq/piJvajVBO6Btpq9yCFvFX9TaoVhd3jD4x40tyk+e7/Zha5nIy2j0R2HiNd/m0= 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 1579801788021897.2122930096011; Thu, 23 Jan 2020 09:49:48 -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-1-Ky0gxymZMaORXjxnQB8i_A-1; Thu, 23 Jan 2020 12:46:44 -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 197C9DB6B; Thu, 23 Jan 2020 17:46: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 E60C986455; Thu, 23 Jan 2020 17:46:36 +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 96A02180CB3B; Thu, 23 Jan 2020 17:46:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkQVd020975 for ; Thu, 23 Jan 2020 12:46:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id B6DCE5D9E2; Thu, 23 Jan 2020 17:46:26 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4109D5DA2C for ; Thu, 23 Jan 2020 17:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801786; 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=yJDbV0dVMJVYK5BHA8eeOUpZPc/qwodyk4amyCYijHo=; b=BDl2Omff3JvFA3Y+B8SCWbfTTu8mwtmHvEpOSaByQgW1CDe4U1NbFp56I3dZoDhImAuh+d RhVwC7otQeYK5iiWzT8t5unfSkiEFov6l432zzwCuiAL1XBvhCkxNvnKdcQtiDNsqWDBPV zXlamFLCLEchaOSngIXmYQjbLmDYizw= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 10/10] docs: add virtiofs kbase Date: Thu, 23 Jan 2020 18:46:11 +0100 Message-Id: <065c6282f7fd9422b9c6c1acd36710fea71adcad.1579801508.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: Ky0gxymZMaORXjxnQB8i_A-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. Acked-by: Stefan Hajnoczi --- docs/kbase.html.in | 3 + docs/kbase/virtiofs.rst | 153 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 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..83351e0a28 --- /dev/null +++ b/docs/kbase/virtiofs.rst @@ -0,0 +1,153 @@ +=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 delicious delicacy aiming to provide an easy-to-configure +way of sharing filesystems between the host and the virtual machine. + +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, +requres 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: + +1. 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 file. + # NOTE: big files will be stored here + memory_backing_dir =3D "/dev/shm/" + +2. Use hugepage-backed memory + +Make sure there are enough huge pages allocated for the requested guest me= mory. +For exmaple, 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 + +1. 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 vCPU= s: + +:: + + + ... + + + + + + ... + + +Note that the CPU element might already be specified and only one is allow= ed. + +2. Specify the memory backend + +Either of the following: + +2.1. File-backed memory + +:: + + + ... + + + + ... + + +This will create a file in the directory specified in ``qemu.conf`` + +2.2. Hugepage-backed memory + +:: + + + ... + + + + + + + ... + + +3. Add the ``vhost-user-fs`` QEMU device via the ``filesystem`` element + +:: + + + ... + + ... + + + /usr/libexec/virtiofsd + + + + + ... + + + +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 requires +running the ``virtiofsd`` daemon as root. + +4. 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 la= ter) + +=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 + +:: + + + /usr/libexec/virtiofsd + + + --=20 2.21.0