From nobody Mon Feb 9 07:43:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1639053164; cv=none; d=zohomail.com; s=zohoarc; b=ZQxjAP0jP2cZLWC2WWZu/HCwvNvN7+8Nkg8D1jtTBFBRJmD0E6WgUpXG3eTau7VoZGiB+rw8N1XKkCIjdnSPaLArUMa2gBKYGoR5IFQYvm4HLxdnl2EXjwB2+9URQJXA8REIKHqUGtDr3EBeUTf6AiwKRpjKXB+2EjWdlEdlK9w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639053164; 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=GIxTiNUnCdnhnd8CdKA9b2JNnfXX2KeDrBnf/vZQKTM=; b=Mv0Rn1Fy9yMhuKnkw1TzmWVkpuTVCZlMx3C+ZDJefrPh8S/yECXBb+Xjt3mkr3ThRrR+j8Rew31uWY9KE3pv8x+o+DQkBztLtJrK1j9xSDVBuZvrSUnAo1V+sdxN9NRbdWZa/8hKXxurnEcF0aGDHC0DSYKWYsWHFgC5ylrpBdU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639053164377387.03020266114163; Thu, 9 Dec 2021 04:32:44 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-519-bsQJNDCHOLWXMLsbnf_hbA-1; Thu, 09 Dec 2021 07:32:41 -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 CE64281CCBA; Thu, 9 Dec 2021 12:32:35 +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 B209410114AE; Thu, 9 Dec 2021 12:32:35 +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 85B2F1802E27; Thu, 9 Dec 2021 12:32:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B9CVM1Z017887 for ; Thu, 9 Dec 2021 07:31:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 036094ABA1; Thu, 9 Dec 2021 12:31:22 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 622AB60C25 for ; Thu, 9 Dec 2021 12:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639053163; 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=GIxTiNUnCdnhnd8CdKA9b2JNnfXX2KeDrBnf/vZQKTM=; b=FxtMGrFmsdpQMdTAFerJ7O1XWs83mbXoKMRzIGu1OQ328fEAbbcJyx5lH6Pe9xF7mQZoJf MhcFp/YDYzLgdF+kbK+gGuZyVsn6dnnO1W0RbRx2z2P684d8bJgs12l/R1p7adgAcnGOI3 kW8O5rmomod5uIp2rR53PADn93HOctg= X-MC-Unique: bsQJNDCHOLWXMLsbnf_hbA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 19/24] qemu: Implement chardev source setup for disk Date: Thu, 9 Dec 2021 13:30:54 +0100 Message-Id: <3946ea040af270c6996a81977ad2e75e2f6b7332.1639052639.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639053166402100001 Content-Type: text/plain; charset="utf-8" Add handling to qemuDomainDeviceBackendChardevForeachOne and callbacks so that we can later use 'qemuBuildChardevCommand' for vhost-user disks instead of a custom formatter. Since we don't pass the FD for the vhost-user connection to qemu all of the setup can be skipped. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 7 ++++++- src/qemu/qemu_process.c | 4 ++++ tests/qemuxml2argvtest.c | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d7751f731d..475f2f536e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11494,6 +11494,12 @@ qemuDomainDeviceBackendChardevForeachOne(virDomain= DeviceDef *dev, void *opaque) { switch ((virDomainDeviceType) dev->type) { + case VIR_DOMAIN_DEVICE_DISK: + if (virStorageSourceGetActualType(dev->data.disk->src) !=3D VIR_ST= ORAGE_TYPE_VHOST_USER) + return 0; + + return cb(dev, dev->data.disk->src->vhostuser, opaque); + case VIR_DOMAIN_DEVICE_NET: if (virDomainNetGetActualType(dev->data.net) !=3D VIR_DOMAIN_NET_T= YPE_VHOSTUSER) return 0; @@ -11524,7 +11530,6 @@ qemuDomainDeviceBackendChardevForeachOne(virDomainD= eviceDef *dev, return cb(dev, dev->data.rng->source.chardev, opaque); - case VIR_DOMAIN_DEVICE_DISK: case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_INPUT: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d31ab103cf..ed0b80be0b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6886,6 +6886,10 @@ qemuProcessPrepareHostBackendChardevOne(virDomainDev= iceDef *dev, /* this function is also called for the monitor backend which doesn't = have * a 'dev' */ if (dev) { + /* vhost-user disk doesn't use FD passing */ + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_DISK) + return 0; + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_NET) { /* due to a historical bug in qemu we don't use FD passtrhough= for * vhost-sockets for network devices */ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index fa451b6b54..ac4b532ef1 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -385,6 +385,10 @@ testPrepareHostBackendChardevOne(virDomainDeviceDef *d= ev, qemuDomainChrSourcePrivate *charpriv =3D QEMU_DOMAIN_CHR_SOURCE_PRIVAT= E(chardev); if (dev) { + /* vhost-user disk doesn't use FD passing */ + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_DISK) + return 0; + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_NET) { /* due to a historical bug in qemu we don't use FD passtrhough= for * vhost-sockets for network devices */ --=20 2.31.1