From nobody Mon Sep 16 19:14:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1720102333021521.6076892662595; Thu, 4 Jul 2024 07:12:13 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EBB2D1534; Thu, 4 Jul 2024 10:12:11 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1E75515D4; Thu, 4 Jul 2024 10:11:36 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2DD40E8A; Thu, 4 Jul 2024 10:11:31 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BD48EDF1 for ; Thu, 4 Jul 2024 10:11:30 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-83-GlwUN1PaMRCsu_5aMU01bQ-1; Thu, 04 Jul 2024 10:11:29 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6DE371954B0C for ; Thu, 4 Jul 2024 14:11:28 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.21]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 35E10195605A for ; Thu, 4 Jul 2024 14:11:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720102290; h=from:from: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; bh=45/gKY01P3xYKVBP1a2XIYq360MVjhmSdrR7SSVqFCs=; b=jCfdb4gHxocYWU2UeZSicmLpAqfuzmYrCeu22RVIDCVhRlIRX3FqI4W2UWBo/p/iH52R/f aalB8sZX9+8KzlKyU5JGnBRQBUzyxFePXir+tomPLmcYbdbcz5Tt1gun66wZ2s+Zs06YOZ R3QBUfTL8jzldAGAxOcbRNSQJGlPrcY= X-MC-Unique: GlwUN1PaMRCsu_5aMU01bQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCHv2 1/5] tests: vhostuser: add virtiofsd json descriptor Date: Thu, 4 Jul 2024 15:54:26 +0200 Message-ID: <59d70ac8abb61f4693890376858eb75b820df752.1720101270.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XPRO2N6DCQXOJ54X5TFEEZ42JIFGPKCY X-Message-ID-Hash: XPRO2N6DCQXOJ54X5TFEEZ42JIFGPKCY X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1720102334443100001 Content-Type: text/plain; charset="utf-8" Add the capabilities from the latest virtiofsd main branch and adjust the order in the priority test accordingly. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- .../usr/libexec/qemu/vhost-user/test-virtiofsd | 10 ++++++++++ .../usr/share/qemu/vhost-user/50-qemu-virtiofsd.json | 5 +++++ tests/qemuvhostusertest.c | 1 + 3 files changed, 16 insertions(+) create mode 100755 tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/tes= t-virtiofsd create mode 100644 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/50-qe= mu-virtiofsd.json diff --git a/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-virti= ofsd b/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-virtiofsd new file mode 100755 index 0000000000..90b38187c9 --- /dev/null +++ b/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-virtiofsd @@ -0,0 +1,10 @@ +#!/bin/sh + +cat < Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1720102350533746.2545681830373; Thu, 4 Jul 2024 07:12:30 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 651D7DE5; Thu, 4 Jul 2024 10:12:29 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 51BDC15D9; Thu, 4 Jul 2024 10:11:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 96685DE5; Thu, 4 Jul 2024 10:11:32 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3A2FEDF1 for ; Thu, 4 Jul 2024 10:11:32 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-126-QmnvcdEGPVqL9h3DzllacA-1; Thu, 04 Jul 2024 10:11:30 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ABB1919560AB for ; Thu, 4 Jul 2024 14:11:29 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.21]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C1F2C195605A for ; Thu, 4 Jul 2024 14:11:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720102291; h=from:from: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; bh=WOY7cpuJ+74PrYO4kbnF4OxILfmYkuIbMA2LJlPBc/s=; b=LZlQ7LYjt6+XwFAz61E0kKDw3Fv4nUV4DMvXV6CYaPRBl9uCa15DNBDlMEba2xnqIw5D9g aAwNC1ewn/pCbSWfZiUpJmapOS8iTlZml9yMt0r8ZG57430vLtG3vaeoY5y72tWkfXpHOD l9dAO6IRhc7KPDisCkv5Q8Hc0wNVPag= X-MC-Unique: QmnvcdEGPVqL9h3DzllacA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCHv2 2/5] tests: qemuxmlconf: adjust test case to new virtiofsd Date: Thu, 4 Jul 2024 15:54:27 +0200 Message-ID: <8150d7b786297e7665ead09a751f0b3c9f62a1b9.1720101270.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YZZUTUJMXGTBBRUCMHBSW3UXT473SG7V X-Message-ID-Hash: YZZUTUJMXGTBBRUCMHBSW3UXT473SG7V X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1720102352510100001 Content-Type: text/plain; charset="utf-8" Now that we have a fake virtiofsd json descriptor in our vhost-user test data, we can remove the explicitly specified binary and our mocking will ensure this test won't be affected by the host state. Also remove the locking options, since they were never supported by the Rust version of virtiofsd. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tests/qemuxmlconfdata/vhost-user-fs-fd-memory.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.xml b/tests/qemu= xmlconfdata/vhost-user-fs-fd-memory.xml index 1d0bc26c46..b0b1b44081 100644 --- a/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.xml +++ b/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.xml @@ -28,10 +28,9 @@ - + - --=20 2.45.2 From nobody Mon Sep 16 19:14:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1720102379803780.4530567996854; Thu, 4 Jul 2024 07:12:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B5F18155C; Thu, 4 Jul 2024 10:12:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7024615BA; Thu, 4 Jul 2024 10:11:44 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6F7CD1581; Thu, 4 Jul 2024 10:11:39 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 61F7D1554 for ; Thu, 4 Jul 2024 10:11:33 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-369-alOKhSCfPeOtn5zJg4xC2w-1; Thu, 04 Jul 2024 10:11:31 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0C73A1955BC6 for ; Thu, 4 Jul 2024 14:11:31 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.21]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 367EC195605F for ; Thu, 4 Jul 2024 14:11:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720102293; h=from:from: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; bh=OVJ9CCAZBCaiC2XpAm8+sR2hojPcyvmROl3SdC6wEGY=; b=Qg9t8eurp4HpuCDjkAmJQ+BQy0JZ+eZzEEZZquTsa3gDmEO1SBef5PQnIOw3BoCnu1LZga sa9uepCLvgRk84XLC+RIxMEPdDvdIfwxawB5iR0/zWTX1cph/M71nPfombfzJ0H+wSWH78 ltEv1590hDLi7k5QlNiH1BjFuwHV79s= X-MC-Unique: alOKhSCfPeOtn5zJg4xC2w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCHv2 3/5] qemu: fill capabilities for virtiofsd Date: Thu, 4 Jul 2024 15:54:28 +0200 Message-ID: <769739528ccff01ccba81ed21d4f580b1fc9d9ea.1720101270.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NZVPJG2TI6FLPLSQ4ROQBHCWIWMTB3EE X-Message-ID-Hash: NZVPJG2TI6FLPLSQ4ROQBHCWIWMTB3EE X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1720102380647100001 Content-Type: text/plain; charset="utf-8" Run the daemon with --print-capabilities first, to see what it supports. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/conf/domain_conf.h | 1 + src/qemu/qemu_vhost_user.c | 60 ++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_vhost_user.h | 12 ++++++++ src/qemu/qemu_virtiofs.c | 9 ++++-- 4 files changed, 80 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2818a9f1f5..b3a0d26cde 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -899,6 +899,7 @@ struct _virDomainFSDef { virDomainIdMapDef idmap; virDomainVirtioOptions *virtio; virObject *privateData; + virBitmap *caps; }; =20 =20 diff --git a/src/qemu/qemu_vhost_user.c b/src/qemu/qemu_vhost_user.c index 0294daab80..30a60db528 100644 --- a/src/qemu/qemu_vhost_user.c +++ b/src/qemu/qemu_vhost_user.c @@ -22,6 +22,7 @@ =20 #include "qemu_vhost_user.h" #include "qemu_interop_config.h" +#include "virbitmap.h" #include "virjson.h" #include "virlog.h" #include "viralloc.h" @@ -90,6 +91,12 @@ VIR_ENUM_IMPL(qemuVhostUserGPUFeature, "render-node", ); =20 +VIR_ENUM_IMPL(qemuVhostUserFSFeature, + QEMU_VHOST_USER_FS_FEATURE_LAST, + "migrate-precopy", + "separate-options", +); + typedef struct _qemuVhostUserGPU qemuVhostUserGPU; struct _qemuVhostUserGPU { size_t nfeatures; @@ -414,6 +421,53 @@ qemuVhostUserFillDomainGPU(virQEMUDriver *driver, return ret; } =20 +int +qemuVhostUserFillFSCapabilities(virBitmap **caps, + const char *binary, + bool reportError G_GNUC_UNUSED) +{ + g_autoptr(virJSONValue) doc =3D NULL; + g_autofree char *output =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; + virJSONValue *featuresJSON; + size_t nfeatures; + size_t i; + g_autoptr(virBitmap) features =3D NULL; + + cmd =3D virCommandNewArgList(binary, "--print-capabilities", NULL); + virCommandSetOutputBuffer(cmd, &output); + if (virCommandRun(cmd, NULL) < 0) + return -2; + + if (!(doc =3D virJSONValueFromString(output))) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to parse json capabilities '%1$s'"), + binary); + return -1; + } + + /* Older virtiofsd did not print any features */ + if (!(featuresJSON =3D virJSONValueObjectGetArray(doc, "features"))) + return 0; + + features =3D virBitmapNew(0); + nfeatures =3D virJSONValueArraySize(featuresJSON); + + for (i =3D 0; i < nfeatures; i++) { + virJSONValue *item =3D virJSONValueArrayGet(featuresJSON, i); + const char *tmpStr =3D virJSONValueGetString(item); + int tmp; + + if ((tmp =3D qemuVhostUserFSFeatureTypeFromString(tmpStr)) < 0) { + VIR_DEBUG("ignoring unknown virtiofs feature '%s'", tmpStr); + continue; + } + virBitmapSetBitExpand(features, tmp); + } + + *caps =3D g_steal_pointer(&features); + return 0; +} =20 int qemuVhostUserFillDomainFS(virQEMUDriver *driver, @@ -435,6 +489,12 @@ qemuVhostUserFillDomainFS(virQEMUDriver *driver, continue; =20 fs->binary =3D g_strdup(vu->binary); + + /* skip binaries that can't report their capabilities */ + if (qemuVhostUserFillFSCapabilities(&fs->caps, + vu->binary, + false) =3D=3D -1) + continue; break; } =20 diff --git a/src/qemu/qemu_vhost_user.h b/src/qemu/qemu_vhost_user.h index d1aa6ca189..f9cd549d5d 100644 --- a/src/qemu/qemu_vhost_user.h +++ b/src/qemu/qemu_vhost_user.h @@ -46,3 +46,15 @@ qemuVhostUserFillDomainGPU(virQEMUDriver *driver, int qemuVhostUserFillDomainFS(virQEMUDriver *driver, virDomainFSDef *fs); + +int +qemuVhostUserFillFSCapabilities(virBitmap **caps, + const char *binary, + bool reportError); +typedef enum { + QEMU_VHOST_USER_FS_FEATURE_MIGRATE_PRECOPY =3D 0, + QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS, + QEMU_VHOST_USER_FS_FEATURE_LAST +} qemuVhostUserFSFeature; + +VIR_ENUM_DECL(qemuVhostUserFSFeature); diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 78897d8177..aba6a19562 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -446,8 +446,13 @@ qemuVirtioFSPrepareDomain(virQEMUDriver *driver, if (fs->sock) return 0; =20 - if (!fs->binary && qemuVhostUserFillDomainFS(driver, fs) < 0) - return -1; + if (fs->binary) { + if (qemuVhostUserFillFSCapabilities(&fs->caps, fs->binary, true) <= 0) + return -1; + } else { + if (qemuVhostUserFillDomainFS(driver, fs) < 0) + return -1; + } =20 if (!driver->privileged && !fs->idmap.uidmap) { if (qemuVirtioFSPrepareIdMap(fs) < 0) --=20 2.45.2 From nobody Mon Sep 16 19:14:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1720102403369255.9204330127028; Thu, 4 Jul 2024 07:13:23 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3F0F415E4; Thu, 4 Jul 2024 10:13:22 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3025F1602; Thu, 4 Jul 2024 10:11:48 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 94F2D1587; Thu, 4 Jul 2024 10:11:43 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D3F7615AB for ; Thu, 4 Jul 2024 10:11:34 -0400 (EDT) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-641-VL0w-LW5N0iBYgeAVBi2Iw-1; Thu, 04 Jul 2024 10:11:33 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 92C1419560BF for ; Thu, 4 Jul 2024 14:11:32 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.21]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 98797195605F for ; Thu, 4 Jul 2024 14:11:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720102294; h=from:from: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; bh=9srAE8MsMiUBEZY98aDis2BNug75Xij9w8vRaEdvskQ=; b=jSHpQ03471yG08NLBLB36t8zkITkPlXyGQrOTFDDul8YXoPHmrb4lqMXPfOWr40xR3zAJd pdhcrPK0guw+xuDRmYcNYc3vEQFN0XAlWFP/CxVdmICFXD85QqYzKlLH2usauQIhnTIi3i J48+rmy9nwbtT8oWIgPkeUXtqAvgCAk= X-MC-Unique: VL0w-LW5N0iBYgeAVBi2Iw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCHv2 4/5] qemu: do not use deprecated options for new virtiofsd Date: Thu, 4 Jul 2024 15:54:29 +0200 Message-ID: <36373b03622017eb62bddab7f0317746530f4cdb.1720101270.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 3NKM7REKVRR6QYBVMA7F5UORDG7QWKWS X-Message-ID-Hash: 3NKM7REKVRR6QYBVMA7F5UORDG7QWKWS X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1720102404802100001 Content-Type: text/plain; charset="utf-8" Use the to-be-introduced virtiofsd capability to mark whether new options are safe to use. Depends on: https://gitlab.com/virtio-fs/virtiofsd/-/merge_requests/231 https://issues.redhat.com/browse/RHEL-7108 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_virtiofs.c | 83 +++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index aba6a19562..2271051b9a 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -139,36 +139,67 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg, virCommandPassFD(cmd, *fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); *fd =3D -1; =20 - 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->sandbox) - virBufferAsprintf(&opts, ",sandbox=3D%s", virDomainFSSandboxModeTy= peToString(fs->sandbox)); - - 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 (virBitmapIsBitSet(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OP= TIONS)) { + /* Note that this option format is used by the Rust version of the= daemon + * since v1.0.0, which is way longer than the capability existed. + * The -o style of options can be removed once we bump the minimal + * QEMU version to 8.0.0, which dropped the C virtiofsd daemon */ + virCommandAddArg(cmd, "--shared-dir"); + virCommandAddArg(cmd, fs->src->path); + + if (fs->cache) { + virCommandAddArg(cmd, "--cache"); + virCommandAddArg(cmd, virDomainFSCacheModeTypeToString(fs->cac= he)); + } + if (fs->sandbox) { + virCommandAddArg(cmd, "--sandbox"); + virCommandAddArg(cmd, virDomainFSSandboxModeTypeToString(fs->s= andbox)); + } + + if (fs->xattr =3D=3D VIR_TRISTATE_SWITCH_ON) + virCommandAddArg(cmd, "--xattr"); + + if (fs->posix_lock !=3D VIR_TRISTATE_SWITCH_ABSENT || + fs->flock !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("locking op= tions are not supported by this virtiofsd")); + return NULL; + } + } else { + virCommandAddArg(cmd, "-o"); + virBufferAddLit(&opts, "source=3D"); + virQEMUBuildBufferEscapeComma(&opts, fs->src->path); + if (fs->cache) + virBufferAsprintf(&opts, ",cache=3D%s", virDomainFSCacheModeTy= peToString(fs->cache)); + if (fs->sandbox) + virBufferAsprintf(&opts, ",sandbox=3D%s", virDomainFSSandboxMo= deTypeToString(fs->sandbox)); + + 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); + } =20 if (fs->thread_pool_size >=3D 0) virCommandAddArgFormat(cmd, "--thread-pool-size=3D%i", fs->thread_= pool_size); =20 - if (cfg->virtiofsdDebug) - virCommandAddArg(cmd, "-d"); + if (cfg->virtiofsdDebug) { + if (virBitmapIsBitSet(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARAT= E_OPTIONS)) + virCommandAddArgList(cmd, "--log-level", "debug", NULL); + else + virCommandAddArg(cmd, "-d"); + } =20 for (i =3D 0; i < fs->idmap.nuidmap; i++) { virCommandAddArgFormat(cmd, "--uid-map=3D:%u:%u:%u:", --=20 2.45.2 From nobody Mon Sep 16 19:14:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1720102418878921.6945688005216; Thu, 4 Jul 2024 07:13:38 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C5E49155C; Thu, 4 Jul 2024 10:13:37 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1DE431591; Thu, 4 Jul 2024 10:11:50 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 50B0E15D3; Thu, 4 Jul 2024 10:11:45 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 43F6D152E for ; Thu, 4 Jul 2024 10:11:36 -0400 (EDT) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-2cKoDmtGPMWsvzE2YGJ_kw-1; Thu, 04 Jul 2024 10:11:34 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E963019560B1 for ; Thu, 4 Jul 2024 14:11:33 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.21]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0E2EC1956066 for ; Thu, 4 Jul 2024 14:11:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720102296; h=from:from: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; bh=wXguvH6CvsO5frE/oeh+pzweij4t9kWouO5A7hD9pUw=; b=M3326fea9I36jcfXGspcZKSFeeFS7sIys+ycv/QF0pBt8J+Qjw6DrGMcebYf0opxX7BzPI axKwfPedsLqDiAbgouIgpQVzyQXHDUdnEXz/2ABsLWWoVImhaOZtZpIMkKoffuq9sPs10y TmUafIPQz5NeQ4Fj60hRdBC74TPisg4= X-MC-Unique: 2cKoDmtGPMWsvzE2YGJ_kw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCHv2 5/5] qemu: migration: allow migration for virtiofs Date: Thu, 4 Jul 2024 15:54:30 +0200 Message-ID: <864a05ad780f602ec2f25aa41348bdece8511365.1720101270.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PADNH7WKQYKKRBSBSPVA2NDFXGXZI564 X-Message-ID-Hash: PADNH7WKQYKKRBSBSPVA2NDFXGXZI564 X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1720102420835100001 Content-Type: text/plain; charset="utf-8" Allow migration if the "migrate-precopy" capability is present or libvirt is not the one running the virtiofs daemon. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 26c082fc08..4fd7a0aafb 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -39,6 +39,7 @@ #include "qemu_slirp.h" #include "qemu_block.h" #include "qemu_tpm.h" +#include "qemu_vhost_user.h" =20 #include "domain_audit.h" #include "virlog.h" @@ -1576,8 +1577,12 @@ qemuMigrationSrcIsAllowed(virDomainObj *vm, virDomainFSDef *fs =3D vm->def->fss[i]; =20 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")); + if (fs->sock || + virBitmapIsBitSet(fs->caps, QEMU_VHOST_USER_FS_FEATURE= _MIGRATE_PRECOPY)) + continue; + + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("migration with this virtiofs device is n= ot supported")); return false; } } --=20 2.45.2