From nobody Sun Apr 28 19:02:55 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=1582718254; cv=none; d=zohomail.com; s=zohoarc; b=Uq7gx/uZkTu4smJzWZ0xPO9QjBtXxcRSXTXcjnRDErm3hLeDYNyA3UgiUOvVXhElB/R3GSGkQzoowJBR22MTzPrFfnJbLxKmeEycaO8T75ABcqVTxpRsueJV5mchaVB+dh6pIJDwQ1ANRWJ3+6s7g0NPbf16uJwWbPy1L2CgRqg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718254; 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=NFqmU5LCGvy/ODMui2G3fSNtNjWgpCP18EAN9MoVIDs=; b=Il85CQIwrnmoRolMnodNtz9t9gvKYFN9nNSHd/faPbbfnG7kDjyYuES4YsbHpIo01NjAnuug+hFVyTQ7MfKk9PS0lVEm1ndSB/lgfXbd9+wbG9P2kLYH06erGhvWfK7mx9RDJkHMHBXOL5gP6u57seVsQPOFaXpL6EC9GHflHO8= 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 1582718254813191.59333857395654; Wed, 26 Feb 2020 03:57:34 -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-305-sUJS-8HpMHqNUAiCU_9Vwg-1; Wed, 26 Feb 2020 06:57:31 -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 192BB800D55; Wed, 26 Feb 2020 11:57:26 +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 8FA2F5C13D; Wed, 26 Feb 2020 11:57:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2B19A84474; Wed, 26 Feb 2020 11:57:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvIPR031490 for ; Wed, 26 Feb 2020 06:57:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id E89E88C06A; Wed, 26 Feb 2020 11:57:18 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7021B8B779 for ; Wed, 26 Feb 2020 11:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718253; 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=NFqmU5LCGvy/ODMui2G3fSNtNjWgpCP18EAN9MoVIDs=; b=HwjX1tHCHxnFkIlILFArNmBwRMrrV27wfJpBHq0+uXEG8ABQrbino/JK8bwsfbUQKeKfWG py/CwRW3VwMdOgMNk9x4LdNOSPV0oh74BwE4ufHdbsn1fVyOEvEVcwDqw4rsOUDoQ4kugF cHn96eysQHynaZo1ZnuFKvEY7O5JSmE= X-MC-Unique: sUJS-8HpMHqNUAiCU_9Vwg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 01/15] schema: wrap fsDriver in a choice group Date: Wed, 26 Feb 2020 12:56:59 +0100 Message-Id: <0e7bac170406b0494d9f2770296f7ee37df6a28d.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Allow adding new groups without changing indentation. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Andrea Bolognani --- 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 c00ace7d9c..0e7b8d389e 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2620,29 +2620,33 @@ for this kind of info, and 'type' for the storage format. We need the latter too, so had to invent a new attribute name --> - - - - path - handle - loop - nbd - ploop - - - - - - - - - - - immediate - - - - + + + + + + path + handle + loop + nbd + ploop + + + + + + + + + + + immediate + + + + + + =20 --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718254; cv=none; d=zohomail.com; s=zohoarc; b=L0jeAOoMycEGDa2W94RSpBixGR05WTRdk/FaO7R/o52/DPQPH3nHqffwhDb4K4y0l33YyoAWUo46xHPVr6OaGli/fO4ho7LbUh8/Vf+3xIWd+H0uvtinR9vRh9MJmxl/wjbag4Rc5ngNKwxyt6vGKrz5sZsMTEm6SiEfLA5pfg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718254; 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=xRlWVs18JEsXZTedFxUC17Ns/rAaW/EeR3RGqCFjr/Q=; b=gRwELTQsmUXHq7250k2Yag+HU8bMWTzll4KIFBOb78OzWEjY++pd7P8YbGOXGVYa/VE4dofRsH/9/betC0OC9FZ4VNa9yZMP7TDbGHaUw7XzHOpvjAhuwqBsLP8jBvt6jVgVABfGHWQdrjz63jE/yx9KsZIv5tkS4/WtZaoCN0k= 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 1582718254580432.76122750865807; Wed, 26 Feb 2020 03:57:34 -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-48-ecyx6CR1OuuO8Sz3F0GZEQ-1; Wed, 26 Feb 2020 06:57:31 -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 D1408800D48; Wed, 26 Feb 2020 11:57:25 +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 36C4C19C58; Wed, 26 Feb 2020 11:57:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B63E918089CE; Wed, 26 Feb 2020 11:57:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvJGw031501 for ; Wed, 26 Feb 2020 06:57:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id BA8788C06A; Wed, 26 Feb 2020 11:57:19 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42B758B779 for ; Wed, 26 Feb 2020 11:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718253; 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=xRlWVs18JEsXZTedFxUC17Ns/rAaW/EeR3RGqCFjr/Q=; b=ErEmqiM0CLR7sPouY6t9W3I4rarX0ZU8VC0CldCzSExCUhpQ1a0dRwH2hgdKx2HVXxPZB7 BBGWQHDj94vjZkNmxoHrgYujyx9k594Nw872DoQlwMWf7tZGID+O8YgNVPhOWYCZRGl9qg oSYAtd2xoRYPGVPhinnE5rnsdDDe54E= X-MC-Unique: ecyx6CR1OuuO8Sz3F0GZEQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 02/15] qemuExtDevicesStart: pass logManager Date: Wed, 26 Feb 2020 12:57:00 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Pass logManager to qemuExtDevicesStart for future usage. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Andrea Bolognani --- src/qemu/qemu_extdevice.c | 1 + src/qemu/qemu_extdevice.h | 1 + src/qemu/qemu_process.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 9c0c0fd573..7f3bb104d9 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -153,6 +153,7 @@ qemuExtDevicesCleanupHost(virQEMUDriverPtr driver, int qemuExtDevicesStart(virQEMUDriverPtr driver, virDomainObjPtr vm, + virLogManagerPtr logManager G_GNUC_UNUSED, bool incomingMigration) { virDomainDefPtr def =3D vm->def; diff --git a/src/qemu/qemu_extdevice.h b/src/qemu/qemu_extdevice.h index 5cf777ab4b..df29968e16 100644 --- a/src/qemu/qemu_extdevice.h +++ b/src/qemu/qemu_extdevice.h @@ -46,6 +46,7 @@ void qemuExtDevicesCleanupHost(virQEMUDriverPtr driver, =20 int qemuExtDevicesStart(virQEMUDriverPtr driver, virDomainObjPtr vm, + virLogManagerPtr logManager, bool incomingMigration) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d9035055e8..36fbffd7b8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6735,7 +6735,9 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuProcessGenID(vm, flags) < 0) goto cleanup; =20 - if (qemuExtDevicesStart(driver, vm, incoming !=3D NULL) < 0) + if (qemuExtDevicesStart(driver, vm, + qemuDomainLogContextGetManager(logCtxt), + incoming !=3D NULL) < 0) goto cleanup; =20 VIR_DEBUG("Building emulator command line"); --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718271; cv=none; d=zohomail.com; s=zohoarc; b=jCoqZuJ+0Aw3kx2ysdtjui2ZkgwmbET8vdQDOS0KUGyCOQ6hWknAWsc9xB0kcw2PK5ogYB9BrCo8ikpYrNMC/HrDXP3/fIGj8kBbhfA1sZHgURJafBxOfSfofStI6t+7x0DH2jXXGkejZocx5IRJ+ou3esOGdMWHtuGPW7HvZJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718271; 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=1ZL6NRXTAw7MOKYMVynxCPUfbqNcfJqOyoOHbtQtw2Y=; b=IgEHTYr5z95oh/dJYwOFeD9AwKNWhBZc9ii21P9BEDI1HwTL2E95n/UnujUn5emIQ3vaW4sVqlReR5oMUdB/NQ5Y7MT+FXTm0hIYTNYG5kJKeIlMdgOTyYogFMTAMhmqK9lSn/IonDbxBFXN45honCrpj11uRRKakHNVrX2tXXw= 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 1582718271874238.0247579949072; Wed, 26 Feb 2020 03:57:51 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-ppP5wkRyPtadScY_5MAAGA-1; Wed, 26 Feb 2020 06:57:48 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC92C102C8D3; Wed, 26 Feb 2020 11:57:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82569100164D; Wed, 26 Feb 2020 11:57:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3730384475; Wed, 26 Feb 2020 11:57:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvK8e031508 for ; Wed, 26 Feb 2020 06:57:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8D0C98C06A; Wed, 26 Feb 2020 11:57:20 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14A408B779 for ; Wed, 26 Feb 2020 11:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718270; 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=1ZL6NRXTAw7MOKYMVynxCPUfbqNcfJqOyoOHbtQtw2Y=; b=MWudY/vwEWALAJKTx25fCADP1cmnfuSMlhd6cm/qSf8nsamGDg+IxC6Z60FSgA7R4QUbIT AtxffnBhCtpoRGKbQnXAh6nD3h4bOHel9YmiEXUNUy5FzuyYuoc42+0qFS6eFhZ3yE0dny kBwoFBrN7PyW6JEV3/vpm1aJG0YGkf8= X-MC-Unique: ppP5wkRyPtadScY_5MAAGA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 03/15] qemu: pass virDomainObjPtr to qemuExtDevicesSetupCgroup Date: Wed, 26 Feb 2020 12:57:01 +0100 Message-Id: <15215cc95bfb5cb71b2fbd05353c9377cf7a2d7e.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-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" Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- src/qemu/qemu_cgroup.c | 2 +- src/qemu/qemu_extdevice.c | 3 ++- src/qemu/qemu_extdevice.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index d550d4f58a..c0e30f6152 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -1165,7 +1165,7 @@ qemuSetupCgroupForExtDevices(virDomainObjPtr vm, false, &cgroup_temp) < 0) goto cleanup; =20 - ret =3D qemuExtDevicesSetupCgroup(driver, vm->def, cgroup_temp); + ret =3D qemuExtDevicesSetupCgroup(driver, vm, cgroup_temp); =20 cleanup: virCgroupFree(&cgroup_temp); diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 7f3bb104d9..bb73787b8d 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -236,9 +236,10 @@ qemuExtDevicesHasDevice(virDomainDefPtr def) =20 int qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver, - virDomainDefPtr def, + virDomainObjPtr vm, virCgroupPtr cgroup) { + virDomainDefPtr def =3D vm->def; size_t i; =20 for (i =3D 0; i < def->nvideos; i++) { diff --git a/src/qemu/qemu_extdevice.h b/src/qemu/qemu_extdevice.h index df29968e16..49373a15a1 100644 --- a/src/qemu/qemu_extdevice.h +++ b/src/qemu/qemu_extdevice.h @@ -58,5 +58,5 @@ void qemuExtDevicesStop(virQEMUDriverPtr driver, bool qemuExtDevicesHasDevice(virDomainDefPtr def); =20 int qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver, - virDomainDefPtr def, + virDomainObjPtr vm, virCgroupPtr cgroup); --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718271; cv=none; d=zohomail.com; s=zohoarc; b=SuP8vbVExH9SE1ygC5F/k0bNSvwdwXHewFN8YbBuKPWtnpq/abvJ5qlaGnYz/yv7jsNs0kLKJKwtw53p6vBZTaoBtsqMsNfmUewk9atABcC2vGZWPwJtl/IRm/wQhevuVrSKYI25qSIDBfbcU1t3odaSC7ONEW6mZYyXhxHgZXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718271; 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=tzsIMXKv7eKlH3+bvKZFbxNgb6/SS8PN3g/9LOVDgxU=; b=aayoHTcngHp6yBKiJQTnrvlYMASsOjHjYaqRojLtv9Ji6MMfsbscTiONsoR2B5e8XXoKmQ9UzPxPEFhAMc9LXviq6ALnqgNq9lqJCmvl20cpre3Rye79xRkdEsHAn4fe3FXhClcDDit9y+yoM1YCPfA5DGIixW5k/HG5wPRqEqY= 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 1582718271819513.1749237145876; Wed, 26 Feb 2020 03:57:51 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-235-yxg5I976PXOeW9Zsa2MXxw-1; Wed, 26 Feb 2020 06:57:48 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5C0A18FE863; Wed, 26 Feb 2020 11:57:42 +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 BAE8860C18; Wed, 26 Feb 2020 11:57:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 70B7A18089D5; Wed, 26 Feb 2020 11:57:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvL2Y031513 for ; Wed, 26 Feb 2020 06:57:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6046E8C08C; Wed, 26 Feb 2020 11:57:21 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id DAEEE8C06A for ; Wed, 26 Feb 2020 11:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718270; 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=tzsIMXKv7eKlH3+bvKZFbxNgb6/SS8PN3g/9LOVDgxU=; b=cGim4nfULy0znZSPf8nqxF3dILiT4WjK9FvZYbHFT+M2O0ro6RLBry6QPcWqIdGAqO/jhR IJ4Vl78+Gc9OLuu/VX+Aoq6lx+e3EJ+2ipMZGRWWqZEJR40973UNhRh8LNbfvKYCMJCS1w o4adVm5wSG3JRhxfLtG8jYYBlZvmltw= X-MC-Unique: yxg5I976PXOeW9Zsa2MXxw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 04/15] qemuxml2xmltest: set driver as privileged Date: Wed, 26 Feb 2020 12:57:02 +0100 Message-Id: <99f7acfc831765311e2d99cbdf1374146ac25092.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-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" Some validation check might reject unprivileged drivers in the future. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- tests/qemuxml2xmltest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index c29dd5053d..914f503516 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -162,6 +162,7 @@ mymain(void) return EXIT_FAILURE; =20 cfg =3D virQEMUDriverGetConfig(&driver); + driver.privileged =3D true; =20 # define DO_TEST_INTERNAL(_name, suffix, when, ...) \ do { \ --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718274; cv=none; d=zohomail.com; s=zohoarc; b=JO4+ClWu1IJYRsBZJ13YCAcqQly70OfADZ3PobsMS5p87HBnXflPM1EYdOedZj4xJeTB/2YNXvAUMYCIHftTLQ0c79zVIEWgGBVWINSilmqQxISDeqMFlGV9/MoFFJYF1clR69zVBqN3oT6J+LHpcSo0L3J+1brpDubCZH/+nPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718274; 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=vAQUAv2EUEYJjJwZQOpoR+HwvQfx0LIpOiePwyfeOcM=; b=YHEsjF0lPaz24EgX2/no+cuvEKjQgCOzWMUEUL4MVFTBNmMHwu1gl+tpM/BLvVhgfdSyGv1Y2hbRylmUib++kFTyIDUF5lkLES6zvsYrn3b/jpD/AJIH9tva3s45hkM4oLfyhI/yK7FHZ8kIPqwEmVv6w+3RkZdeYgnJ5UAmmvg= 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 1582718274818759.4287311577449; Wed, 26 Feb 2020 03:57:54 -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-156-kX9nKji6Mv6718bbQQTq6Q-1; Wed, 26 Feb 2020 06:57:50 -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 8BEAE18FE862; Wed, 26 Feb 2020 11:57:45 +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 5E61F1001B2D; Wed, 26 Feb 2020 11:57:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 130B618089D5; Wed, 26 Feb 2020 11:57:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvMcG031521 for ; Wed, 26 Feb 2020 06:57:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3400A8C088; Wed, 26 Feb 2020 11:57:22 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE7E98C087 for ; Wed, 26 Feb 2020 11:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718273; 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=vAQUAv2EUEYJjJwZQOpoR+HwvQfx0LIpOiePwyfeOcM=; b=O6gOKiw/hdUeIhT5+Z+/CXdhlv+50wSZ9XPICI7sqPGkabRvq/BflV3ue6M+5tqYDVP6yJ gTKPBJtFgGavNoLJMz8L0hZ8YOAddpUHGEPxGer3wdRpmS89nFIl/WVPEeuPu+iLTF8eMi DYvNWS0uFMDnHK6Gykx5n93T5TEHwvo= X-MC-Unique: kX9nKji6Mv6718bbQQTq6Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 05/15] qemu: add QEMU_CAPS_DEVICE_VHOST_USER_FS Date: Wed, 26 Feb 2020 12:57:03 +0100 Message-Id: <510e0f7453741711bf6772391e78b9677098e8b9.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduced by QEMU commit 98fc1ada4cf70af0f1df1a2d7183cf786fc7da05 virtio: add vhost-user-fs base device Released in QEMU v4.2.0. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 3 +++ tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + 7 files changed, 12 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7875776d94..c324f24dbd 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -561,6 +561,9 @@ VIR_ENUM_IMPL(virQEMUCaps, "virtio-net.failover", "tpm-spapr", "cpu.kvm-no-adjvtime", + + /* 355 */ + "vhost-user-fs", ); =20 =20 @@ -1278,6 +1281,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "i8042", QEMU_CAPS_DEVICE_I8042 }, { "rng-builtin", QEMU_CAPS_OBJECT_RNG_BUILTIN }, { "tpm-spapr", QEMU_CAPS_DEVICE_TPM_SPAPR }, + { "vhost-user-fs-device", QEMU_CAPS_DEVICE_VHOST_USER_FS }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[]= =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 7b6ed53863..5b483a2419 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -543,6 +543,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_DEVICE_TPM_SPAPR, /* -device tpm-spapr */ QEMU_CAPS_CPU_KVM_NO_ADJVTIME, /* cpu.kvm-no-adjvtime */ =20 + /* 355 */ + QEMU_CAPS_DEVICE_VHOST_USER_FS, /* -device vhost-user-fs */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_4.2.0.aarch64.xml index d0faa4c471..640ce29c8c 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -178,6 +178,7 @@ + 4001050 0 61700242 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_4.2.0.s390x.xml index 9275bf36fa..37776e1bbe 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -137,6 +137,7 @@ + 4001050 0 39100242 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.2.0.x86_64.xml index faed23f5c1..83e804ea36 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -222,6 +222,7 @@ + 4002000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_5.0.0.aarch64.xml index c05cea2eb7..e52c60607d 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -180,6 +180,7 @@ + 4002050 0 61700241 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.0.0.x86_64.xml index 1eef7197ef..6902cffd17 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -223,6 +223,7 @@ + 4002050 0 43100241 --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718276; cv=none; d=zohomail.com; s=zohoarc; b=I93y18NIlEUqsd4VdX3PdfT193i8ur7g/vD6zE7LwICIF9GtDRtyFxl/M7Zml4SMUrJtnBYchF0q8wBqLf/rJjAhkXxQluICL1POWJCxDzp2b2rhZS5u580oijDi2ObsvOsBwd3hYY0/ICWP0HEZDuVAwcHGP6ZAqjJNcIlHzWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718276; 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=7ya3clsowCr+tkec9+1DLrwOLqWJuRjjDoiWPFNRw5I=; b=AAXRbFTErl2I/r4hK+8wpyP7G/yrzDC7QvYp2BQZz6wt/ygnhe0UUYSrC6UthvN4O6TOrgvTt0xNeu4mIYsJHN0bC4Ulcllm2DQ3YyX+5MRzHzqajRhztx6BD6QWo+mIKqWe39GlyZ7VNKDdhf9Mz+ZGorgQQgyzXc9E5ADT86Y= 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 1582718276312641.4087362985838; Wed, 26 Feb 2020 03:57:56 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-428-dw8RN4jUM2SJeTTPso77AQ-1; Wed, 26 Feb 2020 06:57:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D968E800D6C; Wed, 26 Feb 2020 11:57:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B45D38C088; Wed, 26 Feb 2020 11:57:46 +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 60A071808855; Wed, 26 Feb 2020 11:57:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvNcT031532 for ; Wed, 26 Feb 2020 06:57:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 072EE8C087; Wed, 26 Feb 2020 11:57:23 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 828ED8C08A for ; Wed, 26 Feb 2020 11:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718275; 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=7ya3clsowCr+tkec9+1DLrwOLqWJuRjjDoiWPFNRw5I=; b=GhOSdARo42MDJB2GvUkXVkpzcUo62RzywRH9D/YN52igELfhUp9GDBR0MpwncDsocGG6+G 9F9S+WgJN4WaOevlPpg0VXGlCGgukWqeae5ukxTiKuRsONyxhQNwv7/j3IAt5K+oEBEK+i BuMQ3ffZnrX7dvF16oPb/R4hTFR2Xus= X-MC-Unique: dw8RN4jUM2SJeTTPso77AQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 06/15] docs: add virtiofs kbase Date: Wed, 26 Feb 2020 12:57:04 +0100 Message-Id: <9a226e8f44d62e3319ee162a439623aec122a454.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a document describing the usage of virtiofs. Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- docs/kbase.html.in | 3 + docs/kbase/virtiofs.rst | 152 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 docs/kbase/virtiofs.rst diff --git a/docs/kbase.html.in b/docs/kbase.html.in index db84b95b60..7055f4fda4 100644 --- a/docs/kbase.html.in +++ b/docs/kbase.html.in @@ -33,6 +33,9 @@
Security with= QEMU passthrough
Examination of the security protections used for QEMU and how = they need configuring to allow use of QEMU passthrough with host files/dev= ices.
+ +
Virtio-FS
+
Share a filesystem between the guest and the host
=20 diff --git a/docs/kbase/virtiofs.rst b/docs/kbase/virtiofs.rst new file mode 100644 index 0000000000..fe6885d139 --- /dev/null +++ b/docs/kbase/virtiofs.rst @@ -0,0 +1,152 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D +Sharing files with Virtio-FS +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D + +=3D=3D=3D 8< delete before merging 8< =3D=3D=3D +NOTE: if you're looking at this note, this is just a proposal. +See the up-to-date version on: https://libvirt.org/kbase/virtiofs.html +=3D=3D=3D 8< --------------------- 8< =3D=3D=3D + +.. contents:: + +=3D=3D=3D=3D=3D=3D=3D=3D=3D +Virtio-FS +=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Virtio-FS is a shared file system that lets virtual machines access +a directory tree on the host. Unlike existing approaches, it +is designed to offer local file system semantics and performance. + +See https://virtio-fs.gitlab.io/ + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Host setup +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The host-side virtiofsd daemon, like other vhost-user backed devices, +requires shared memory between the host and the guest. As of QEMU 4.2, this +requires specifying a NUMA topology for the guest and explicitly specifying +a memory backend. Multiple options are available: + +Either of the following: + +* Use file-backed memory + + Configure the directory where the files backing the memory will be stored + with the ``memory_backing_dir`` option in ``/etc/libvirt/qemu.conf`` + + :: + + # This directory is used for memoryBacking source if configured as fil= e. + # NOTE: big files will be stored here + memory_backing_dir =3D "/dev/shm/" + +* Use hugepage-backed memory + + Make sure there are enough huge pages allocated for the requested guest = memory. + For example, for one guest with 2 GiB of RAM backed by 2 MiB hugepages: + + :: + + # virsh allocpages 2M 1024 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Guest setup +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +#. Specify the NUMA topology + + in the domain XML of the guest. + For the simplest one-node topology for a guest with 2GiB of RAM and 8 v= CPUs: + + :: + + + ... + + + + + + ... + + + Note that the CPU element might already be specified and only one is al= lowed. + +#. Specify the memory backend + + Either of the following: + + * File-backed memory + + :: + + + ... + + + + ... + + + This will create a file in the directory specified in ``qemu.conf`` + + * Hugepage-backed memory + + :: + + + ... + + + + + + + ... + + +#. Add the ``vhost-user-fs`` QEMU device via the ``filesystem`` element + + :: + + + ... + + ... + + + + + + ... + + + + Note that despite its name, the ``target dir`` is actually a mount tag = and does + not have to correspond to the desired mount point in the guest. + + So far, ``passthrough`` is the only supported access mode and it requir= es + running the ``virtiofsd`` daemon as root. + +#. Boot the guest and mount the filesystem + + :: + + guest# mount -t virtiofs mount_tag /mnt/mount/path + + Note: this requires virtiofs support in the guest kernel (Linux v5.4 or= later) + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Optional parameters +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +More optional elements can be specified + +:: + + + + + + --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718347; cv=none; d=zohomail.com; s=zohoarc; b=Iv8IxmPCJyz+0p7zkkrE2u2wi3YeR8gKd1uAUJ2Qboppx7UYEZBR4SAclp/ZGphAxGr5CDnkRNBAb6naHeXsn40qwPvArs7azXO6nMREj+7zRAjsQQMnc+BIRh/Gga1/fh5yNtn677aAjx9HIkbzym/KmPBzcG0RsPysQiKHFRA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718347; 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=YiEv6fduH1HcqlSn4NTVg1iftl7oxsuRVAtusOebmd8=; b=mjzJN7NELf/jmGAlF488vP1zvvBPhCnsygMqVybxI/bb+jFiWJFwT5kLp9s/Ul6iFg0w39khs7KJ4Y69ej98ItX5pxAfU33DRumc1Gfiq25n4LWIRQw/Tbrx5RyV10sAS3hnt3g5/GE+e8sZogTfbsB1fYK8YmuMwDVhPFqxWcM= 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 158271834770646.599745914585355; Wed, 26 Feb 2020 03:59:07 -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-6-8PGCg6wON6iPO7Rj_8tDeg-1; Wed, 26 Feb 2020 06:57:58 -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 89DCA801F77; Wed, 26 Feb 2020 11:57:51 +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 5E0CD100164D; Wed, 26 Feb 2020 11:57:51 +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 166B38447D; Wed, 26 Feb 2020 11:57:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvNYi031543 for ; Wed, 26 Feb 2020 06:57:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id D22418C088; Wed, 26 Feb 2020 11:57:23 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 587C28C087 for ; Wed, 26 Feb 2020 11:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718345; 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=YiEv6fduH1HcqlSn4NTVg1iftl7oxsuRVAtusOebmd8=; b=efGS5q4oW2+hhwtxbBdgeOMuMdjm13EVOKqSSfV4xkjvqyJlH7o6JcsEHbdR4cyE4wf6Hh uO3wzFEFEhhOe06QWGFAZCW1i536hh/Y0f+6QVzBTico16fGxuAP0SYysEeBzQ4EXSvhKz 5L8eoB7Yb3Vy5BMTcIoXno4fO0z5Pm4= X-MC-Unique: 8PGCg6wON6iPO7Rj_8tDeg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 07/15] conf: qemu: add virtiofs fsdriver type Date: Wed, 26 Feb 2020 12:57:05 +0100 Message-Id: <241ab5e48eeb3b8022d6457b69e2c7daeefaacd7.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce a new 'virtiofs' driver type for filesystem.
Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- docs/formatdomain.html.in | 12 ++- docs/schemas/domaincommon.rng | 6 ++ src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 4 + src/qemu/qemu_domain.c | 4 + src/qemu/qemu_domain_address.c | 4 + .../vhost-user-fs-fd-memory.xml | 39 ++++++++++ .../vhost-user-fs-hugepages.xml | 74 +++++++++++++++++++ .../vhost-user-fs-fd-memory.x86_64-latest.xml | 1 + .../vhost-user-fs-hugepages.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 3 + 12 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml create mode 120000 tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64= -latest.xml create mode 120000 tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64= -latest.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 4fef2a0a97..28437ecad0 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3945,6 +3945,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> ... @@ -3973,6 +3978,9 @@ while the value immediate means that a host writeback is immediately triggered for all pages touched during a guest file write operation (since 0.9.10). + Since 6.1.0, type=3D'virtiofs'<= /code> + is also supported. Using virtiofs requires setting up shared memor= y, + see the guide: Virtio-FS
template
@@ -4008,7 +4016,9 @@ The filesystem element has an optional attribute accessmode which specifies the security mode for accessing the source (since 0.8.5). Currently this only works - with type=3D'mount' for the QEMU/KVM driver. The possib= le + with type=3D'mount' for the QEMU/KVM driver. + For driver type virtiofs, only passthrough= is + supported. For other driver types, the possible values are: =20
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 0e7b8d389e..fbe4c554a4 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2645,6 +2645,12 @@ + + + virtiofs + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 17867eeece..1418d5828f 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 4745d7c731..9921c25293 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -774,6 +774,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 2ea13621db..8ad859ad88 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2681,6 +2681,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 3dfa71650d..e1ee8d4692 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8302,6 +8302,10 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs, _("Filesystem driver type not supported")); return -1; =20 + case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: + /* TODO: vhost-user-fs-pci */ + return 0; + case VIR_DOMAIN_FS_DRIVER_TYPE_LAST: default: virReportEnumRangeError(virDomainFSDriverType, fs->fsdriver); diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index c7d8a3ac3b..ab6bce19f4 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -699,6 +699,10 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevi= ceDefPtr dev, } break; =20 + case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: + /* vhost-user-fs-pci */ + return virtioFlags; + case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP: case VIR_DOMAIN_FS_DRIVER_TYPE_NBD: case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP: diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml b/tests/qem= uxml2argvdata/vhost-user-fs-fd-memory.xml new file mode 100644 index 0000000000..a6b6279fb8 --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml @@ -0,0 +1,39 @@ + + guest + 126f2720-6f8e-45ab-a886-ec9277079a67 + 14680064 + 14680064 + + + + + 2 + + hvm + + + + qemu64 + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + +
+ + + + + + diff --git a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml b/tests/qem= uxml2argvdata/vhost-user-fs-hugepages.xml new file mode 100644 index 0000000000..70df7b890d --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml @@ -0,0 +1,74 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 4194304 + 4194304 + + + + + + + 2 + + hvm + + + + + + + + qemu64 + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + + + + diff --git a/tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest= .xml b/tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest.xml new file mode 120000 index 0000000000..fbc552ef94 --- /dev/null +++ b/tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/vhost-user-fs-fd-memory.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest= .xml b/tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml new file mode 120000 index 0000000000..0c0f05b254 --- /dev/null +++ b/tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/vhost-user-fs-hugepages.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 914f503516..9b6a235777 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1434,6 +1434,9 @@ mymain(void) DO_TEST("vhost-vsock-ccw-auto", QEMU_CAPS_DEVICE_VHOST_VSOCK, QEMU_CAPS_CCW); =20 + DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory"); + DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages"); + DO_TEST("riscv64-virt", QEMU_CAPS_DEVICE_VIRTIO_MMIO); DO_TEST("riscv64-virt-pci", --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718279; cv=none; d=zohomail.com; s=zohoarc; b=bleFnqNImnSMbEQJf+5L4q5xJP1tzihKoOOcQtp83mat4ntqOm4bUxyD1+Pz7jMzCVWYn++AaIm2r1TeFp1Z7lo2KVymdoOUiFQlQt7CEhk6+U5G3syv+fXBaJngdrOTZOGkPDT30GQ0dVb4uVszCDLf6T3ti7UGxGtmO2i6Bog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718279; 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=iA7GnvsYkvuJ0rfPEalZ/yet7x6FWzO/CBsyllolIrI=; b=kyEvtFviAthkpe0xvWNDEiFynC/nwMX00+i/LZfmjLdBNfgtWJCNPl7YY3tsIg6y9WYLzlb3kC5iYC4845IUe1p1+19Ks+lI/SMgdFwynC+AX8j/wi/CS1NuNuCWaS4cS6T9YtouWdR+S5rVja4Lzz2r+EIG/bMH140igxktVU8= 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 1582718279846137.5029907669384; Wed, 26 Feb 2020 03:57:59 -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-197-qZzJAcacNyGHRzcWD0vj4w-1; Wed, 26 Feb 2020 06:57:55 -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 BC3741005527; Wed, 26 Feb 2020 11:57:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9124E9297B; Wed, 26 Feb 2020 11:57:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4D32084474; Wed, 26 Feb 2020 11:57:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvOgd031550 for ; Wed, 26 Feb 2020 06:57:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id A59458C06A; Wed, 26 Feb 2020 11:57:24 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D6418B779 for ; Wed, 26 Feb 2020 11:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718278; 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=iA7GnvsYkvuJ0rfPEalZ/yet7x6FWzO/CBsyllolIrI=; b=Dm9OqiHt7GB6FyU3/yctkMz5cSOJQQrICW2f3OtWZ8lqMA+ODMkdmz66tkEpbovdOErJc6 usv8l+ktNTTK4e1t7cYYKj/seH21Gc/SjGLcoqvCPYuwCzQr8CkN98silWcMK4PBnEjUTh l2NlV3Jor2msI/Ax38ng0VcrGPeXyMU= X-MC-Unique: qZzJAcacNyGHRzcWD0vj4w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 08/15] conf: add virtiofs-related elements and attributes Date: Wed, 26 Feb 2020 12:57:06 +0100 Message-Id: <4e3ee8842fd4835a7f1d59b8785c2b8ca25eef17.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add more elements for tuning the virtiofsd daemon and the vhost-user-fs device: Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Masayoshi Mizuma Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- docs/formatdomain.html.in | 25 ++++- docs/schemas/domaincommon.rng | 48 ++++++++ src/conf/domain_conf.c | 104 +++++++++++++++++- src/conf/domain_conf.h | 15 +++ src/libvirt_private.syms | 1 + .../vhost-user-fs-fd-memory.xml | 6 +- .../vhost-user-fs-hugepages.xml | 1 + 7 files changed, 197 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 28437ecad0..edb63f066a 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3946,7 +3946,11 @@ <readonly/> </filesystem> <filesystem type=3D'mount' accessmode=3D'passthrough'> - <driver type=3D'virtiofs'/> + <driver type=3D'virtiofs queue=3D'1024'/> + <binary path=3D'/usr/libexec/virtiofsd' xattr=3D'on'> + <cache mode=3D'always'/> + <lock posix=3D'on' flock=3D'on'/> + </binary> <source dir=3D'/path'/> <target dir=3D'mount_tag'/> </filesystem> @@ -4073,9 +4077,28 @@ Virtio-specific options can also= be set. (Since 3.5.0) +
  • + For virtiofs, the queue attribute ca= n be used + to specify the queue size (i.e. how many requests can the queu= e fit). + (Since 6.1.0) +
  • =20 +
    binary
    +
    + The optional binary element can tune the options for = virtiofsd. + All of the following attributes and elements are optional. + The attribute path can be used to override the path t= o the daemon. + Attribute xattr enables the use of filesystem extende= d attributes. + Caching can be tuned via the cache element, possible = mode + values being none and always. + Locking can be controlled via the lock + element - attributes posix and flock bot= h accepting + values yes or no. + (Since 6.1.0) +
    +
    source
    The resource on the host that is being accessed in the guest. The diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index fbe4c554a4..529a98fc05 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2500,6 +2500,9 @@ + + + @@ -2649,12 +2652,57 @@ virtiofs + + + + + + + + + + + + + + + + + + + + + + + none + always + + + + + + + + + + + + + + + + + + + + + =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1418d5828f..bfb95dd2ce 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", @@ -2326,6 +2334,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def) virDomainDeviceInfoClear(&def->info); VIR_FREE(def->virtio); virObjectUnref(def->privateData); + VIR_FREE(def->binary); =20 VIR_FREE(def); } @@ -11369,6 +11378,63 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlop= t, } } =20 + if (def->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + g_autofree char *queue_size =3D virXPathString("string(./driver/@q= ueue)", ctxt); + g_autofree char *binary =3D virXPathString("string(./binary/@path)= ", ctxt); + g_autofree char *xattr =3D virXPathString("string(./binary/@xattr)= ", ctxt); + g_autofree char *cache =3D virXPathString("string(./binary/cache/@= mode)", ctxt); + g_autofree char *posix_lock =3D virXPathString("string(./binary/lo= ck/@posix)", ctxt); + g_autofree char *flock =3D virXPathString("string(./binary/lock/@f= lock)", ctxt); + int val; + + if (queue_size && virStrToLong_ull(queue_size, NULL, 10, &def->que= ue_size) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse queue size '%s' for virtiofs"), + queue_size); + goto error; + } + + if (binary) + def->binary =3D virFileSanitizePath(binary); + + if (xattr) { + if ((val =3D virTristateSwitchTypeFromString(xattr)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown xattr value '%s'"), xattr); + goto error; + } + def->xattr =3D val; + } + + if (cache) { + if ((val =3D virDomainFSCacheModeTypeFromString(cache)) <=3D 0= ) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse cache mode '%s' for virtiof= s"), + cache); + goto error; + } + def->cache =3D val; + } + + if (posix_lock) { + if ((val =3D virTristateSwitchTypeFromString(posix_lock)) <=3D= 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown posix lock value '%s'"), posix_l= ock); + goto error; + } + def->posix_lock =3D val; + } + + if (flock) { + if ((val =3D virTristateSwitchTypeFromString(flock)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown flock value '%s'"), flock); + goto error; + } + def->flock =3D val; + } + } + if (format) { if ((def->format =3D virStorageFileFormatTypeFromString(format)) <= =3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -25206,6 +25272,9 @@ virDomainFSDefFormat(virBufferPtr buf, const char *wrpolicy =3D virDomainFSWrpolicyTypeToString(def->wrpolicy= ); const char *src =3D def->src->path; g_auto(virBuffer) driverAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) driverBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) binaryAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) binaryBuf =3D VIR_BUFFER_INIT_CHILD(buf); =20 if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -25229,6 +25298,8 @@ virDomainFSDefFormat(virBufferPtr buf, virBufferAddLit(buf, ">\n"); =20 virBufferAdjustIndent(buf, 2); + virBufferAdjustIndent(&driverBuf, 2); + virBufferAdjustIndent(&binaryBuf, 2); if (def->fsdriver) { virBufferAsprintf(&driverAttrBuf, " type=3D'%s'", fsdriver); =20 @@ -25240,11 +25311,42 @@ virDomainFSDefFormat(virBufferPtr buf, if (def->wrpolicy) virBufferAsprintf(&driverAttrBuf, " wrpolicy=3D'%s'", wrpolicy= ); =20 + if (def->queue_size) + virBufferAsprintf(&driverAttrBuf, " queue=3D'%llu'", def->queu= e_size); + + } + + if (def->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + g_auto(virBuffer) lockAttrBuf =3D VIR_BUFFER_INITIALIZER; + virBufferEscapeString(&binaryAttrBuf, " path=3D'%s'", def->binary); + + if (def->xattr !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&binaryAttrBuf, " xattr=3D'%s'", + virTristateSwitchTypeToString(def->xattr)); + } + + if (def->cache !=3D VIR_DOMAIN_FS_CACHE_MODE_DEFAULT) { + virBufferAsprintf(&binaryBuf, "\n", + virDomainFSCacheModeTypeToString(def->cache)= ); + } + + if (def->posix_lock !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&lockAttrBuf, " posix=3D'%s'", + virTristateSwitchTypeToString(def->posix_loc= k)); + } + + if (def->flock !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&lockAttrBuf, " flock=3D'%s'", + virTristateSwitchTypeToString(def->flock)); + } + + virXMLFormatElement(&binaryBuf, "lock", &lockAttrBuf, NULL); } =20 virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio); =20 - virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL); + virXMLFormatElement(buf, "driver", &driverAttrBuf, &driverBuf); + virXMLFormatElement(buf, "binary", &binaryAttrBuf, &binaryBuf); =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 9921c25293..91b776c28a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -805,6 +805,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 */ @@ -820,6 +828,12 @@ struct _virDomainFSDef { unsigned long long space_hard_limit; /* in bytes */ unsigned long long space_soft_limit; /* in bytes */ bool symlinksResolved; + char *binary; + unsigned long long queue_size; + virTristateSwitch xattr; + virDomainFSCacheMode cache; + virTristateSwitch posix_lock; + virTristateSwitch flock; virDomainVirtioOptionsPtr virtio; virObjectPtr privateData; }; @@ -3451,6 +3465,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 de0c7a3133..8563695c32 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -395,6 +395,7 @@ virDomainDiskSourceFormat; virDomainDiskTranslateSourcePool; virDomainFeatureTypeFromString; virDomainFeatureTypeToString; +virDomainFSCacheModeTypeToString; virDomainFSDefFree; virDomainFSDefNew; virDomainFSDriverTypeToString; diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml b/tests/qem= uxml2argvdata/vhost-user-fs-fd-memory.xml index a6b6279fb8..f6bb663e97 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml @@ -27,7 +27,11 @@ - + + + + +
    diff --git a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml b/tests/qem= uxml2argvdata/vhost-user-fs-hugepages.xml index 70df7b890d..96b9774704 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml @@ -63,6 +63,7 @@ +
    --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718287; cv=none; d=zohomail.com; s=zohoarc; b=LTQDvJrE1vzxkqWgYifhn5ySPHBfvhOcQGHdhcoMkTfNJKxEURYTGO0BlUVZEJAjlShUtXkgfLWyeHgLENj0RArnd892XT4j06H9+iOHJWueO+FUGYQ77bjZrm8+Z7OmDYBYDodfDCHFOKonpWVi8LQUcqwrMW6bdgunhdyZJMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718287; 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=HvlRfLetzlSCkjB0jnix4RVUIHDDy+IkUqTQCQPLLTw=; b=UA48TdDDKO0+xBG4O2HXiC2y2ntwT2y0vpIV2U15ZX1FqyHfiYC7qS2G6LSZLO3d3DjryK0d1FH3IkCAnP2ZvsDatVyIu95+28duxrnFTakGAfFRzKUDNedjNToVRFAiWZuk4DYjXqev/WsBQPDnjmZzQr8wdoQJddQOkQZ/CtQ= 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 1582718287892977.7587892398192; Wed, 26 Feb 2020 03:58:07 -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-242-ZYJnRcPZPvCxkpWhgntwjA-1; Wed, 26 Feb 2020 06:58:03 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 56C421005512; Wed, 26 Feb 2020 11:57:55 +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 2EA768C08A; Wed, 26 Feb 2020 11:57:55 +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 DFBF81803C32; Wed, 26 Feb 2020 11:57:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvPe6031559 for ; Wed, 26 Feb 2020 06:57:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 78F828C073; Wed, 26 Feb 2020 11:57:25 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 002D08B779 for ; Wed, 26 Feb 2020 11:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718286; 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=HvlRfLetzlSCkjB0jnix4RVUIHDDy+IkUqTQCQPLLTw=; b=cYPGmyMKOGjOKXfUQHaVmsWnm27blK4E7+o3Xv/GBEOny31pEM6u5UtpQOlcAxcNfBiRTq bIC3zR2tSt/bIydeGxPQbuiLJlakRsd1sBQrfKeJZyaQ+N6jvodUKH569sOF9rFbkrZKo9 5Kczvh8/fwPcsqrsVWRTHNc1jaXh/0I= X-MC-Unique: ZYJnRcPZPvCxkpWhgntwjA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 09/15] qemu: add virtiofsd_debug to qemu.conf Date: Wed, 26 Feb 2020 12:57:07 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a 'virtiofsd_debug' option for tuning whether to run virtiofsd in debug mode. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 7 +++++++ src/qemu/qemu_conf.c | 2 ++ src/qemu/qemu_conf.h | 1 + src/qemu/test_libvirtd_qemu.aug.in | 1 + 5 files changed, 12 insertions(+) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index 557b6f38f8..3014fa6b86 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -116,6 +116,7 @@ module Libvirtd_qemu =3D let nvram_entry =3D str_array_entry "nvram" =20 let debug_level_entry =3D int_entry "gluster_debug_level" + | bool_entry "virtiofsd_debug" =20 let memory_entry =3D str_entry "memory_backing_dir" =20 diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index b6805ffc41..815d2d78ae 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -809,6 +809,13 @@ # #gluster_debug_level =3D 9 =20 +# virtiofsd debug +# +# Whether to enable the debugging output of the virtiofsd daemon. +# Possible values are 0 or 1. Disabled by default. +# +#virtiofsd_debug =3D 1 + # To enhance security, QEMU driver is capable of creating private namespac= es # for each domain started. Well, so far only "mount" namespace is supporte= d. If # enabled it means qemu process is unable to see all the devices on the sy= stem, diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index eeb29f46bd..17a6eb3422 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -836,6 +836,8 @@ virQEMUDriverConfigLoadDebugEntry(virQEMUDriverConfigPt= r cfg, { if (virConfGetValueUInt(conf, "gluster_debug_level", &cfg->glusterDebu= gLevel) < 0) return -1; + if (virConfGetValueBool(conf, "virtiofsd_debug", &cfg->virtiofsdDebug)= < 0) + return -1; =20 return 0; } diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index cedf232223..3ce9566b71 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -202,6 +202,7 @@ struct _virQEMUDriverConfig { virFirmwarePtr *firmwares; size_t nfirmwares; unsigned int glusterDebugLevel; + bool virtiofsdDebug; =20 char *memoryBackingDir; =20 diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index dd90edf687..fca9a942c9 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -98,6 +98,7 @@ module Test_libvirtd_qemu =3D } { "stdio_handler" =3D "logd" } { "gluster_debug_level" =3D "9" } +{ "virtiofsd_debug" =3D "1" } { "namespaces" { "1" =3D "mount" } } --=20 2.24.1 From nobody Sun Apr 28 19:02:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582718282; cv=none; d=zohomail.com; s=zohoarc; b=eEoN0Ljj5Ylj3aA4hveoK7SShfDRUpbElq3Pz8AJ0UYB/1AELJO97OfCJVeMkPQaQahQ2gPxzJP7s8pyDeMEK4bRCueaLYSnIo7lPTlre/Qnf2wkXBg2QcTZADIHntnaewv6qsdrqyNIb9dbp7uODSqFC/tp5WsOmwx6vcyKxaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718282; 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=wXAivo/myFieIO+WIUAbb7KUCnGQ+ZIahTSTiXQzST0=; b=NVt6PlMplnDZPLmYu7PHUsI23N8QObirfJxoxuJFMV9CiE3AF5rqBMtgxV5uqKtsR5pfoYN8QPesVVe16NmGJI7O2YDXOzTJ/l5fEJ/kOyyK3XFWyMx2BpQEE/iZBzLDUDzM6poCQV4OO0hZ9V0lUy1dVaLb6eLjichtLs9Kgt8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1582718282860845.4745572671484; Wed, 26 Feb 2020 03:58:02 -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-14-E8oLW2jiOOWrmnsalCL6zw-1; Wed, 26 Feb 2020 06:57:58 -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 70AC98010F3; Wed, 26 Feb 2020 11:57:53 +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 38F4D396; Wed, 26 Feb 2020 11:57:53 +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 E0422180612F; Wed, 26 Feb 2020 11:57:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvQnf031572 for ; Wed, 26 Feb 2020 06:57:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4BE9B8C06A; Wed, 26 Feb 2020 11:57:26 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id C79BC8C088 for ; Wed, 26 Feb 2020 11:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718281; 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=wXAivo/myFieIO+WIUAbb7KUCnGQ+ZIahTSTiXQzST0=; b=IR5R2uiaIfpJSx0iDqZNp7WTXqiGsWfiY5rTYLZ2BYpVpjF4t0y8t+eqyj2MbvNx0U/CU8 JQo3EGPvHhQ4QX6Q7Lo0qWChrJ/uZdNZURygmk1ys9SXRCbI2O7IOanxe0nLpwSTH64uO5 oZeoQ20UGycJCj8AIMFMCgNK3XmS5n4= X-MC-Unique: E8oLW2jiOOWrmnsalCL6zw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 10/15] qemu: validate virtiofs filesystems Date: Wed, 26 Feb 2020 12:57:08 +0100 Message-Id: <59e22c801475c0f6f02eb1852d5fa9b3094758ab.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Reject unsupported configurations. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Masayoshi Mizuma Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 82 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e1ee8d4692..d85c089dce 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8270,11 +8270,52 @@ qemuDomainDeviceDefValidateIOMMU(const virDomainIOM= MUDef *iommu, return 0; } =20 +static int +qemuDomainDefValidateVirtioFSSharedMemory(const virDomainDef *def) +{ + size_t numa_nodes =3D virDomainNumaGetNodeCount(def->numa); + size_t i; + + if (numa_nodes =3D=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs requires one or more NUMA nodes")); + return -1; + } + + for (i =3D 0; i < numa_nodes; i++) { + virDomainMemoryAccess node_access =3D + virDomainNumaGetNodeMemoryAccessMode(def->numa, i); + + switch (node_access) { + case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT: + if (def->mem.access !=3D VIR_DOMAIN_MEMORY_ACCESS_SHARED) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs requires shared memory")); + return -1; + } + break; + case VIR_DOMAIN_MEMORY_ACCESS_SHARED: + break; + case VIR_DOMAIN_MEMORY_ACCESS_PRIVATE: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs requires shared memory")); + return -1; + + case VIR_DOMAIN_MEMORY_ACCESS_LAST: + default: + virReportEnumRangeError(virDomainMemoryAccess, node_access); + return -1; + + } + } + return 0; +} =20 static int qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs, - const virDomainDef *def G_GNUC_UNUSED, - virQEMUCapsPtr qemuCaps G_GNUC_UNUSED) + const virDomainDef *def, + virQEMUDriverPtr driver, + virQEMUCapsPtr qemuCaps) { if (fs->type !=3D VIR_DOMAIN_FS_TYPE_MOUNT) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -8303,8 +8344,39 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs, return -1; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: - /* TODO: vhost-user-fs-pci */ - return 0; + if (!virQEMUDriverIsPrivileged(driver)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs is not yet supported in session mod= e")); + 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 (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_FS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs is not supported with this QEMU bin= ary")); + return -1; + } + if (qemuDomainDefValidateVirtioFSSharedMemory(def) < 0) + return -1; + break; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_LAST: default: @@ -8483,7 +8555,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, break; =20 case VIR_DOMAIN_DEVICE_FS: - ret =3D qemuDomainDeviceDefValidateFS(dev->data.fs, def, qemuCaps); + ret =3D qemuDomainDeviceDefValidateFS(dev->data.fs, def, driver, q= emuCaps); break; =20 case VIR_DOMAIN_DEVICE_NVRAM: --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718344; cv=none; d=zohomail.com; s=zohoarc; b=HDSnsqwKqcWnX/ljkCDn6F0yodY34NibFUpBTmr5p7YOiWYhh2IJ9YNzQNwLXhM8tOFqtlhM7EwP0EcbCtDWs2iA9jHD2/FIdl6hjB71dp2YNvjY/B67UiaFUE6Cmpces+97WQxz11ExotFmtymlqPDZ4wZNvtiXF2RL+thkpXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718344; 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=mp0r3Cp0LVeOLI04Wv/oKOPx7+4XtTXPOeTRVmHmVOY=; b=HRCQrnbSWa6S4vIa75Wsy/jt+I+p22YLEj+QS8msPdqP7in/0beLdwu0Dam4J2JPRh/PuMlqQ24Rfjpob6CI3Xo1/dvsW4wd7CkT1YSIITHdO4ZywNu+cNFB6AvMyV4/qrmbrTijWaVrtpfeDfFzbbiTgXocCTiqLo5FlDB5NPE= 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 1582718344116749.911970287496; Wed, 26 Feb 2020 03:59:04 -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-273-rBIXsn87PkqoYdo_1Q5zGA-1; Wed, 26 Feb 2020 06:58:04 -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 D0AF818FE866; Wed, 26 Feb 2020 11:57:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A665491832; Wed, 26 Feb 2020 11:57:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5BE761803C41; Wed, 26 Feb 2020 11:57:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvRD9031583 for ; Wed, 26 Feb 2020 06:57:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1EB2A8C088; Wed, 26 Feb 2020 11:57:27 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A8C38C06A for ; Wed, 26 Feb 2020 11:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718342; 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=mp0r3Cp0LVeOLI04Wv/oKOPx7+4XtTXPOeTRVmHmVOY=; b=QYATHssUE/K6PJkibTg8zfxmvi9U5Tde7snJU9Hwcpdcs9M70rT6D62ikFhff8Ag6uE/eJ GEyGQN+8HBXlCVqV+fWJBgq62j2iY1FBgdlCjtJrta40uk31PpQgTtgCCZFZTfWau+BrUA bJ4n99LD24K/Dz2iqIlZVrYagFI0kGA= X-MC-Unique: rBIXsn87PkqoYdo_1Q5zGA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 11/15] qemu: forbid migration with vhost-user-fs device Date: Wed, 26 Feb 2020 12:57:09 +0100 Message-Id: <8b09fe750471cd86dccf3fd15ac76c75f1411036.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is not yet supported. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- src/qemu/qemu_migration.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 3fc5388d6a..d37a7ec6c7 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1281,6 +1281,16 @@ qemuMigrationSrcIsAllowed(virQEMUDriverPtr driver, return false; } } + + for (i =3D 0; i < vm->def->nfss; i++) { + virDomainFSDefPtr fs =3D vm->def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("migration with virtiofs device is not su= pported")); + return false; + } + } } =20 return true; --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718276; cv=none; d=zohomail.com; s=zohoarc; b=kzGpwUbw/ftjh6m8YN6wLjl95Ok9ogFXc+pX/HpIIj9BBOXgliPgLOG5iq7Yfcm7hGrYWB84iJkf7BHc7halqB+exJbmWKaQ0XtKoJPnybgVFveyN8EJrX5oqge+ZdK+kezy+q+KJwi9yaWXnes4jmOgSPLY7FpvhJEYC6lHbrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718276; 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=oTh5T8VXXBT9J89eedtlmxR/8umg9NGCJIpBGovHUbo=; b=k4tauvfOrF5niVkYt/8sqK+ioeX0CvniZpw4dQ5a9P42F6QNOAU4pNGOh2Gy/S7BYJivNil5f+RcEdpeWmLguqQMmUtLBnQmsubFC/vy1HYeK6O9Zra4IQUYNycEJ7hVDh+N/b/iif8vvsON8+Vni5PyViaHrVvE8RakqJLyjIc= 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 1582718276273540.1930238635363; Wed, 26 Feb 2020 03:57:56 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-345-o1cxGjfCPhWQJbc-95ljSg-1; Wed, 26 Feb 2020 06:57:52 -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 0122A801F74; Wed, 26 Feb 2020 11:57:47 +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 C536D90CC8; Wed, 26 Feb 2020 11:57:46 +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 71A641808878; Wed, 26 Feb 2020 11:57:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvS4O031597 for ; Wed, 26 Feb 2020 06:57:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 189F78C088; Wed, 26 Feb 2020 11:57:28 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E2BA8C06A for ; Wed, 26 Feb 2020 11:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718275; 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=oTh5T8VXXBT9J89eedtlmxR/8umg9NGCJIpBGovHUbo=; b=H+QEu13wSIR+L+C1iZDNJRMY7ipYV82Nde1W1SKkXSGHdi+uO9VMomhjFASS8ifGvrhMEY CdkuZ5xVGJy+PSLWM8xCvo3ACDl9sa54AEB1rr4MKAsZNEMi/GwzsqJCYyvtqhYhmkMc5u qJ9ivOTBgnpz0oaQx0X3/NocL2XJ/ew= X-MC-Unique: o1cxGjfCPhWQJbc-95ljSg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 12/15] qemu: add code for handling virtiofsd Date: Wed, 26 Feb 2020 12:57:10 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Start virtiofsd for each device using it. Pre-create the socket for communication with QEMU and pass it to virtiofsd. Note that virtiofsd needs to run as root. https://bugzilla.redhat.com/show_bug.cgi?id=3D1694166 Introduced by QEMU commit a43efa34c7d7b628cbf1ec0fe60043e5c91043ea Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- po/POTFILES.in | 1 + src/qemu/Makefile.inc.am | 2 + src/qemu/qemu_domain.c | 5 +- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_extdevice.c | 20 ++- src/qemu/qemu_virtiofs.c | 301 ++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_virtiofs.h | 37 +++++ tests/qemuxml2argvtest.c | 11 ++ 8 files changed, 376 insertions(+), 3 deletions(-) create mode 100644 src/qemu/qemu_virtiofs.c create mode 100644 src/qemu/qemu_virtiofs.h diff --git a/po/POTFILES.in b/po/POTFILES.in index fe361204bb..982f2ebc36 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -172,6 +172,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 94a333f855..51cd79879d 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 d85c089dce..33c2158eb5 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1433,8 +1433,11 @@ qemuDomainFSPrivateNew(void) =20 =20 static void -qemuDomainFSPrivateDispose(void *obj G_GNUC_UNUSED) +qemuDomainFSPrivateDispose(void *obj) { + qemuDomainFSPrivatePtr priv =3D obj; + + g_free(priv->vhostuser_fs_sock); } =20 static virClassPtr qemuDomainVideoPrivateClass; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f8fb48f2ff..476056c73f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -568,7 +568,7 @@ typedef qemuDomainFSPrivate *qemuDomainFSPrivatePtr; struct _qemuDomainFSPrivate { virObject parent; =20 - int dummy; + char *vhostuser_fs_sock; }; =20 =20 diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index bb73787b8d..bfa770f45a 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -20,11 +20,13 @@ =20 #include =20 +#include "qemu_command.h" #include "qemu_extdevice.h" #include "qemu_vhost_user_gpu.h" #include "qemu_domain.h" #include "qemu_tpm.h" #include "qemu_slirp.h" +#include "qemu_virtiofs.h" =20 #include "viralloc.h" #include "virlog.h" @@ -153,7 +155,7 @@ qemuExtDevicesCleanupHost(virQEMUDriverPtr driver, int qemuExtDevicesStart(virQEMUDriverPtr driver, virDomainObjPtr vm, - virLogManagerPtr logManager G_GNUC_UNUSED, + virLogManagerPtr logManager, bool incomingMigration) { virDomainDefPtr def =3D vm->def; @@ -183,6 +185,15 @@ qemuExtDevicesStart(virQEMUDriverPtr driver, return -1; } =20 + for (i =3D 0; i < def->nfss; i++) { + virDomainFSDefPtr fs =3D def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + if (qemuVirtioFSStart(logManager, driver, vm, fs) < 0) + return -1; + } + } + return 0; } =20 @@ -214,6 +225,13 @@ qemuExtDevicesStop(virQEMUDriverPtr driver, if (slirp) qemuSlirpStop(slirp, vm, driver, net, false); } + + for (i =3D 0; i < def->nfss; i++) { + virDomainFSDefPtr fs =3D def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) + qemuVirtioFSStop(driver, vm, fs); + } } =20 =20 diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c new file mode 100644 index 0000000000..09ab2cef27 --- /dev/null +++ b/src/qemu/qemu_virtiofs.c @@ -0,0 +1,301 @@ +/* + * qemu_virtiofs.c: virtiofs support + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include +#include +#include + +#include "logging/log_manager.h" +#include "virlog.h" +#include "qemu_command.h" +#include "qemu_conf.h" +#include "qemu_extdevice.h" +#include "qemu_security.h" +#include "qemu_virtiofs.h" +#include "virpidfile.h" +#include "virqemu.h" +#include "virutil.h" + +#define VIR_FROM_THIS VIR_FROM_QEMU + + +char * +qemuVirtioFSCreatePidFilename(virDomainObjPtr vm, + const char *alias) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + g_autofree char *shortName =3D NULL; + g_autofree char *name =3D NULL; + + if (!(shortName =3D virDomainDefGetShortName(vm->def))) + return NULL; + + name =3D g_strdup_printf("%s-%s-virtiofsd", shortName, alias); + + return virPidFileBuildPath(priv->libDir, name); +} + + +char * +qemuVirtioFSCreateSocketFilename(virDomainObjPtr vm, + const char *alias) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + + return virFileBuildPath(priv->libDir, alias, "-virtiofsd.sock"); +} + + +static char * +qemuVirtioFSCreateLogFilename(virQEMUDriverConfigPtr cfg, + const virDomainDef *def, + const char *alias) +{ + g_autofree char *name =3D NULL; + + name =3D g_strdup_printf("%s-%s", def->name, alias); + + return virFileBuildPath(cfg->logDir, name, "-virtiofsd.log"); +} + + +static int +qemuVirtioFSOpenChardev(virQEMUDriverPtr driver, + virDomainObjPtr vm, + const char *socket_path) +{ + virDomainChrSourceDefPtr chrdev =3D virDomainChrSourceDefNew(NULL); + virDomainChrDef chr =3D { .source =3D chrdev }; + VIR_AUTOCLOSE fd =3D -1; + int ret =3D -1; + + chrdev->type =3D VIR_DOMAIN_CHR_TYPE_UNIX; + chrdev->data.nix.listen =3D true; + chrdev->data.nix.path =3D g_strdup(socket_path); + + if (qemuSecuritySetDaemonSocketLabel(driver->securityManager, vm->def)= < 0) + goto cleanup; + fd =3D qemuOpenChrChardevUNIXSocket(chrdev); + if (fd < 0) { + ignore_value(qemuSecurityClearSocketLabel(driver->securityManager,= vm->def)); + goto cleanup; + } + if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0) + goto cleanup; + + if (qemuSecuritySetChardevLabel(driver, vm, &chr) < 0) + goto cleanup; + + ret =3D fd; + fd =3D -1; + + cleanup: + virObjectUnref(chrdev); + return ret; +} + + +static virCommandPtr +qemuVirtioFSBuildCommandLine(virQEMUDriverConfigPtr cfg, + virDomainFSDefPtr fs, + int *fd) +{ + g_autoptr(virCommand) cmd =3D NULL; + g_auto(virBuffer) opts =3D VIR_BUFFER_INITIALIZER; + + if (!(cmd =3D virCommandNew(fs->binary))) + return NULL; + + virCommandAddArgFormat(cmd, "--fd=3D%d", *fd); + virCommandPassFD(cmd, *fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); + *fd =3D -1; + + virCommandAddArg(cmd, "-o"); + virBufferAddLit(&opts, "source=3D"); + virQEMUBuildBufferEscapeComma(&opts, fs->src->path); + if (fs->cache) + virBufferAsprintf(&opts, ",cache=3D%s", virDomainFSCacheModeTypeTo= String(fs->cache)); + + if (fs->xattr =3D=3D VIR_TRISTATE_SWITCH_ON) + virBufferAddLit(&opts, ",xattr"); + else if (fs->xattr =3D=3D VIR_TRISTATE_SWITCH_OFF) + virBufferAddLit(&opts, ",no_xattr"); + + if (fs->flock =3D=3D VIR_TRISTATE_SWITCH_ON) + virBufferAddLit(&opts, ",flock"); + else if (fs->flock =3D=3D VIR_TRISTATE_SWITCH_OFF) + virBufferAddLit(&opts, ",no_flock"); + + if (fs->posix_lock =3D=3D VIR_TRISTATE_SWITCH_ON) + virBufferAddLit(&opts, ",posix_lock"); + else if (fs->posix_lock =3D=3D VIR_TRISTATE_SWITCH_OFF) + virBufferAddLit(&opts, ",no_posix_lock"); + + virCommandAddArgBuffer(cmd, &opts); + if (cfg->virtiofsdDebug) + virCommandAddArg(cmd, "-d"); + + return g_steal_pointer(&cmd); +} + +int +qemuVirtioFSStart(virLogManagerPtr logManager, + virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainFSDefPtr fs) +{ + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virCommand) cmd =3D NULL; + g_autofree char *socket_path =3D NULL; + g_autofree char *pidfile =3D NULL; + g_autofree char *logpath =3D NULL; + pid_t pid =3D (pid_t) -1; + VIR_AUTOCLOSE fd =3D -1; + VIR_AUTOCLOSE logfd =3D -1; + int ret =3D -1; + int rc; + + if (!virFileExists(fs->src->path)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("the virtiofs export directory '%s' does not exis= t"), + fs->src->path); + return -1; + } + + if (!(pidfile =3D qemuVirtioFSCreatePidFilename(vm, fs->info.alias))) + goto cleanup; + + if (!(socket_path =3D qemuVirtioFSCreateSocketFilename(vm, fs->info.al= ias))) + goto cleanup; + + if ((fd =3D qemuVirtioFSOpenChardev(driver, vm, socket_path)) < 0) + goto cleanup; + + logpath =3D qemuVirtioFSCreateLogFilename(cfg, vm->def, fs->info.alias= ); + + if (cfg->stdioLogD) { + if ((logfd =3D virLogManagerDomainOpenLogFile(logManager, + "qemu", + vm->def->uuid, + vm->def->name, + logpath, + 0, + NULL, NULL)) < 0) + goto cleanup; + } else { + if ((logfd =3D open(logpath, O_WRONLY | O_CREAT | O_APPEND, S_IRUS= R | S_IWUSR)) < 0) { + virReportSystemError(errno, _("failed to create logfile %s"), + logpath); + goto cleanup; + } + if (virSetCloseExec(logfd) < 0) { + virReportSystemError(errno, _("failed to set close-on-exec fla= g on %s"), + logpath); + goto error; + } + } + + if (!(cmd =3D qemuVirtioFSBuildCommandLine(cfg, fs, &fd))) + goto cleanup; + + /* so far only running as root is supported */ + virCommandSetUID(cmd, 0); + virCommandSetGID(cmd, 0); + + virCommandSetPidFile(cmd, pidfile); + virCommandSetOutputFD(cmd, &logfd); + virCommandSetErrorFD(cmd, &logfd); + virCommandNonblockingFDs(cmd); + virCommandDaemonize(cmd); + + if (qemuExtDeviceLogCommand(driver, vm, cmd, "virtiofsd") < 0) + goto cleanup; + + rc =3D virCommandRun(cmd, NULL); + + if (rc < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not start 'virtiofsd'")); + goto error; + } + + rc =3D virPidFileReadPath(pidfile, &pid); + if (rc < 0) { + virReportSystemError(-rc, + _("Unable to read virtiofsd pidfile '%s'"), + pidfile); + goto error; + } + + if (virProcessKill(pid, 0) !=3D 0) { + virReportSystemError(errno, "%s", + _("virtiofsd died unexpectedly")); + goto error; + } + + QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock =3D g_steal_pointer(&soc= ket_path); + ret =3D 0; + + cleanup: + if (socket_path) + unlink(socket_path); + return ret; + + error: + if (pid !=3D -1) + virProcessKillPainfully(pid, true); + if (pidfile) + unlink(pidfile); + goto cleanup; +} + + +void +qemuVirtioFSStop(virQEMUDriverPtr driver G_GNUC_UNUSED, + virDomainObjPtr vm, + virDomainFSDefPtr fs) +{ + g_autofree char *pidfile =3D NULL; + virErrorPtr orig_err; + pid_t pid =3D -1; + int rc; + + virErrorPreserveLast(&orig_err); + + if (!(pidfile =3D qemuVirtioFSCreatePidFilename(vm, 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..b2f0c57d0c --- /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(virDomainObjPtr vm, + const char *alias); +char * +qemuVirtioFSCreateSocketFilename(virDomainObjPtr vm, + const char *alias); + +int +qemuVirtioFSStart(virLogManagerPtr logManager, + virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainFSDefPtr fs); +void +qemuVirtioFSStop(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainFSDefPtr fs); diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 038fd97580..abbc273889 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -496,6 +496,17 @@ testCompareXMLToArgv(const void *data) } } =20 + for (i =3D 0; i < vm->def->nfss; i++) { + virDomainFSDefPtr fs =3D vm->def->fss[i]; + char *s; + + if (fs->fsdriver !=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) + continue; + + s =3D g_strdup_printf("/tmp/lib/domain--1-guest/fs%zu.vhost-fs.soc= k", i); + QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock =3D s; + } + if (vm->def->vsock) { virDomainVsockDefPtr vsock =3D vm->def->vsock; qemuDomainVsockPrivatePtr vsockPriv =3D --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718280; cv=none; d=zohomail.com; s=zohoarc; b=mGQbLzVehkiV1UxBx+mecOhT7fEgi/As+gPbs6/lh3C08AG2I4f3zC3hgQ8dyIXowOQBZzPy8guljQz7N0/b84xxEDT8oGrcZML17WPv0eGr8+IDWd78nnLpgZyidC1BPgxZIRceSH8AZS5XLjA93ZxKhEXATz+/NRx/CUonuzI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718280; 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=mt2ofv4irWFbWD2tDwbBqjm9Q6jlCXrnyC5+j8sU1z8=; b=U9wdSXhKWPsACU2NgkgMpfatbIc8d8HsEQul1+C1O/qYBaJTFQK9Jm0ZtIrIe7SZKmc7y+jPi3oopzb2mpoR5Hs4PvvxGKXjxokhx2w5luofWmKdaW0Wi6/0/EYjS3DdYtc8DQrP5iFXGQgBm02K9N5nox+5H617wtiZO/4KosI= 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 1582718280781373.54521979512697; Wed, 26 Feb 2020 03:58:00 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-FTAQ6a4PPgaVZkHBcaGdHg-1; Wed, 26 Feb 2020 06:57:57 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CAA5518FE866; Wed, 26 Feb 2020 11:57:51 +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 A09FB8C073; Wed, 26 Feb 2020 11:57:51 +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 13AE38447C; Wed, 26 Feb 2020 11:57:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvS8P031630 for ; Wed, 26 Feb 2020 06:57:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id E11A68C06A; Wed, 26 Feb 2020 11:57:28 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67FA08C08C for ; Wed, 26 Feb 2020 11:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718279; 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=mt2ofv4irWFbWD2tDwbBqjm9Q6jlCXrnyC5+j8sU1z8=; b=iu4reRFI5n/Slg8vHgb8UUVo+y5g7VedOvcJSms4OVwqVJF7M9Esq6o5cMWb5zXQh/3ZUy 75GGtOPK18tSj3AuJe+1sMsKCNnRyhl6lpEVoiO3LGQ2kGyVMoy9AfxC8qXORw2t6yXLE6 iMMpxDYianihcsMDH9hEClHppvxt3bc= X-MC-Unique: FTAQ6a4PPgaVZkHBcaGdHg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 13/15] qemu: put virtiofsd in the emulator cgroup Date: Wed, 26 Feb 2020 12:57:11 +0100 Message-Id: <9bf5fc3ca7aaeac7f312527ce1e51b20034bde0a.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Wire up the code to put virtiofsd in the emulator cgroup on domain startup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- src/qemu/qemu_extdevice.c | 15 +++++++++++++++ src/qemu/qemu_virtiofs.c | 26 ++++++++++++++++++++++++++ src/qemu/qemu_virtiofs.h | 5 +++++ 3 files changed, 46 insertions(+) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index bfa770f45a..f66bafb62f 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -248,6 +248,13 @@ qemuExtDevicesHasDevice(virDomainDefPtr def) if (def->tpm && def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) return true; =20 + for (i =3D 0; i < def->nfss; i++) { + virDomainFSDefPtr fs =3D def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) + return true; + } + return false; } =20 @@ -272,5 +279,13 @@ qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver, qemuExtTPMSetupCgroup(driver, def, cgroup) < 0) return -1; =20 + for (i =3D 0; i < def->nfss; i++) { + virDomainFSDefPtr fs =3D def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS && + qemuVirtioFSSetupCgroup(vm, fs, cgroup) < 0) + return -1; + } + return 0; } diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 09ab2cef27..194855ece8 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -299,3 +299,29 @@ qemuVirtioFSStop(virQEMUDriverPtr driver G_GNUC_UNUSED, cleanup: virErrorRestore(&orig_err); } + + +int +qemuVirtioFSSetupCgroup(virDomainObjPtr vm, + virDomainFSDefPtr fs, + virCgroupPtr cgroup) +{ + g_autofree char *pidfile =3D NULL; + pid_t pid =3D -1; + int rc; + + if (!(pidfile =3D qemuVirtioFSCreatePidFilename(vm, fs->info.alias))) + return -1; + + rc =3D virPidFileReadPathIfAlive(pidfile, &pid, NULL); + if (rc < 0 || pid =3D=3D (pid_t) -1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("virtiofsd died unexpectedly")); + return -1; + } + + if (virCgroupAddProcess(cgroup, pid) < 0) + return -1; + + return 0; +} diff --git a/src/qemu/qemu_virtiofs.h b/src/qemu/qemu_virtiofs.h index b2f0c57d0c..1db59917c6 100644 --- a/src/qemu/qemu_virtiofs.h +++ b/src/qemu/qemu_virtiofs.h @@ -35,3 +35,8 @@ void qemuVirtioFSStop(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainFSDefPtr fs); + +int +qemuVirtioFSSetupCgroup(virDomainObjPtr vm, + virDomainFSDefPtr fs, + virCgroupPtr cgroup); --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718289; cv=none; d=zohomail.com; s=zohoarc; b=LGrpyA8NSSGtjYZrYWSaXYK/ZhHGXhLufVNY78g9cRjHd5kpImIY3CoBW/MtDsbzRMfQdd9k5klhyCXuGKoGCyGBRz2KXpSsaW8PxfMRt1MzrJEp0f8C9ioFh1vYBxnx2V9vH6NZX+VX6v59sM1QQ2kmahj1lrR0R3nqj48zQwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718289; 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=jySg6nk7ERpRNzQ/DFrdI4/ZCItW3teUfl/UwIycZHI=; b=U5cUgYTwRv4RzvsNFLK0K+JATgkZ9ISFUWDESN4EdzTg/YuJHohBUa/sx50oornQRMCutzidQtPHvKMnCvP0bupTRw2jujG8InBaXRb+EvuW7X1RKBITpp4tCiyFPAfH1kn1D08c6OfRWTd/KoZtNDVQHCxWEUPBS422nedONrc= 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 1582718289788790.2111484281787; Wed, 26 Feb 2020 03:58:09 -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-240-KT6YcrDbPv2yJhw6-c9y-w-1; Wed, 26 Feb 2020 06:58:05 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C88B0102CE16; Wed, 26 Feb 2020 11:57:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D0AC8C06A; Wed, 26 Feb 2020 11:57:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5034E84473; Wed, 26 Feb 2020 11:57:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvTEw031639 for ; Wed, 26 Feb 2020 06:57:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id B357B8C088; Wed, 26 Feb 2020 11:57:29 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B8408C06A for ; Wed, 26 Feb 2020 11:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718288; 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=jySg6nk7ERpRNzQ/DFrdI4/ZCItW3teUfl/UwIycZHI=; b=ikUYk4JdPZMJJi8HuJJI7fROD3fWrxQdgnP8dBx/kQCjN+Fyvz91BpFT4937urTtaGh9VN WKka0tsSTtMFPJulZJJv2Y3ZA1QFx+j9HvnE66Jtyc5h9Q7cPIpR4p87FtS+jRpL23WBH9 Ey1DVa30hGdxnq8eJ+Pg43uzFw5ge68= X-MC-Unique: KT6YcrDbPv2yJhw6-c9y-w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 14/15] qemu: use the vhost-user schemas to find binary Date: Wed, 26 Feb 2020 12:57:12 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Look into /usr/share/qemu/vhost-user to see whether we can find a suitable virtiofsd binary, in case the user did not provide one in the domain XML. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- src/qemu/qemu_extdevice.c | 9 +++++++++ src/qemu/qemu_vhost_user.c | 39 ++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_vhost_user.h | 4 ++++ src/qemu/qemu_virtiofs.c | 11 +++++++++++ src/qemu/qemu_virtiofs.h | 4 ++++ 5 files changed, 67 insertions(+) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index f66bafb62f..07b9117f57 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -105,6 +105,15 @@ qemuExtDevicesPrepareDomain(virQEMUDriverPtr driver, } } =20 + for (i =3D 0; i < vm->def->nfss; i++) { + virDomainFSDefPtr fs =3D vm->def->fss[i]; + + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + if (qemuVirtioFSPrepareDomain(driver, fs) < 0) + return -1; + } + } + return ret; } =20 diff --git a/src/qemu/qemu_vhost_user.c b/src/qemu/qemu_vhost_user.c index 1bcb007a1b..aee18c9670 100644 --- a/src/qemu/qemu_vhost_user.c +++ b/src/qemu/qemu_vhost_user.c @@ -417,3 +417,42 @@ qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver, VIR_FREE(vus); return ret; } + + +int +qemuVhostUserFillDomainFS(virQEMUDriverPtr driver, + virDomainFSDefPtr fs) +{ + qemuVhostUserPtr *vus =3D NULL; + ssize_t nvus =3D 0; + ssize_t i; + int ret =3D -1; + + if ((nvus =3D qemuVhostUserFetchParsedConfigs(driver->privileged, + &vus, NULL)) < 0) + goto end; + + for (i =3D 0; i < nvus; i++) { + qemuVhostUserPtr vu =3D vus[i]; + + if (vu->type !=3D QEMU_VHOST_USER_TYPE_FS) + continue; + + fs->binary =3D g_strdup(vu->binary); + break; + } + + if (i =3D=3D nvus) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("Unable to find a satisfying virtiofsd")); + goto end; + } + + ret =3D 0; + + end: + for (i =3D 0; i < nvus; i++) + qemuVhostUserFree(vus[i]); + g_free(vus); + return ret; +} diff --git a/src/qemu/qemu_vhost_user.h b/src/qemu/qemu_vhost_user.h index 369ba00caa..e505c8a473 100644 --- a/src/qemu/qemu_vhost_user.h +++ b/src/qemu/qemu_vhost_user.h @@ -45,3 +45,7 @@ qemuVhostUserFetchConfigs(char ***configs, int qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver, virDomainVideoDefPtr video); + +int +qemuVhostUserFillDomainFS(virQEMUDriverPtr driver, + virDomainFSDefPtr fs); diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 194855ece8..d579ce1d33 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -28,6 +28,7 @@ #include "qemu_conf.h" #include "qemu_extdevice.h" #include "qemu_security.h" +#include "qemu_vhost_user.h" #include "qemu_virtiofs.h" #include "virpidfile.h" #include "virqemu.h" @@ -325,3 +326,13 @@ qemuVirtioFSSetupCgroup(virDomainObjPtr vm, =20 return 0; } + +int +qemuVirtioFSPrepareDomain(virQEMUDriverPtr driver, + virDomainFSDefPtr fs) +{ + if (fs->binary) + return 0; + + return qemuVhostUserFillDomainFS(driver, fs); +} diff --git a/src/qemu/qemu_virtiofs.h b/src/qemu/qemu_virtiofs.h index 1db59917c6..7de4ea6190 100644 --- a/src/qemu/qemu_virtiofs.h +++ b/src/qemu/qemu_virtiofs.h @@ -40,3 +40,7 @@ int qemuVirtioFSSetupCgroup(virDomainObjPtr vm, virDomainFSDefPtr fs, virCgroupPtr cgroup); + +int +qemuVirtioFSPrepareDomain(virQEMUDriverPtr driver, + virDomainFSDefPtr fs); --=20 2.24.1 From nobody Sun Apr 28 19:02:55 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=1582718292; cv=none; d=zohomail.com; s=zohoarc; b=kTtxMjb1eLnJ+qgiIk1pBLNKU8hdXRQK47F9qHsGGbTUyWo4KKyM5BHP3gM6ba33vvs21pgh5APL/fTTiPHEv5ZLnK0TiVw38m3tB57VzxYNWxBjRVLDPQPxuJ5mfKVdDlRrqCFCO8nXfXBl34OZGccKK9Knoq5o9TT+aXEguvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582718292; 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=YB1jlA99+0eMBR6xC+ta+CF09RH0xfJS9OltcLk4hnw=; b=hY/4///IdRzaGXcYIVHLsUah9par/8ri7zT7TL+6dqgFrgksvGFoFXvSN++8u8BLmNOPjjqQ1oyzlf2mNDJ/1IHXp+b1vvcQpH5WVoo4tEByjzNgmmJfpcthed/3EVRbX9WUqO3KJjCXqoLoeIdYEANYyMlUzrt/qEcx2rhdmf0= 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 158271829226545.66970913820353; Wed, 26 Feb 2020 03:58:12 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-313-b0PNY9eQMwiTxaOY53vueA-1; Wed, 26 Feb 2020 06:58:09 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74B0818FE860; Wed, 26 Feb 2020 11:58:02 +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 4BADA8C073; Wed, 26 Feb 2020 11:58:02 +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 F2BF78447C; Wed, 26 Feb 2020 11:58:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01QBvUpA031650 for ; Wed, 26 Feb 2020 06:57:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 866888C088; Wed, 26 Feb 2020 11:57:30 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DCA88C06A for ; Wed, 26 Feb 2020 11:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582718291; 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=YB1jlA99+0eMBR6xC+ta+CF09RH0xfJS9OltcLk4hnw=; b=a8uF9as7FC7E2uYM18zSF2UI+ZDTy+y0xkkh1wP2Q4CV4bZoji1XobhIxToGd4G7VgaXyV 9HHYN2i8AIW9Wut+/owGGA8BOg1Q3t3zvs2fDY5I8X7q6kMlsLCi2mPbg85Mk1KPoRty9z aEwbJbG/04ZzFC/xxw2wgYpGgH2waG8= X-MC-Unique: b0PNY9eQMwiTxaOY53vueA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv5 15/15] qemu: build vhost-user-fs device command line Date: Wed, 26 Feb 2020 12:57:13 +0100 Message-Id: <5ad4b28fdb238e42cd7fc3437548978591356772.1582718066.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Format the 'vhost-user-fs' device on the QEMU command line. This device provides shared file system access using the FUSE protocol carried over virtio. The actual file server is implemented in an external vhost-user-fs device backend process. https://bugzilla.redhat.com/show_bug.cgi?id=3D1694166 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa Tested-by: Andrea Bolognani --- src/qemu/qemu_command.c | 46 +++++++++++++++++- ...vhost-user-fs-fd-memory.x86_64-latest.args | 39 +++++++++++++++ ...vhost-user-fs-hugepages.x86_64-latest.args | 47 +++++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ 4 files changed, 133 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 8ad859ad88..9d215e5e06 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2575,6 +2575,46 @@ qemuBuildDisksCommandLine(virCommandPtr cmd, } =20 =20 +static int +qemuBuildVHostUserFsCommandLine(virCommandPtr cmd, + virDomainFSDef *fs, + const virDomainDef *def, + qemuDomainObjPrivatePtr priv) +{ + g_autofree char *chardev_alias =3D NULL; + g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; + + chardev_alias =3D g_strdup_printf("chr-vu-%s", fs->info.alias); + + virCommandAddArg(cmd, "-chardev"); + virBufferAddLit(&opt, "socket"); + virBufferAsprintf(&opt, ",id=3D%s", chardev_alias); + virBufferAddLit(&opt, ",path=3D"); + virQEMUBuildBufferEscapeComma(&opt, QEMU_DOMAIN_FS_PRIVATE(fs)->vhostu= ser_fs_sock); + virCommandAddArgBuffer(cmd, &opt); + + virCommandAddArg(cmd, "-device"); + + if (qemuBuildVirtioDevStr(&opt, "vhost-user-fs", priv->qemuCaps, + VIR_DOMAIN_DEVICE_FS, fs) < 0) + return -1; + + virBufferAsprintf(&opt, ",chardev=3D%s", chardev_alias); + if (fs->queue_size) + virBufferAsprintf(&opt, ",queue-size=3D%llu", fs->queue_size); + virBufferAddLit(&opt, ",tag=3D"); + virQEMUBuildBufferEscapeComma(&opt, fs->dst); + if (qemuBuildVirtioOptionsStr(&opt, fs->virtio, priv->qemuCaps) < 0) + return -1; + + if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, priv->qemuCaps) < = 0) + return -1; + + virCommandAddArgBuffer(cmd, &opt); + return 0; +} + + static char * qemuBuildFSStr(virDomainFSDefPtr fs) { @@ -2667,7 +2707,7 @@ static int qemuBuildFilesystemCommandLine(virCommandPtr cmd, const virDomainDef *def, virQEMUCapsPtr qemuCaps, - qemuDomainObjPrivatePtr priv G_GNUC_UNUSED) + qemuDomainObjPrivatePtr priv) { size_t i; =20 @@ -2682,7 +2722,9 @@ qemuBuildFilesystemCommandLine(virCommandPtr cmd, break; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS: - /* TODO: vhost-user-fs-pci */ + /* vhost-user-fs-pci */ + if (qemuBuildVHostUserFsCommandLine(cmd, def->fss[i], def, pri= v) < 0) + return -1; break; =20 case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP: diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.a= rgs b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args new file mode 100644 index 0000000000..a7df45a7f0 --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args @@ -0,0 +1,39 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-guest \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-guest/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-guest/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dguest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-guest/master-key.aes \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ +-m 14336 \ +-overcommit mem-lock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-object memory-backend-file,id=3Dram-node0,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-guest/ram-node0,share= =3Dyes,\ +size=3D15032385536 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ +-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-chardev socket,id=3Dchr-vu-fs0,path=3D/tmp/lib/domain--1-guest/fs0.vhost-= fs.sock \ +-device vhost-user-fs-pci,chardev=3Dchr-vu-fs0,queue-size=3D1024,tag=3Dmou= nt_tag,\ +bus=3Dpci.0,addr=3D0x2 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.a= rgs b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args new file mode 100644 index 0000000000..39190b8d3e --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args @@ -0,0 +1,47 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-guest \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-guest/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-guest/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dguest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-guest/master-key.aes \ +-machine q35,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ +-m 2048 \ +-overcommit mem-lock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-object memory-backend-file,id=3Dram-node0,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-guest,share=3Dyes,size=3D21474= 83648 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult= ifunction=3Don,\ +addr=3D0x1 \ +-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr= =3D0x1.0x1 \ +-device pcie-root-port,port=3D0xa,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr= =3D0x1.0x2 \ +-device pcie-root-port,port=3D0xb,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr= =3D0x1.0x3 \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/guest.qcow= 2",\ +"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qco= w2",\ +"file":"libvirt-1-storage"}' \ +-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.4,addr=3D0x0,drive=3Dlibvirt-1= -format,\ +id=3Dvirtio-disk0,bootindex=3D1 \ +-chardev socket,id=3Dchr-vu-fs0,path=3D/tmp/lib/domain--1-guest/fs0.vhost-= fs.sock \ +-device vhost-user-fs-pci,chardev=3Dchr-vu-fs0,tag=3Dmount_tag,bus=3Dpci.1= ,addr=3D0x0 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index abbc273889..35d413d40b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3061,6 +3061,9 @@ mymain(void) =20 DO_TEST_CAPS_VER("launch-security-sev", "2.12.0"); =20 + DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory"); + DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages"); + DO_TEST("riscv64-virt", QEMU_CAPS_DEVICE_VIRTIO_MMIO); DO_TEST("riscv64-virt-pci", --=20 2.24.1