From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504552; cv=none; d=zohomail.com; s=zohoarc; b=ZlHNdD9bIRqzkvU3/hnBdLyhOV7oOlSKkRsj5DTk1ZQLEv1qz+dgFZc2YouK21e2S93O+QUgspNRsiCVqnJ6/o1RIsqBOyNht4g1KwjrnUdejHhXKuu32xiewirp5i6V8pq2RHItxEZrs87LTBhzn/WnWoEzV9Fc2PNGaHAV7Io= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504552; 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=Jw5cTMhVdqcUflcKjTmSOX8aBkwbGAd7N7UqOh2hgDk=; b=jlaFh2+ZPt86scC7hgjJG7e49kmCGqDDP/VQw9OMDyywYWuU4iRgfbqm+nWcBz2ygcr7msoSgY7iUzSpf/nnHKgLmp/EhfBt/1169F2BWuU8dyWbll68vOMY/hFHhQLdJISI2fa91InhMf5dQbCKuWrn+smCiETx/ll4HNgddjg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633504552378495.0207359946877; Wed, 6 Oct 2021 00:15:52 -0700 (PDT) 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-433-QiHgNk-YOD2vtdBsOb-fPg-1; Wed, 06 Oct 2021 03:15:49 -0400 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 8B377362F8; Wed, 6 Oct 2021 07:15:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8E7319723; Wed, 6 Oct 2021 07:15:43 +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 581D01801241; Wed, 6 Oct 2021 07:15:42 +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 1967Feuu007419 for ; Wed, 6 Oct 2021 03:15:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5988E60853; Wed, 6 Oct 2021 07:15:40 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FC2C6091B for ; Wed, 6 Oct 2021 07:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504551; 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=Jw5cTMhVdqcUflcKjTmSOX8aBkwbGAd7N7UqOh2hgDk=; b=JtmJDgFlU8S7Lnkn7RmisZbPtskLyHy52gzhstJpV0XKyO81Up4HVjdkGA8t9aFMcFBqqH 63ixSjzQ8ZRAG53MnzOgdAkeABU1hKzAISwVy45uJRijN+YaxD0Qa2x5JyJHNK/B63OXYQ Fn5Lt3Dn/LmIs0lDd/KTW4IsJnQF4sM= X-MC-Unique: QiHgNk-YOD2vtdBsOb-fPg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/16] qemu: vhost-user-fs: format alias on the command line Date: Wed, 6 Oct 2021 09:15:07 +0200 Message-Id: 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.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504554497100001 The commit adding the vhost-user-fs device forgot to format the device's alias on the command line. Thankfully it was not needed yet because virtiofs migration is not yet supported, but it will be needed in the future to allow hot(un)plug. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 1 + .../qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args | 2 +- .../qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 08f6d735f8..90c8022b07 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2057,6 +2057,7 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd, VIR_DOMAIN_DEVICE_FS, fs) < 0) return -1; =20 + virBufferAsprintf(&opt, ",id=3D%s", fs->info.alias); virBufferAsprintf(&opt, ",chardev=3D%s", chardev_alias); if (fs->queue_size) virBufferAsprintf(&opt, ",queue-size=3D%llu", fs->queue_size); 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 index 6311f8f65e..7586a8edbf 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -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 \ +-device vhost-user-fs-pci,id=3Dfs0,chardev=3Dchr-vu-fs0,queue-size=3D1024,= tag=3Dmount_tag,bus=3Dpci.0,addr=3D0x2 \ -audiodev id=3Daudio1,driver=3Dnone \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=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 index 58570592eb..290d0b9e2f 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args @@ -34,7 +34,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qco= w2","file":"libvirt-1-storage"}' \ -device virtio-blk-pci,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,bootindex= =3D2,bus=3Dpci.1,addr=3D0x0 \ +-device vhost-user-fs-pci,id=3Dfs0,chardev=3Dchr-vu-fs0,tag=3Dmount_tag,bo= otindex=3D2,bus=3Dpci.1,addr=3D0x0 \ -audiodev id=3Daudio1,driver=3Dnone \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504551; cv=none; d=zohomail.com; s=zohoarc; b=Ai48RhZows8uE9KxvmuDK1AefJNVOCRsFjtgPnqJbwRAv7aSDhJNm9YCkxQslROy4j5RIZ5qMm9OWiXH/57HOInZ3AnMVCq6BcfT4/m+jysOLQht6n02wyuaw3+e9Io5FhhvbpilMwqGr1VZNH2uu7/j68vEdhH/qj9JnXsNdzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504551; 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=feQ3Sn4N7NKe0wqzEgatgU6kxABnE9DJkOgI8w/Q3DA=; b=PFiuJzBBFdR+k0tflzwacPA3M5OmI7U0GWKhRCY2Fl9NWGORa5qKoM6E40drxcc1GZcrcNFnseBKk7yFg5eaLkorJKqupA6JDBCGuYcrgLrpc2uOaK+7CPMcXtgTLHKDr4Lz+BoWPDIjTZxMNzbtsRS4Z3CcPB5Z0VSPY1Hvsv0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633504551716245.78095468734261; Wed, 6 Oct 2021 00:15:51 -0700 (PDT) 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-403-y5-zxvPuNnag1nJvNjxGhw-1; Wed, 06 Oct 2021 03:15:49 -0400 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 CB89F1019982; Wed, 6 Oct 2021 07:15:43 +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 A3CFE5F4F3; Wed, 6 Oct 2021 07:15:43 +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 B35934E9F4; Wed, 6 Oct 2021 07:15:42 +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 1967Ffn2007424 for ; Wed, 6 Oct 2021 03:15:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2395560622; Wed, 6 Oct 2021 07:15:41 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9427260853 for ; Wed, 6 Oct 2021 07:15:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504550; 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=feQ3Sn4N7NKe0wqzEgatgU6kxABnE9DJkOgI8w/Q3DA=; b=fKoovuusjf8Awu+eZ5MJePS1kFTvH0Ven+++8VXkTnQH7UEo5B9Skvma6ne2BYtQWbYt// haPgpZZtgRcW+2MCyxLuXPE07/RGYtulrk1XDvUwo+xluMKwOVb3vmO8/1tV2BC0i/t+pz NjQo4+oN141O0rykDcQSeP7+ZtHR5WM= X-MC-Unique: y5-zxvPuNnag1nJvNjxGhw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 02/16] conf: define cleanup func for virDomainChrSourceDef Date: Wed, 6 Oct 2021 09:15:08 +0200 Message-Id: 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.79 on 10.5.11.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504552283100002 Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e054c1508e..c23c233184 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1284,6 +1284,7 @@ struct _virDomainChrSourceDef { size_t nseclabels; virSecurityDeviceLabelDef **seclabels; }; +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainChrSourceDef, virObjectUnref); =20 /* A complete character device, both host and domain views. */ struct _virDomainChrDef { @@ -3300,6 +3301,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetDef, virDom= ainNetDefFree); void virDomainSmartcardDefFree(virDomainSmartcardDef *def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainSmartcardDef, virDomainSmartcardDef= Free); void virDomainChrDefFree(virDomainChrDef *def); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainChrDef, virDomainChrDefFree); int virDomainChrSourceDefCopy(virDomainChrSourceDef *dest, virDomainChrSourceDef *src); void virDomainSoundCodecDefFree(virDomainSoundCodecDef *def); --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1633504579; cv=none; d=zohomail.com; s=zohoarc; b=dDCWGDSbZHA+tjEzn3CDfw154zhPw6CgImjI2r/vrQ39jXqDKu3ZAFkzqGsQLTYI2i3HDoGZOFf+J5y7bp8K0eX6MA6Vn72TMyhkI/69I49+jaClSYxykl3kYhLsZNyKaYkwGo3L7+OxbI5ob2N9Expme4ZcPuXlHq6mjmcZcYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504579; 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=etTO8JOIllxXv3MZIT+bPjLlcE6l5ZGJXR1ROCJRfRk=; b=lqkXCoOeKfeMQIQposO0qPPftabkU6lLEUOZ6Ws9Bi1WuYKee3pIp/p3ablff1zOmx5eIYPTRqaBYWa4ZR0/Z4dLZ2pTinZ5u2zGB4qMkFPvulvQVHrF294l/u3NAIzTZIN9C/bxw3fj0T2rpw+99tyn9e+IRfgrFlbY/yHNjGA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1633504579763814.5584007092948; Wed, 6 Oct 2021 00:16:19 -0700 (PDT) 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-102-BXUgBvT0MFW_EMk-QDorjw-1; Wed, 06 Oct 2021 03:16:16 -0400 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 8C54C824FA6; Wed, 6 Oct 2021 07:16:11 +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 6F36F5F4F3; Wed, 6 Oct 2021 07:16:11 +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 3B0861806D02; Wed, 6 Oct 2021 07:16:11 +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 1967Fgpw007434 for ; Wed, 6 Oct 2021 03:15:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 02DAF60936; Wed, 6 Oct 2021 07:15:42 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E4EC60853 for ; Wed, 6 Oct 2021 07:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504578; 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=etTO8JOIllxXv3MZIT+bPjLlcE6l5ZGJXR1ROCJRfRk=; b=HkjTD8UTxDYCx5HuYsFfNVqa2Nkte3VIq4puwiydxZnRf4fmjx2nGRWG5zfVdpKx1L/tgt is9s8z5ilmEMLrXQ2xnqrVCTqsQVb3JWBDm1LAb6guFetdQQrToYYiYokgkYFRy9OC3FNX sPYXZQ/3k9EQlaESr2b0W1hB2wFGQHc= X-MC-Unique: BXUgBvT0MFW_EMk-QDorjw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 03/16] qemu: domain: introduce qemuDomainGetVHostUserFSSocketPath Date: Wed, 6 Oct 2021 09:15:09 +0200 Message-Id: <23f73c43cd2e3f833f908fd23b6574dc19f05413.1633504466.git.jtomko@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.79 on 10.5.11.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504581092100001 Intended as a replacement for qemuVirtioFSCreateSocketFilename, to be used outside of qemu_virtiofs.c Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 10 ++++++++++ src/qemu/qemu_domain.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a755f8678e..cb6aaecdee 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11440,3 +11440,13 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfig *cf= g, =20 return 0; } + + +char * +qemuDomainGetVHostUserFSSocketPath(qemuDomainObjPrivate *priv, + const virDomainFSDef *fs) +{ + if (fs->sock) + return g_strdup(fs->sock); + return virFileBuildPath(priv->libDir, fs->info.alias, "-fs.sock"); +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 64f92988b7..aad076dd4c 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1043,3 +1043,7 @@ int qemuDomainNamePathsCleanup(virQEMUDriverConfig *cfg, const char *name, bool bestEffort); + +char * +qemuDomainGetVHostUserFSSocketPath(qemuDomainObjPrivate *priv, + const virDomainFSDef *fs); --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504579; cv=none; d=zohomail.com; s=zohoarc; b=k9NM8P5wLCJvIBNDBK08ck0WhJ8WR0vqyNUqORW9rwTXdNO28fUMuVHKCUpPFx9hIPAR7UJ9Fr2MUnlIjw27SW4CEd5JXBp16cj/YXf0fm2xDMhu2iF6HhxaNabY1n7RovWxYWoiI3ZkyeWMUj1z+TsGs0Y3fKuA2dylkEBYfy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504579; 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=6iJZogqoN7l4yw1yBXIxI/d5hXBrvrMe9D5R4V3FeWA=; b=lm+uGPkaOlct4b/vgJx3T5xyHNQemf/MC6zlfWONEGEUkoVF+fZy/3Mqz5vngehu26IeOiThL9H1SOQ903Du5dT76ZVJ14q81z21/GMS/cIorGV6EuonHW413bwT544k05665znDX8HyiUl06VqRgrMsl6+ZamAchgcp1a2sW0A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633504579682507.00304317759935; Wed, 6 Oct 2021 00:16:19 -0700 (PDT) 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-145-qGaRl9KZPOeXDdVTLCN4HQ-1; Wed, 06 Oct 2021 03:16:16 -0400 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 96DA8362F9; Wed, 6 Oct 2021 07:16:11 +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 77B9760853; Wed, 6 Oct 2021 07:16:11 +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 43D58180BAD1; Wed, 6 Oct 2021 07:16:11 +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 1967Fhql007450 for ; Wed, 6 Oct 2021 03:15:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id E11155BAE7; Wed, 6 Oct 2021 07:15:42 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4015860853 for ; Wed, 6 Oct 2021 07:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504578; 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=6iJZogqoN7l4yw1yBXIxI/d5hXBrvrMe9D5R4V3FeWA=; b=Vi3PFHd5EayejxtYIyFGBL2Ru3gsZ0dJ7zO9CY/AO1AlDDBeZh4JwcmMoTvZsWGbLyaVuq /w9+c/+6GJQFnAx1bAw8XLCKwdCJ7QpIZ1lvyoskDjoj2Lf+OpbTY+S9SVGLOQ9LMOL4d7 bwpfwSraP8zjt5m2hlIYVyRFiVfZNRI= X-MC-Unique: qGaRl9KZPOeXDdVTLCN4HQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 04/16] qemu: domain: introduce qemuDomainGetVHostUserChrSourceDef Date: Wed, 6 Oct 2021 09:15:10 +0200 Message-Id: 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.79 on 10.5.11.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504581093100002 A function that creates a chardev source with the appropriate socket path set. Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 13 +++++++++++++ src/qemu/qemu_domain.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index cb6aaecdee..5f467760c3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11450,3 +11450,16 @@ qemuDomainGetVHostUserFSSocketPath(qemuDomainObjPr= ivate *priv, return g_strdup(fs->sock); return virFileBuildPath(priv->libDir, fs->info.alias, "-fs.sock"); } + + +virDomainChrSourceDef * +qemuDomainGetVHostUserChrSourceDef(qemuDomainObjPrivate *priv, + const virDomainFSDef *fs) +{ + virDomainChrSourceDef *src =3D virDomainChrSourceDefNew(priv->driver->= xmlopt); + + src->type =3D VIR_DOMAIN_CHR_TYPE_UNIX; + src->data.nix.path =3D qemuDomainGetVHostUserFSSocketPath(priv, fs); + + return src; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index aad076dd4c..59cb703c16 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1047,3 +1047,7 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfig *cfg, char * qemuDomainGetVHostUserFSSocketPath(qemuDomainObjPrivate *priv, const virDomainFSDef *fs); + +virDomainChrSourceDef * +qemuDomainGetVHostUserChrSourceDef(qemuDomainObjPrivate *priv, + const virDomainFSDef *fs); --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1633504602; cv=none; d=zohomail.com; s=zohoarc; b=BfX5reGoTY9etbdethb+0b381fKu1Rft66eRMnalitayK684FepyE+4nfmjBBqdhhmysV5TiS7R/9etm+5x6JM1tl1XhWhVs2JQt+xB7G7e2hxaDn6LOcKaa0dmiaWxwJ1Mayq7ehxUQWZr8oeB8rAbvR64kx+6iyEcaKAGxvs4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504602; 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=i/mIQNsgakWMabVgqyrLXEQonAPtHhHkjbaXmdLw75U=; b=ftuE4b+9EI7kwk+RVLx+zChxaPD3fztR2l8MrxPZxOdDFjUarcur0FW8NHrczLutn8o6BOAoXHJ5xMMMpFrznUZTaiJZyrSdx0yT9bYiIM2yO8JTz0OYesn3x247xp/ucVJXZwFsvQW8B/yFD/yzFXwXfv1EIBtZUhHaUJdiAsY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 163350460207439.72623165247376; Wed, 6 Oct 2021 00:16:42 -0700 (PDT) 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-378-SudgbUO-Pz6e9nTARzRo2g-1; Wed, 06 Oct 2021 03:16:37 -0400 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 B9FC510151E1; Wed, 6 Oct 2021 07:16:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8075E1972E; Wed, 6 Oct 2021 07:16:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4EC3318199EE; Wed, 6 Oct 2021 07:16:32 +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 1967Fhki007455 for ; Wed, 6 Oct 2021 03:15:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC80760622; Wed, 6 Oct 2021 07:15:43 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3924460853 for ; Wed, 6 Oct 2021 07:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504601; 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=i/mIQNsgakWMabVgqyrLXEQonAPtHhHkjbaXmdLw75U=; b=hOIyeXs7Gp9Vp8UDIYANRCusgnIsD+XGnMwvgTfZhN+NJLl1M9yw2k6z4KrnFMQOCYOYCp ernfP4Nx6DVuWdCcOro3e6rYGCCPb79cuJvK0Q/kY6D6KXi/H8/z9mbGoWKMMnSmjTm2Rh UCpY++Tljw5sMnIMECnjUt7FmrUn+SI= X-MC-Unique: SudgbUO-Pz6e9nTARzRo2g-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 05/16] tests: qemuxml2argvtest: fix path to virtiofs socket Date: Wed, 6 Oct 2021 09:15:11 +0200 Message-Id: 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.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504602722100002 The mocked path in the test suite is not in sync with what libvirtd generates. Signed-off-by: J=C3=A1n Tomko --- .../qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args | 2 +- .../qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args | 2 +- tests/qemuxml2argvtest.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 index 7586a8edbf..8adab6da81 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -no-shutdown \ -no-acpi \ -boot strict=3Don \ --chardev socket,id=3Dchr-vu-fs0,path=3D/tmp/lib/domain--1-guest/fs0.vhost-= fs.sock \ +-chardev socket,id=3Dchr-vu-fs0,path=3D/tmp/lib/domain--1-guest/fs0-fs.soc= k \ -device vhost-user-fs-pci,id=3Dfs0,chardev=3Dchr-vu-fs0,queue-size=3D1024,= tag=3Dmount_tag,bus=3Dpci.0,addr=3D0x2 \ -audiodev id=3Daudio1,driver=3Dnone \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ 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 index 290d0b9e2f..4158456744 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args +++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args @@ -33,7 +33,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -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,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 \ +-chardev socket,id=3Dchr-vu-fs0,path=3D/tmp/lib/domain--1-guest/fs0-fs.soc= k \ -device vhost-user-fs-pci,id=3Dfs0,chardev=3Dchr-vu-fs0,tag=3Dmount_tag,bo= otindex=3D2,bus=3Dpci.1,addr=3D0x0 \ -audiodev id=3Daudio1,driver=3Dnone \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 94aaa2f53e..e35380293c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -444,7 +444,7 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock) continue; =20 - s =3D g_strdup_printf("/tmp/lib/domain--1-guest/fs%zu.vhost-fs.soc= k", i); + s =3D g_strdup_printf("/tmp/lib/domain--1-guest/fs%zu-fs.sock", i); QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock =3D s; } =20 --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1633504621; cv=none; d=zohomail.com; s=zohoarc; b=kMGasO8wbtozq6PDhbe4Xib5xmEZnSiY4wiQhwq3XPTMrt53lVUY7rPT0H0sXAMqcTT/nlS+Udg+PhIIgKVTXvPE5fjA4SmzNzOdNEx2C5he2zYmK84hHrlqAO1YevJjhp8HFi8CfEmcRJ3D4wTGEviaruAtL0THmzf1DtEHnlM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504621; 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=04ftWJyNMHybQB0OeMDhj+b1NvyIdEqe2N/r0s2Vs6U=; b=BiQWjOvQK8v0ufZIcqR3QmQpPqCiHgr0zjXcRScYtCBiqKllERzu1g18nSPJeBcQ832YPk8PAVUlRFFxJJzlaFVJfmNHblySCuuIxXWWLw8TZa//++QBlNFgluyINJq4yd1i6f/aY47bmbAzi0t49NfiM8ypypMLJo4uB63oHAs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1633504621237850.2489522383923; Wed, 6 Oct 2021 00:17:01 -0700 (PDT) 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-206-ixHD-HZEMWuAZXGLST9TgA-1; Wed, 06 Oct 2021 03:16:58 -0400 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 A0FAD83DBC4; Wed, 6 Oct 2021 07:16:53 +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 7BCBB17F72; Wed, 6 Oct 2021 07:16: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 444884EA3C; Wed, 6 Oct 2021 07:16:53 +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 1967FiEG007460 for ; Wed, 6 Oct 2021 03:15:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A2B760936; Wed, 6 Oct 2021 07:15:44 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14E1E60C2B for ; Wed, 6 Oct 2021 07:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504620; 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=04ftWJyNMHybQB0OeMDhj+b1NvyIdEqe2N/r0s2Vs6U=; b=Vx4H7Tu2MravGgAkGBGDjSaQOZWaVt4Aenk5M5Z/mht15ioJc9FkpOwlBeHoRcHvLMvD0s MZvUSiYBHskkPKiOc0H6gmV2MNN9eYsJsG9QyrqCiHRIziV1WwcET97gTSYpYmdiMF5dA4 st9jHlZtHtMp2U3lKCo0UwflT02Fbdk= X-MC-Unique: ixHD-HZEMWuAZXGLST9TgA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 06/16] qemu: vhost-user-fs: separate building of chardev string Date: Wed, 6 Oct 2021 09:15:12 +0200 Message-Id: <50e5d9473961721e3bc200e95c060ca8bc4658c1.1633504466.git.jtomko@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.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504622252100001 Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 90c8022b07..7e76e188c1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2033,6 +2033,20 @@ qemuBuildDisksCommandLine(virCommand *cmd, } =20 =20 +static char * +qemuBuildVHostUserFsChardevStr(const virDomainFSDef *fs, + const char *chardev_alias) +{ + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + + virBufferAddLit(&buf, "socket"); + virBufferAsprintf(&buf, ",id=3D%s", chardev_alias); + virBufferAddLit(&buf, ",path=3D"); + virQEMUBuildBufferEscapeComma(&buf, QEMU_DOMAIN_FS_PRIVATE(fs)->vhostu= ser_fs_sock); + return virBufferContentAndReset(&buf); +} + + static int qemuBuildVHostUserFsCommandLine(virCommand *cmd, virDomainFSDef *fs, @@ -2040,16 +2054,14 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd, qemuDomainObjPrivate *priv) { g_autofree char *chardev_alias =3D NULL; + g_autofree char *chrdevstr =3D NULL; g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; =20 chardev_alias =3D qemuDomainGetVhostUserChrAlias(fs->info.alias); + chrdevstr =3D qemuBuildVHostUserFsChardevStr(fs, chardev_alias); =20 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, chrdevstr); =20 virCommandAddArg(cmd, "-device"); =20 --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504643; cv=none; d=zohomail.com; s=zohoarc; b=YY2rnCNYTgiHv8HErXgAKzd+E2AqIqDIyOHVi3s6SHs4vSLk73nlIzvbsJeMCS6gOp00lv6+vya+6fROPdKetTKuE1CqsV1g4K9T8hA4E00Z3hz6BfN0J55sxNTkJOtCm7xlsdwxXKfepbTHNYTdMP6RTxw3b606CV8KRXfpDuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504643; 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=ZomRCaJDVK5hoRcAQDaRwTrUL4L1XxpkBmOMPU7NbG0=; b=J7rYytEWeZ2PJaYwJYupyoWe3/z8IiDCCXy7qnsTWinYGlP5lGHfB4wG7UW7fJ/BkxzLgYoWajGrdAHaNceJwnLPu8K8E9x9AjFpI/EJuC2Qvo7vhP8WvIxIqeP2nKYP/HxNtNk9vx7Mpi+iWx7cuJoqJNrn1MkoDQrICj4IdZU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 163350464356472.78033149492319; Wed, 6 Oct 2021 00:17:23 -0700 (PDT) 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-215-jU1JTDwoN2ObiGcNRI3Tbw-1; Wed, 06 Oct 2021 03:17:20 -0400 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 1DB0D101F7A4; Wed, 6 Oct 2021 07:17:15 +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 EFFD860C13; Wed, 6 Oct 2021 07:17:14 +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 BBB951806D01; Wed, 6 Oct 2021 07:17:14 +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 1967FjoO007468 for ; Wed, 6 Oct 2021 03:15:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A8A560936; Wed, 6 Oct 2021 07:15:45 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6A4560853 for ; Wed, 6 Oct 2021 07:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504642; 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=ZomRCaJDVK5hoRcAQDaRwTrUL4L1XxpkBmOMPU7NbG0=; b=bbf0xvcUyUFX7D7ZY55WDL2hUUSEXxv3gBMgPN1LuJo6nB/Rq6mqop//w+x64xeIsMd++i 3HvyAXdemujqn3P5Y8Mtzube1d8XKybWLCqbSi27ZcWWyH8DQR+I+/EqFvhVXZftp2NJ5I t6zzya9bqjrldwz8w8TCEZWVxhnhUVc= X-MC-Unique: jU1JTDwoN2ObiGcNRI3Tbw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/16] qemu: vhost-user-fs: separate building of device string Date: Wed, 6 Oct 2021 09:15:13 +0200 Message-Id: <0edbaa63b14d1404e6d100a9863d926b93ddb22b.1633504466.git.jtomko@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.79 on 10.5.11.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504644143100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 55 ++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7e76e188c1..d0f961b8ea 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2047,6 +2047,36 @@ qemuBuildVHostUserFsChardevStr(const virDomainFSDef = *fs, } =20 =20 +static char * +qemuBuildVHostUserFsDevStr(virDomainFSDef *fs, + const virDomainDef *def, + const char *chardev_alias, + qemuDomainObjPrivate *priv) +{ + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + + if (qemuBuildVirtioDevStr(&buf, "vhost-user-fs", priv->qemuCaps, + VIR_DOMAIN_DEVICE_FS, fs) < 0) + return NULL; + + virBufferAsprintf(&buf, ",id=3D%s", fs->info.alias); + virBufferAsprintf(&buf, ",chardev=3D%s", chardev_alias); + if (fs->queue_size) + virBufferAsprintf(&buf, ",queue-size=3D%llu", fs->queue_size); + virBufferAddLit(&buf, ",tag=3D"); + virQEMUBuildBufferEscapeComma(&buf, fs->dst); + qemuBuildVirtioOptionsStr(&buf, fs->virtio); + + if (fs->info.bootIndex) + virBufferAsprintf(&buf, ",bootindex=3D%u", fs->info.bootIndex); + + if (qemuBuildDeviceAddressStr(&buf, def, &fs->info) < 0) + return NULL; + + return virBufferContentAndReset(&buf); +} + + static int qemuBuildVHostUserFsCommandLine(virCommand *cmd, virDomainFSDef *fs, @@ -2055,7 +2085,7 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd, { g_autofree char *chardev_alias =3D NULL; g_autofree char *chrdevstr =3D NULL; - g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; + g_autofree char *devstr =3D NULL; =20 chardev_alias =3D qemuDomainGetVhostUserChrAlias(fs->info.alias); chrdevstr =3D qemuBuildVHostUserFsChardevStr(fs, chardev_alias); @@ -2063,27 +2093,12 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd, virCommandAddArg(cmd, "-chardev"); virCommandAddArg(cmd, chrdevstr); =20 + if (!(devstr =3D qemuBuildVHostUserFsDevStr(fs, def, chardev_alias, pr= iv))) + return -1; + virCommandAddArg(cmd, "-device"); + virCommandAddArg(cmd, devstr); =20 - if (qemuBuildVirtioDevStr(&opt, "vhost-user-fs", priv->qemuCaps, - VIR_DOMAIN_DEVICE_FS, fs) < 0) - return -1; - - virBufferAsprintf(&opt, ",id=3D%s", fs->info.alias); - 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); - qemuBuildVirtioOptionsStr(&opt, fs->virtio); - - if (fs->info.bootIndex) - virBufferAsprintf(&opt, ",bootindex=3D%u", fs->info.bootIndex); - - if (qemuBuildDeviceAddressStr(&opt, def, &fs->info) < 0) - return -1; - - virCommandAddArgBuffer(cmd, &opt); return 0; } =20 --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1633504664; cv=none; d=zohomail.com; s=zohoarc; b=FhfJ5CqcU0F2TSpgf2aKvitMKUN00hXiW8pZlxo6S06P19gKE96bKl4to8oriss3zbGP11i8o9wkGwT/ZbJBw0uPBRTVmsL0Xvdd9rYbEH2VnR2qlmR+yzYU0fGPHdGoTY3sPnq4JL7eMQNccU4OG6nLoDdlmoLY73WRakoZWhQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504664; 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=hDoYDVA9GJtzokaQq9QeBZcJzh1D0L02oG7jtUIdwdI=; b=cCSGx+0QnK9a23eskS62AudBioF+CswwJZ89iSDQbxs3skdq6E5WFFd9lytX6nXjjYahQlSJ4vHF+BK/6AcxhQC5HQ6qSh8zBI/GRpDkHWTWoG82Yco3cRKHB8006jXhiexuHnQD1ACwzaItj5Uv23Z6vxIh0lXDCFLZhFD7VIQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1633504664417461.56438506456846; Wed, 6 Oct 2021 00:17:44 -0700 (PDT) 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-604-6cM-4D5XOj2_q-luk3ugFw-1; Wed, 06 Oct 2021 03:17:41 -0400 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 9F4F8802ECF; Wed, 6 Oct 2021 07:17:36 +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 C5FEC16A3B; Wed, 6 Oct 2021 07:17: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 8B3F74EA30; Wed, 6 Oct 2021 07:17: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 1967FkoZ007480 for ; Wed, 6 Oct 2021 03:15:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2842960622; Wed, 6 Oct 2021 07:15:46 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id A706D60853 for ; Wed, 6 Oct 2021 07:15:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504663; 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=hDoYDVA9GJtzokaQq9QeBZcJzh1D0L02oG7jtUIdwdI=; b=dLiiXbit6iYNXzbBgI6fZGcWZBiTx5425pKHWLADQeeOOrsJEUbPvr48FeGfEphPeymt8F h/koxw0QXx+41ezCLp5DizND9A8z6aR5usAdnl5wdib79+eDWkFd33liTrxilezEFHGN7A o6IP+Z+dehQpBCxzNe95tEdjgAeCYbA= X-MC-Unique: 6cM-4D5XOj2_q-luk3ugFw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 08/16] qemu: do not put virtiofs socket in private data Date: Wed, 6 Oct 2021 09:15:14 +0200 Message-Id: <76cd9628a676484e54712195d5a3944dcaa98be4.1633504466.git.jtomko@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.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504665590100001 Reconstruct the socket path from priv->libDir in every user. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 8 +++++--- src/qemu/qemu_extdevice.c | 6 ++---- src/qemu/qemu_virtiofs.c | 14 +++++++------- tests/qemuxml2argvtest.c | 12 ------------ 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d0f961b8ea..dc4f91ce25 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2035,14 +2035,16 @@ qemuBuildDisksCommandLine(virCommand *cmd, =20 static char * qemuBuildVHostUserFsChardevStr(const virDomainFSDef *fs, - const char *chardev_alias) + const char *chardev_alias, + qemuDomainObjPrivate *priv) { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + g_autofree char *socket_path =3D qemuDomainGetVHostUserFSSocketPath(pr= iv, fs); =20 virBufferAddLit(&buf, "socket"); virBufferAsprintf(&buf, ",id=3D%s", chardev_alias); virBufferAddLit(&buf, ",path=3D"); - virQEMUBuildBufferEscapeComma(&buf, QEMU_DOMAIN_FS_PRIVATE(fs)->vhostu= ser_fs_sock); + virQEMUBuildBufferEscapeComma(&buf, socket_path); return virBufferContentAndReset(&buf); } =20 @@ -2088,7 +2090,7 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd, g_autofree char *devstr =3D NULL; =20 chardev_alias =3D qemuDomainGetVhostUserChrAlias(fs->info.alias); - chrdevstr =3D qemuBuildVHostUserFsChardevStr(fs, chardev_alias); + chrdevstr =3D qemuBuildVHostUserFsChardevStr(fs, chardev_alias, priv); =20 virCommandAddArg(cmd, "-chardev"); virCommandAddArg(cmd, chrdevstr); diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 98b546fc73..ef0b3f1981 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -196,10 +196,8 @@ qemuExtDevicesStart(virQEMUDriver *driver, for (i =3D 0; i < def->nfss; i++) { virDomainFSDef *fs =3D def->fss[i]; =20 - if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { - if (fs->sock) - QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock =3D g_strdup= (fs->sock); - else if (qemuVirtioFSStart(logManager, driver, vm, fs) < 0) + if (fs->fsdriver =3D=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS && !fs-= >sock) { + if (qemuVirtioFSStart(logManager, driver, vm, fs) < 0) return -1; } } diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 15c05479c8..08a8b4ed42 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -183,8 +183,7 @@ qemuVirtioFSStart(virLogManager *logManager, if (!(pidfile =3D qemuVirtioFSCreatePidFilename(vm, fs->info.alias))) goto cleanup; =20 - if (!(socket_path =3D qemuVirtioFSCreateSocketFilename(vm, fs->info.al= ias))) - goto cleanup; + socket_path =3D qemuDomainGetVHostUserFSSocketPath(vm->privateData, fs= ); =20 if ((fd =3D qemuVirtioFSOpenChardev(driver, vm, socket_path)) < 0) goto cleanup; @@ -251,12 +250,9 @@ qemuVirtioFSStart(virLogManager *logManager, goto error; } =20 - QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock =3D g_steal_pointer(&soc= ket_path); ret =3D 0; =20 cleanup: - if (socket_path) - unlink(socket_path); return ret; =20 error: @@ -264,6 +260,8 @@ qemuVirtioFSStart(virLogManager *logManager, virProcessKillPainfully(pid, true); if (pidfile) unlink(pidfile); + if (socket_path) + unlink(socket_path); goto cleanup; } =20 @@ -284,8 +282,10 @@ qemuVirtioFSStop(virQEMUDriver *driver G_GNUC_UNUSED, if (virPidFileForceCleanupPathFull(pidfile, true) < 0) { VIR_WARN("Unable to kill virtiofsd process"); } else { - if (QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock) - unlink(QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock); + g_autofree char *socket_path =3D NULL; + + socket_path =3D qemuDomainGetVHostUserFSSocketPath(vm->privateData= , fs); + unlink(socket_path); } =20 cleanup: diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e35380293c..7df3946751 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -436,18 +436,6 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, } } =20 - for (i =3D 0; i < vm->def->nfss; i++) { - virDomainFSDef *fs =3D vm->def->fss[i]; - char *s; - - if (fs->fsdriver !=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS || - QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock) - continue; - - s =3D g_strdup_printf("/tmp/lib/domain--1-guest/fs%zu-fs.sock", i); - QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock =3D s; - } - if (vm->def->vsock) { virDomainVsockDef *vsock =3D vm->def->vsock; qemuDomainVsockPrivate *vsockPriv =3D --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504684; cv=none; d=zohomail.com; s=zohoarc; b=D0Kq0FoAA1dA8GhW3Y9WCmcNH/jlX3BKmNC/tukXe5J7zJb9fDveaBp+BBqu9ryliZ0hQZ3gDrlMKPeptm5iV+rGqd+vp71C8aj0wIreAVhhRAyR/FdIRpy2+OWO/MdU723Q7iWlVb/Im+731YgvSHqGyh3bX5zhaHMCMo0E8iI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504684; 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=fOG98/l0iIuqiJc5TC5nJPjf+lDtEOJAwDPeUbg9A+Y=; b=Uf05ZpReNh/hqFATDYuYHE8KDzV7WHjvwZtzG5E3zyhAPsk0vTfnWHMNhhNuz3gF2maxTOQ2xm2A+0X3/KKjIqAhEckQN765ThaOsYc4N9MPY46QqZzsfRU2wYa131xORz6aCLKV4OsL3xsfvyBTHuKMe9XZ+NgUCcBb7z66VKg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633504684160772.1193573747586; Wed, 6 Oct 2021 00:18:04 -0700 (PDT) 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-341-e6gxVd9DP-i590LPQWoZhQ-1; Wed, 06 Oct 2021 03:18:01 -0400 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 87E081054F92; Wed, 6 Oct 2021 07:17:56 +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 66B0060C05; Wed, 6 Oct 2021 07:17:56 +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 339BF4EA37; Wed, 6 Oct 2021 07:17:56 +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 1967Fk6d007488 for ; Wed, 6 Oct 2021 03:15:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id EEBCF60853; Wed, 6 Oct 2021 07:15:46 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7479D60622 for ; Wed, 6 Oct 2021 07:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504683; 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=fOG98/l0iIuqiJc5TC5nJPjf+lDtEOJAwDPeUbg9A+Y=; b=NI7Cyop6f3C59MAGl7TsLivYmhUL2LfVQitlf6llWpZqKC1Dg/2V7Uno/9yrp9tmecrdRs IuQkEFP0RUJXkx3VFKKvUEd+NC/mbt0Xv1wiayutTphdwEUZcxYkA7F5Krn62WgPzzqT6X LNMgslT/lmNT6FS4b+ReMVk5Sm2FYaI= X-MC-Unique: e6gxVd9DP-i590LPQWoZhQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 09/16] qemu: remove private data from virDomainFSDef Date: Wed, 6 Oct 2021 09:15:15 +0200 Message-Id: <21a0545c232c21daed4d0e9c4264109bdaf80aba.1633504466.git.jtomko@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.79 on 10.5.11.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504685118100001 This reverts commit 801e6da29c0202946d44b42136cc4ee229932a29 They are not needed anymore. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 41 ----------------------------------------- src/qemu/qemu_domain.h | 11 ----------- 2 files changed, 52 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5f467760c3..c4c79d979a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -983,46 +983,6 @@ qemuDomainNetworkPrivateDispose(void *obj G_GNUC_UNUSE= D) } =20 =20 -static virClass *qemuDomainFSPrivateClass; -static void qemuDomainFSPrivateDispose(void *obj); - - -static int -qemuDomainFSPrivateOnceInit(void) -{ - if (!VIR_CLASS_NEW(qemuDomainFSPrivate, virClassForObject())) - return -1; - - return 0; -} - - -VIR_ONCE_GLOBAL_INIT(qemuDomainFSPrivate); - - -static virObject * -qemuDomainFSPrivateNew(void) -{ - qemuDomainFSPrivate *priv; - - if (qemuDomainFSPrivateInitialize() < 0) - return NULL; - - if (!(priv =3D virObjectNew(qemuDomainFSPrivateClass))) - return NULL; - - return (virObject *) priv; -} - - -static void -qemuDomainFSPrivateDispose(void *obj) -{ - qemuDomainFSPrivate *priv =3D obj; - - g_free(priv->vhostuser_fs_sock); -} - static virClass *qemuDomainVideoPrivateClass; static void qemuDomainVideoPrivateDispose(void *obj); =20 @@ -3163,7 +3123,6 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivate= DataCallbacks =3D { .graphicsNew =3D qemuDomainGraphicsPrivateNew, .networkNew =3D qemuDomainNetworkPrivateNew, .videoNew =3D qemuDomainVideoPrivateNew, - .fsNew =3D qemuDomainFSPrivateNew, .parse =3D qemuDomainObjPrivateXMLParse, .format =3D qemuDomainObjPrivateXMLFormat, .getParseOpaque =3D qemuDomainObjPrivateXMLGetParseOpaque, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 59cb703c16..7e717cf2ad 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -392,17 +392,6 @@ struct _qemuDomainNetworkPrivate { }; =20 =20 -#define QEMU_DOMAIN_FS_PRIVATE(dev) \ - ((qemuDomainFSPrivate *) (dev)->privateData) - -typedef struct _qemuDomainFSPrivate qemuDomainFSPrivate; -struct _qemuDomainFSPrivate { - virObject parent; - - char *vhostuser_fs_sock; -}; - - typedef enum { QEMU_PROCESS_EVENT_WATCHDOG =3D 0, QEMU_PROCESS_EVENT_GUESTPANIC, --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1633504581; cv=none; d=zohomail.com; s=zohoarc; b=fSoeOx+dCoxciysBAco2dseguozYBwJ0XchSYYBNL79dx1zTkH2QEHozbu0m5TTuEG+fyt2rEBgqQYfLRLSketoPh1TFsNqCZi8PaHFz5MudqQTowGMzwsU2P4HEhF6ScVdHbGws6uboUL8SXM1JlfusL9KLd4nQfujXoI7G6dQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504581; 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=BR2BWCrD/k3cQifhoa+0l8uG89ioeZzFawLvmj7v61s=; b=HPeK1laI7IofcBf2vyoqdrS2dN/IaE4USRTYGzUxIcrS/k9l0xexJwhvfkCOMoGsB0JliNvNsXLKKt2LfXkendWOTd2sVa45qc2EHg/pXzd3hWpAlHL7pjtYad6u9ZQIQuzLdf3kJpC9Xrs6+1wRnrUHCcpujSKURurF/czZBFw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1633504581415337.04148869187225; Wed, 6 Oct 2021 00:16:21 -0700 (PDT) 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-158-ohO5cvU6MhGwrnp8w-baOQ-1; Wed, 06 Oct 2021 03:16:18 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCBB68015C7; Wed, 6 Oct 2021 07:16:13 +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 99BC59AA3F; Wed, 6 Oct 2021 07:16:13 +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 5B5E54E58F; Wed, 6 Oct 2021 07:16:13 +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 1967Flhb007500 for ; Wed, 6 Oct 2021 03:15:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id D5CFB60622; Wed, 6 Oct 2021 07:15:47 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4638460853 for ; Wed, 6 Oct 2021 07:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504580; 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=BR2BWCrD/k3cQifhoa+0l8uG89ioeZzFawLvmj7v61s=; b=Ers17aNw376+pP+WVG8mXhahcF1/rocSPkM2WJy14o0aIFND9tENGiCAjVgfqFBp1u10yU fCnsUlFTtP2K26mE7pG5wZ6uFaMYmc4NM8RaxUoAWi9SA3cMJe03/AfH/GBDtrlZG4OhWd 7VRXc/c3HxXwRfy8+9fzuPaIMAZWWP0= X-MC-Unique: ohO5cvU6MhGwrnp8w-baOQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 10/16] qemu: alias: prepare qemuAssignDeviceFSAlias for disjunct ranges Date: Wed, 6 Oct 2021 09:15:16 +0200 Message-Id: <877ce9bf245198b1b4a44f93758df4534bb42fe5.1633504466.git.jtomko@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.79 on 10.5.11.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504583245100001 Iterate through the array to find the first free index. Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_alias.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 81a1e7eeed..4153050bec 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -336,13 +336,23 @@ qemuAssignDeviceNetAlias(virDomainDef *def, =20 =20 static int -qemuAssignDeviceFSAlias(virDomainFSDef *fss, - int idx) +qemuAssignDeviceFSAlias(virDomainDef *def, + virDomainFSDef *fss) { + size_t i; + int maxidx =3D 0; + if (fss->info.alias) return 0; =20 - fss->info.alias =3D g_strdup_printf("fs%d", idx); + for (i =3D 0; i < def->nfss; i++) { + int idx; + + if ((idx =3D qemuDomainDeviceAliasIndex(&def->fss[i]->info, "fs"))= >=3D maxidx) + maxidx =3D idx + 1; + } + + fss->info.alias =3D g_strdup_printf("fs%d", maxidx); return 0; } =20 @@ -634,7 +644,7 @@ qemuAssignDeviceAliases(virDomainDef *def, virQEMUCaps = *qemuCaps) } =20 for (i =3D 0; i < def->nfss; i++) { - if (qemuAssignDeviceFSAlias(def->fss[i], i) < 0) + if (qemuAssignDeviceFSAlias(def, def->fss[i]) < 0) return -1; } for (i =3D 0; i < def->nsounds; i++) { --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1633504706; cv=none; d=zohomail.com; s=zohoarc; b=BjcXeozupnURg9oHNNmhnlNv3LR2uY7C2QK+oFeVUPuJtddGtnGieB82eUw4Ep/kfQq+L9PCud3R4vMZpnRgeWVl+pxp13gseB0x5786O961pp6d55TPXqdviHtKHy56dqENQ8OZARGGSZdDSztb6p9KzHSF1Ht1P73ZjSzREh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504706; 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=LQdIclkzw4gV5XAgkZDukqBgMGokSjwcMIJ4g42H6qk=; b=Y6GZPYNfPLonaHXY1BHXW7II+EnKyOOjN5ZzUhdEUrtqMKdJ4Us2LlTQL3LxOT4gp30mqY5iT23G/9Hnht621ZXzyz3MSfXUfkzp64YmX6R/wq9djprb2OhO1w4WIW4/HO4Aab7retUjeElbbdgXp1ELf7she9fEf1HZ7CDjooM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1633504706772696.0681876784589; Wed, 6 Oct 2021 00:18:26 -0700 (PDT) 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-382-y1Ly7PifOtWWdBk9e65WwQ-1; Wed, 06 Oct 2021 03:18:24 -0400 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 1C96A108468A; Wed, 6 Oct 2021 07:18:19 +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 F01F3604CC; Wed, 6 Oct 2021 07:18:18 +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 7F24E4EA37; Wed, 6 Oct 2021 07:18:18 +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 1967FmNT007506 for ; Wed, 6 Oct 2021 03:15:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id A9A5B60622; Wed, 6 Oct 2021 07:15:48 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DD2360853 for ; Wed, 6 Oct 2021 07:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504705; 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=LQdIclkzw4gV5XAgkZDukqBgMGokSjwcMIJ4g42H6qk=; b=IkcCYGgC3o8c7oMpkCxfV+gGJUpoBJj+mkBW8OJDaOoVgjh/qjTy7yBEuxFVFuMIu1Ar8J E5G/vuZCI2izi2RvUu2bxEHGBqs6u3+6somR0ouz1H5q3zQwU7AJvEREASHdidMBz9EjjC ZvNWZOjZgGcEGHhHPoqwPLi+EHgXub4= X-MC-Unique: y1Ly7PifOtWWdBk9e65WwQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 11/16] qemu: vhost-user-fs: build extdevice for zpci Date: Wed, 6 Oct 2021 09:15:17 +0200 Message-Id: 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.79 on 10.5.11.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504708348100001 Other devices (includes 9p-based fsdev) call this wrapper before formatting the device. Add it here too. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dc4f91ce25..8c8aafb13d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2095,6 +2095,9 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd, virCommandAddArg(cmd, "-chardev"); virCommandAddArg(cmd, chrdevstr); =20 + if (qemuCommandAddExtDevice(cmd, &fs->info) < 0) + return -1; + if (!(devstr =3D qemuBuildVHostUserFsDevStr(fs, def, chardev_alias, pr= iv))) return -1; =20 --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504727; cv=none; d=zohomail.com; s=zohoarc; b=LLFIWrnKVqUgfUj/+mkrU8llu3zTSK3TMoZNd+yKWq7sRGMSr333pEhTGgZshMmclr+zZGPC64b+MN3t7Ea+Ix5FH6eS92Jq6piQeP9xE4/S0gf1koAR44XWe3CvjPr1r/gffdsOAW1mkkOS8k7C6UaDK0L86QG6FeyZmDN4B6k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504727; 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=dQgaV5nPHqEZ5g4B0rNiy0l4zvgU5/mB2c2RZl7j+ZE=; b=n/is+TrTX4scieHN0moYH3CZqSf9LWkQQRSj5Gqu/L0JfpgWgswiSN2Dhirz8OJBr0VSYdbSg0WYx7TgE2w66Qg2G/MnYWlUgkR+QUwS6oMXdOarr0X5lqSzYagXfJ+xnMt588Edfm+VY5axhYX3h0B0YpsXWVzecvI4ius/GKY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633504727101275.91478122765795; Wed, 6 Oct 2021 00:18:47 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-PFb1FzxCP-2Ns1m_5rAuwA-1; Wed, 06 Oct 2021 03:18:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E213835DE0; Wed, 6 Oct 2021 07:18:39 +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 725799AA36; Wed, 6 Oct 2021 07:18:39 +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 184C14EA39; Wed, 6 Oct 2021 07:18:39 +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 1967FqkW007540 for ; Wed, 6 Oct 2021 03:15:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A7C960622; Wed, 6 Oct 2021 07:15:52 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id C234460936 for ; Wed, 6 Oct 2021 07:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504726; 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=dQgaV5nPHqEZ5g4B0rNiy0l4zvgU5/mB2c2RZl7j+ZE=; b=hlPQYNwNyAUnckCKY3C63wcETjWPxNBUhiFM/oSb80L8af0yImc3KDednBkRnv6Jd/nS8s kaYuirdK+u/OrMaaNkEtUVAIv5eFoRxQ8nIs3sIBGnvZZD3xzCvUllsoh+lkTWR+l/QTED 0NMCOCUHk75/yRoTvMcUcLewvsMFlfY= X-MC-Unique: PFb1FzxCP-2Ns1m_5rAuwA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 12/16] qemu: export vhost-user-fs-related functions Date: Wed, 6 Oct 2021 09:15:18 +0200 Message-Id: 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.79 on 10.5.11.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504728020100001 Prepare for hotplug support. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_alias.c | 2 +- src/qemu/qemu_alias.h | 4 ++++ src/qemu/qemu_command.c | 2 +- src/qemu/qemu_command.h | 6 ++++++ src/qemu/qemu_hotplug.h | 4 ++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 4153050bec..276a03cb56 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -335,7 +335,7 @@ qemuAssignDeviceNetAlias(virDomainDef *def, } =20 =20 -static int +int qemuAssignDeviceFSAlias(virDomainDef *def, virDomainFSDef *fss) { diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h index cfce05833d..604e667b9a 100644 --- a/src/qemu/qemu_alias.h +++ b/src/qemu/qemu_alias.h @@ -46,6 +46,10 @@ int qemuAssignDeviceNetAlias(virDomainDef *def, virDomainNetDef *net, int idx); =20 +int +qemuAssignDeviceFSAlias(virDomainDef *def, + virDomainFSDef *fss); + int qemuAssignDeviceRedirdevAlias(virDomainDef *def, virDomainRedirdevDef *redirdev, int idx); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8c8aafb13d..28bca1519c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2049,7 +2049,7 @@ qemuBuildVHostUserFsChardevStr(const virDomainFSDef *= fs, } =20 =20 -static char * +char * qemuBuildVHostUserFsDevStr(virDomainFSDef *fs, const virDomainDef *def, const char *chardev_alias, diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index a0e6af9d3f..6b8f90f737 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -144,6 +144,12 @@ char virDomainDiskDef *disk, virQEMUCaps *qemuCaps); =20 +char * +qemuBuildVHostUserFsDevStr(virDomainFSDef *fs, + const virDomainDef *def, + const char *chardev_alias, + qemuDomainObjPrivate *priv); + /* Current, best practice */ int qemuBuildControllerDevStr(const virDomainDef *domainDef, virDomainControllerDef *def, diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h index 9f383f4602..244dd5278d 100644 --- a/src/qemu/qemu_hotplug.h +++ b/src/qemu/qemu_hotplug.h @@ -107,6 +107,10 @@ int qemuDomainAttachInputDevice(virQEMUDriver *driver, int qemuDomainAttachVsockDevice(virQEMUDriver *driver, virDomainObj *vm, virDomainVsockDef *vsock); +int +qemuDomainAttachFSDevice(virQEMUDriver *driver, + virDomainObj *vm, + virDomainFSDef *fs); =20 int qemuDomainAttachLease(virQEMUDriver *driver, virDomainObj *vm, --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504601; cv=none; d=zohomail.com; s=zohoarc; b=lsohIl/A3Rq+mPIy5Upislfb0TYEXQyZ4nhaYPplYwarfkKVAW9t9d2ky6e7BjY2zMiYixVdMi/kTc88Xgp4mOdNk68oYLn8GPkXG7EALUUcU4UPy8w+c7mJrzPmiereHPkZTjnIYeKBpHyQwCPQxUXNpqLqbEvHoYUbfN0jMTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504601; 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=KNEaOVkiJUoDM+QBF+ZTnb9+4DHwxpNYteBwuz8Tcm8=; b=aubfi9heKXegzWYw8+MPKiiySD9rsh/nTKL7tKc4zmFSefa0fitsK2dvYe9x8wv+dFS6O3E/Ijx7EB6zQ4ND4ZHLBqbksbtVWjcYiJi/pl4yqBdqr9K9AwdWjkEqU6smsuIPEKHoOB62z+uRA1XnBq1TBWGq/CeUmiUWLNUaoU4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633504601652506.03747918498414; Wed, 6 Oct 2021 00:16:41 -0700 (PDT) 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-153-59V5NbdROnmxynEFgWDydA-1; Wed, 06 Oct 2021 03:16:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DDA088015C7; Wed, 6 Oct 2021 07:16:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B65555DEFB; Wed, 6 Oct 2021 07:16:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 72CD64EA37; Wed, 6 Oct 2021 07:16:32 +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 1967Frb3007546 for ; Wed, 6 Oct 2021 03:15:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 92DEC60936; Wed, 6 Oct 2021 07:15:53 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id B64EF60622 for ; Wed, 6 Oct 2021 07:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504600; 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=KNEaOVkiJUoDM+QBF+ZTnb9+4DHwxpNYteBwuz8Tcm8=; b=G74n49kgEwKy+CH5RpMM4rStomRLYd7nFy5c5/KJ9AKOxKi4tPs4JaK5A9G98706vNVyZZ E1K4VGifjce4vGmXoBUMQhjPbYS385RQ78U4WvjUaELeqs7saFPsgdlxzeFRybnAlvhCRV UE3mgj1PJLlj3iDaSm6KDgPXrjnU5JU= X-MC-Unique: 59V5NbdROnmxynEFgWDydA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 13/16] qemu: store logCtxt in domain private data Date: Wed, 6 Oct 2021 09:15:19 +0200 Message-Id: <9714017e89bf7cdad98dc33228d925ca871c90d0.1633504466.git.jtomko@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.79 on 10.5.11.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504602682100001 We might need it later for device hotplug. Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.h | 11 +++++++---- src/qemu/qemu_process.c | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 7e717cf2ad..fef6a2f39f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -101,6 +101,9 @@ struct _qemuDomainSecretInfo { char *ciphertext; /* encoded/encrypted secret */ }; =20 +#define QEMU_TYPE_DOMAIN_LOG_CONTEXT qemu_domain_log_context_get_type() +G_DECLARE_FINAL_TYPE(qemuDomainLogContext, qemu_domain_log_context, QEMU, = DOMAIN_LOG_CONTEXT, GObject); + typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate; struct _qemuDomainObjPrivate { virQEMUDriver *driver; @@ -193,6 +196,10 @@ struct _qemuDomainObjPrivate { * provided by QEMU. */ virCPUDef *origCPU; =20 + /* Log context. After startup, it is also used for hotplugging devices + * with a log file */ + qemuDomainLogContext *logCtxt; + /* If true virtlogd is used as stdio handler for character devices. */ bool chardevStdioLogd; =20 @@ -418,10 +425,6 @@ struct qemuProcessEvent { }; =20 void qemuProcessEventFree(struct qemuProcessEvent *event); - -#define QEMU_TYPE_DOMAIN_LOG_CONTEXT qemu_domain_log_context_get_type() -G_DECLARE_FINAL_TYPE(qemuDomainLogContext, qemu_domain_log_context, QEMU, = DOMAIN_LOG_CONTEXT, GObject); - typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie; struct _qemuDomainSaveCookie { virObject parent; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1d0165af6d..4a1fd753ee 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7179,7 +7179,7 @@ qemuProcessLaunch(virConnectPtr conn, int ret =3D -1; int rv; int logfile =3D -1; - g_autoptr(qemuDomainLogContext) logCtxt =3D NULL; + qemuDomainLogContext *logCtxt =3D NULL; qemuDomainObjPrivate *priv =3D vm->privateData; g_autoptr(virCommand) cmd =3D NULL; struct qemuProcessHookData hookData; @@ -7233,6 +7233,7 @@ qemuProcessLaunch(virConnectPtr conn, virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); goto cleanup; } + priv->logCtxt =3D logCtxt; logfile =3D qemuDomainLogContextGetWriteFD(logCtxt); =20 if (qemuProcessGenID(vm, flags) < 0) @@ -7966,6 +7967,8 @@ void qemuProcessStop(virQEMUDriver *driver, =20 qemuDBusStop(driver, vm); =20 + g_clear_object(&priv->logCtxt); + vm->def->id =3D -1; =20 /* Wake up anything waiting on domain condition */ --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504746; cv=none; d=zohomail.com; s=zohoarc; b=GKjo2Nl6XYrwf4HkMgnMkiihF9GpNMhq2x8jSwEUufN33O1bH0UA5DdlYLeBGicNNpzHyauHkmTS0zsbGO1rsyE1fRd2ZMXVMFQnyXmCxv0/pUNci0jl3WWPN5TzlPjiYm1uBBwNm/EGH3wPu0NinhpKpVcSXgOcQGnGBc5fy9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504746; 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=17QesiqDP87EHJzB9ghcpbWMbptq4nDcm0WqlNzmLeM=; b=CxDzD6Wj5d4UtTHL36vj5MM9IuGDdJUtAqyX21nnMQKT10UypUoPtC0DTICaH1vQRiIwjRAL83NyiR2EYeowKNHkUaQd8VZ341y4jAfGjGbfOcHr5YnFFMUy0o6IbXoHbu/o5WFpTOw+f7XPd04HelN9rGaJMhauWShe1uCyOJk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633504746964214.87292572504123; Wed, 6 Oct 2021 00:19:06 -0700 (PDT) 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-91-tYkjUWtUOqeeqcIf1D4Cwg-1; Wed, 06 Oct 2021 03:19:02 -0400 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 872501084690; Wed, 6 Oct 2021 07:18:57 +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 643CF19D9F; Wed, 6 Oct 2021 07:18:57 +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 34DEA180598A; Wed, 6 Oct 2021 07:18:57 +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 1967Fsm5007556 for ; Wed, 6 Oct 2021 03:15:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A56460622; Wed, 6 Oct 2021 07:15:54 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEC8060936 for ; Wed, 6 Oct 2021 07:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504745; 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=17QesiqDP87EHJzB9ghcpbWMbptq4nDcm0WqlNzmLeM=; b=DkjyTU/pl6fEdLX/HR63puNFFVaVKDY0aRqmOr6KUY+02vbtj3Izzgb4KeQ3IIKZTWtvU2 +Vj1UgYj7EQp/9YD/qs4CWgk1QdrzuVM2TokSiJVk59TK8o/V91yZm4tA6g/j/rCV4DIlH yy7kUEvlgTO4s3E6r/QNlso1qw1GzHY= X-MC-Unique: tYkjUWtUOqeeqcIf1D4Cwg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 14/16] qemu: use priv->logCtxt in qemuProcessLaunch Date: Wed, 6 Oct 2021 09:15:20 +0200 Message-Id: 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.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504747462100001 Remove the local variable in favor of the one stored in priv. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_process.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 4a1fd753ee..17435c0ee9 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7179,7 +7179,6 @@ qemuProcessLaunch(virConnectPtr conn, int ret =3D -1; int rv; int logfile =3D -1; - qemuDomainLogContext *logCtxt =3D NULL; qemuDomainObjPrivate *priv =3D vm->privateData; g_autoptr(virCommand) cmd =3D NULL; struct qemuProcessHookData hookData; @@ -7228,25 +7227,24 @@ qemuProcessLaunch(virConnectPtr conn, hookData.cfg =3D cfg; =20 VIR_DEBUG("Creating domain log file"); - if (!(logCtxt =3D qemuDomainLogContextNew(driver, vm, + if (!(priv->logCtxt =3D qemuDomainLogContextNew(driver, vm, QEMU_DOMAIN_LOG_CONTEXT_MODE_S= TART))) { virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); goto cleanup; } - priv->logCtxt =3D logCtxt; - logfile =3D qemuDomainLogContextGetWriteFD(logCtxt); + logfile =3D qemuDomainLogContextGetWriteFD(priv->logCtxt); =20 if (qemuProcessGenID(vm, flags) < 0) goto cleanup; =20 if (qemuExtDevicesStart(driver, vm, - qemuDomainLogContextGetManager(logCtxt), + qemuDomainLogContextGetManager(priv->logCtxt), incoming !=3D NULL) < 0) goto cleanup; =20 VIR_DEBUG("Building emulator command line"); if (!(cmd =3D qemuBuildCommandLine(driver, - qemuDomainLogContextGetManager(logCtx= t), + qemuDomainLogContextGetManager(priv->= logCtxt), driver->securityManager, vm, incoming ? incoming->launchURI : NULL, @@ -7265,11 +7263,11 @@ qemuProcessLaunch(virConnectPtr conn, VIR_HOOK_SUBOP_BEGIN) < 0) goto cleanup; =20 - qemuLogOperation(vm, "starting up", cmd, logCtxt); + qemuLogOperation(vm, "starting up", cmd, priv->logCtxt); =20 - qemuDomainObjCheckTaint(driver, vm, logCtxt, incoming !=3D NULL); + qemuDomainObjCheckTaint(driver, vm, priv->logCtxt, incoming !=3D NULL); =20 - qemuDomainLogContextMarkPosition(logCtxt); + qemuDomainLogContextMarkPosition(priv->logCtxt); =20 VIR_DEBUG("Building mount namespace"); =20 @@ -7343,7 +7341,7 @@ qemuProcessLaunch(virConnectPtr conn, VIR_DEBUG("Waiting for handshake from child"); if (virCommandHandshakeWait(cmd) < 0) { /* Read errors from child that occurred between fork and exec. */ - qemuProcessReportLogError(logCtxt, + qemuProcessReportLogError(priv->logCtxt, _("Process exited prior to exec")); goto cleanup; } @@ -7423,7 +7421,7 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; =20 VIR_DEBUG("Waiting for monitor to show up"); - if (qemuProcessWaitForMonitor(driver, vm, asyncJob, logCtxt) < 0) + if (qemuProcessWaitForMonitor(driver, vm, asyncJob, priv->logCtxt) < 0) goto cleanup; =20 if (qemuConnectAgent(driver, vm) < 0) --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504630; cv=none; d=zohomail.com; s=zohoarc; b=AFCDwdCScf3kpec1+r18vOXPyqKivEc1Q68jHMhLMtGy7/RQ2fIPyoW7V2Wdy8JyUdjocOMGRSLSyZlP8eIL1qLd9i6iOQI5BX1VmRpBqEy+voqZiaU+MXytPOJHhm0rBEGDdHFtN36CSqzwFoLnfdHEfSfRWmQrteHcAEPsHD8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504630; 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=KxVWa100loTQAothnzqfGO4yRLXd1iEUqx8L4bjyDV8=; b=WNJOcplxxhDr2aASOhhGe9XT6eJmDQhgxVM8CnzOkmiPb9ziPRQlXZTU2+Pe3GCtrXycdEfbaASkmAZGm+6Q3YWVh65x7HSMFT2I6lcu6IpOmEZWQSjRzlfkO8T3p5ogppDqpwcPk22kQ8l+1eBvKI3kCjVoFecZ0YFppISY/ao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 163350463080730.861723245640064; Wed, 6 Oct 2021 00:17:10 -0700 (PDT) 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-559-RC_ChmmDPFiqfXV4EYatMQ-1; Wed, 06 Oct 2021 03:16:58 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EFC0A10151E4; Wed, 6 Oct 2021 07:16: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 CCA8D5D9D5; Wed, 6 Oct 2021 07:16: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 9731C181A1D0; Wed, 6 Oct 2021 07:16:53 +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 1967G5oJ007640 for ; Wed, 6 Oct 2021 03:16:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5CE1260936; Wed, 6 Oct 2021 07:16:05 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D758A60853 for ; Wed, 6 Oct 2021 07:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504629; 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=KxVWa100loTQAothnzqfGO4yRLXd1iEUqx8L4bjyDV8=; b=b2IGbJqlOiLfyuI+nuXfw8voozsiaozlPkbTE1jiU2sBFTvJDThqfo4kJirIYxzvyQnWEL /io5tWhFxiGfW0HwWShAJh17wjT44aybVENZQv/Loi04szaZqDTv+agvOIaEx7jNSCCTln KXTdF2M6p05nhrydTdlmwQSC6bFgStQ= X-MC-Unique: RC_ChmmDPFiqfXV4EYatMQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 15/16] qemu: implement virtiofs hotplug Date: Wed, 6 Oct 2021 09:15:21 +0200 Message-Id: <6c045257ea788ec84127bc493c79ccfc075cd2cf.1633504466.git.jtomko@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.79 on 10.5.11.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504631106100001 https://bugzilla.redhat.com/show_bug.cgi?id=3D1897708 Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 9 +++- src/qemu/qemu_hotplug.c | 96 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 760d30a867..65b2ef8e86 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6945,8 +6945,15 @@ qemuDomainAttachDeviceLive(virDomainObj *vm, } break; =20 - case VIR_DOMAIN_DEVICE_NONE: case VIR_DOMAIN_DEVICE_FS: + ret =3D qemuDomainAttachFSDevice(driver, vm, dev->data.fs); + if (ret =3D=3D 0) { + alias =3D dev->data.fs->info.alias; + dev->data.fs =3D NULL; + } + break; + + case VIR_DOMAIN_DEVICE_NONE: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_GRAPHICS: diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 22239b2689..f5dad0b829 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -35,6 +35,7 @@ #include "qemu_security.h" #include "qemu_block.h" #include "qemu_snapshot.h" +#include "qemu_virtiofs.h" #include "domain_audit.h" #include "netdev_bandwidth_conf.h" #include "domain_nwfilter.h" @@ -3396,6 +3397,101 @@ qemuDomainAttachVsockDevice(virQEMUDriver *driver, } =20 =20 +int +qemuDomainAttachFSDevice(virQEMUDriver *driver, + virDomainObj *vm, + virDomainFSDef *fs) +{ + qemuDomainObjPrivate *priv =3D vm->privateData; + virDomainDeviceDef dev =3D { VIR_DOMAIN_DEVICE_FS, + { .fs =3D fs } }; + g_autoptr(virDomainChrSourceDef) chardev =3D NULL; + virErrorPtr origErr =3D NULL; + bool releaseaddr =3D false; + bool chardevAdded =3D false; + bool started =3D false; + g_autofree char *devstr =3D NULL; + g_autofree char *charAlias =3D NULL; + int ret =3D -1; + + if (fs->fsdriver !=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("only virtiofs filesystems can be hotplugged")); + return -1; + } + + if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev) < 0) + return -1; + + if (qemuAssignDeviceFSAlias(vm->def, fs) < 0) + goto cleanup; + + chardev =3D qemuDomainGetVHostUserChrSourceDef(priv, fs); + charAlias =3D qemuDomainGetVhostUserChrAlias(fs->info.alias); + + if (!(devstr =3D qemuBuildVHostUserFsDevStr(fs, vm->def, charAlias, pr= iv))) + goto cleanup; + + if (!fs->sock) { + if (qemuVirtioFSPrepareDomain(driver, fs) < 0) + goto cleanup; + + if (qemuVirtioFSStart(qemuDomainLogContextGetManager(priv->logCtxt= ), driver, vm, fs) < 0) + goto cleanup; + started =3D true; + + if (qemuVirtioFSSetupCgroup(vm, fs, priv->cgroup) < 0) + goto cleanup; + } + + qemuDomainObjEnterMonitor(driver, vm); + + if (qemuMonitorAttachCharDev(priv->mon, charAlias, chardev) < 0) + goto exit_monitor; + chardevAdded =3D true; + + if (qemuDomainAttachExtensionDevice(priv->mon, &fs->info) < 0) + goto exit_monitor; + + if (qemuMonitorAddDevice(priv->mon, devstr) < 0) { + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &fs->info)= ); + goto exit_monitor; + } + + if (qemuDomainObjExitMonitor(driver, vm) < 0) { + releaseaddr =3D false; + goto cleanup; + } + + VIR_APPEND_ELEMENT(vm->def->fss, vm->def->nfss, fs); + + ret =3D 0; + + audit: + virDomainAuditFS(vm, NULL, fs, "attach", ret =3D=3D 0); + cleanup: + if (ret < 0) { + virErrorPreserveLast(&origErr); + if (releaseaddr) + qemuDomainReleaseDeviceAddress(vm, &fs->info); + if (started) + qemuVirtioFSStop(driver, vm, fs); + virErrorRestore(&origErr); + } + + return ret; + + exit_monitor: + virErrorPreserveLast(&origErr); + if (chardevAdded) + ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); + if (qemuDomainObjExitMonitor(driver, vm) < 0) + releaseaddr =3D false; + virErrorRestore(&origErr); + goto audit; +} + + int qemuDomainAttachLease(virQEMUDriver *driver, virDomainObj *vm, --=20 2.31.1 From nobody Fri Mar 29 00:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504763; cv=none; d=zohomail.com; s=zohoarc; b=LZhfkqBjxYqVh/fftOxGKOpsBdIVWKCavAPAdD6hVfqXNr7ig6d/XuNcREqkG7GqhAl9IwnFch8du0tKZxEXig7v2hLxtnstCNL1t+8SQ92y0FAV0y8E+jBZAyC3kzFpMk0Q0roEYCZ6qInAtKLiu01nDXlo9ylJzLkzKTbYA4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504763; 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=0jsfs/EWgXk76J42XcVGGnt+w3DZrKDm/+tWrb9K0FU=; b=QyKXRUGAQBgBMRD4+pq7qW4w2j3DQOXh9tqSp1OTFSwfY3yW/J1HhcbaLKVgLqvkElCte01U+vbCNJmP3DlDtkKvTDNSQ/aySOtt5P/VLqROJ2SbdB/67IvA1ObNRs1rmXzgylVcz6frpJfszvNmqrCtT+JQv06W8DosM326NRQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633504763631960.5515750027546; Wed, 6 Oct 2021 00:19:23 -0700 (PDT) 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-283-fdzmiKMCPFmAYNRZPCnV_Q-1; Wed, 06 Oct 2021 03:19:21 -0400 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 73F9519251B1; Wed, 6 Oct 2021 07:19:16 +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 5841A604CC; Wed, 6 Oct 2021 07:19:16 +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 280471806D02; Wed, 6 Oct 2021 07:19:16 +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 1967G6TM007650 for ; Wed, 6 Oct 2021 03:16:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5F70F60936; Wed, 6 Oct 2021 07:16:06 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9FE960853 for ; Wed, 6 Oct 2021 07:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504762; 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=0jsfs/EWgXk76J42XcVGGnt+w3DZrKDm/+tWrb9K0FU=; b=ioNVwKDjrnQbUaYb8lXpQKcH6T4RGLfyBlvR1Dh+4jGuwq+gZm72rgJq2WMWmSadKQFbN8 JK3jgp9V4PfEgHakr8Kx5VTAwpJ/l2ikFOoTU+S6XtxiN1NU4mQtjvvh2XtIxsGeMEm6EA PJpWTHOPRKzQhcb49D8LR/8wyrG3w44= X-MC-Unique: fdzmiKMCPFmAYNRZPCnV_Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 16/16] qemu: implement virtiofs hotunplug Date: Wed, 6 Oct 2021 09:15:22 +0200 Message-Id: <879ef33d4993a72db5877ec8344223d53df27de4.1633504466.git.jtomko@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.79 on 10.5.11.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504764842100001 Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 24 ++++++++++++ src/conf/domain_conf.h | 2 + src/libvirt_private.syms | 1 + src/qemu/qemu_hotplug.c | 81 +++++++++++++++++++++++++++++++++++++++- 4 files changed, 106 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b8370f6950..057dbf91a5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28829,6 +28829,30 @@ virDomainFSRemove(virDomainDef *def, size_t i) return fs; } =20 +ssize_t +virDomainFSDefFind(virDomainDef *def, + virDomainFSDef *fs) +{ + size_t i =3D 0; + + for (i =3D 0; i < def->nfss; i++) { + virDomainFSDef *tmp =3D def->fss[i]; + + if (fs->dst && STRNEQ_NULLABLE(fs->dst, tmp->dst)) + continue; + + if (fs->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + !virDomainDeviceInfoAddressIsEqual(&fs->info, &tmp->info)) + continue; + + if (fs->info.alias && STRNEQ_NULLABLE(fs->info.alias, tmp->info.al= ias)) + continue; + + return i; + } + return -1; +} + virDomainFSDef * virDomainGetFilesystemForTarget(virDomainDef *def, const char *target) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c23c233184..1fcef7b0e1 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3757,6 +3757,8 @@ virDomainFSDef *virDomainGetFilesystemForTarget(virDo= mainDef *def, int virDomainFSInsert(virDomainDef *def, virDomainFSDef *fs); int virDomainFSIndexByName(virDomainDef *def, const char *name); virDomainFSDef *virDomainFSRemove(virDomainDef *def, size_t i); +ssize_t virDomainFSDefFind(virDomainDef *def, + virDomainFSDef *fs); =20 unsigned int virDomainVideoDefaultRAM(const virDomainDef *def, const virDomainVideoType type); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index fd0eea0777..687a3bbc4c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -410,6 +410,7 @@ virDomainFeatureTypeFromString; virDomainFeatureTypeToString; virDomainFSAccessModeTypeToString; virDomainFSCacheModeTypeToString; +virDomainFSDefFind; virDomainFSDefFree; virDomainFSDefNew; virDomainFSDriverTypeToString; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f5dad0b829..713da5ebfc 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5180,6 +5180,45 @@ qemuDomainRemoveRedirdevDevice(virQEMUDriver *driver, } =20 =20 +static int +qemuDomainRemoveFSDevice(virQEMUDriver *driver, + virDomainObj *vm, + virDomainFSDef *fs) +{ + g_autofree char *charAlias =3D NULL; + qemuDomainObjPrivate *priv =3D vm->privateData; + ssize_t idx; + int rc =3D 0; + + VIR_DEBUG("Removing FS device %s from domain %p %s", + fs->info.alias, vm, vm->def->name); + + charAlias =3D qemuDomainGetVhostUserChrAlias(fs->info.alias); + + qemuDomainObjEnterMonitor(driver, vm); + + if (qemuMonitorDetachCharDev(priv->mon, charAlias) < 0) + rc =3D -1; + + if (qemuDomainObjExitMonitor(driver, vm) < 0) + return -1; + + virDomainAuditFS(vm, fs, NULL, "detach", rc =3D=3D 0); + + if (rc < 0) + return -1; + + if (!fs->sock) + qemuVirtioFSStop(driver, vm, fs); + + if ((idx =3D virDomainFSDefFind(vm->def, fs)) >=3D 0) + virDomainFSRemove(vm->def, idx); + qemuDomainReleaseDeviceAddress(vm, &fs->info); + virDomainFSDefFree(fs); + return 0; +} + + static void qemuDomainRemoveAuditDevice(virDomainObj *vm, virDomainDeviceDef *detach, @@ -5218,6 +5257,10 @@ qemuDomainRemoveAuditDevice(virDomainObj *vm, virDomainAuditRedirdev(vm, detach->data.redirdev, "detach", succes= s); break; =20 + case VIR_DOMAIN_DEVICE_FS: + virDomainAuditFS(vm, detach->data.fs, NULL, "detach", success); + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_CONTROLLER: case VIR_DOMAIN_DEVICE_WATCHDOG: @@ -5225,7 +5268,6 @@ qemuDomainRemoveAuditDevice(virDomainObj *vm, /* These devices don't have associated audit logs */ break; =20 - case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_GRAPHICS: @@ -5323,9 +5365,13 @@ qemuDomainRemoveDevice(virQEMUDriver *driver, return -1; break; =20 + case VIR_DOMAIN_DEVICE_FS: + if (qemuDomainRemoveFSDevice(driver, vm, dev->data.fs) < 0) + return -1; + break; + case VIR_DOMAIN_DEVICE_NONE: case VIR_DOMAIN_DEVICE_LEASE: - case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_GRAPHICS: @@ -6020,6 +6066,31 @@ qemuDomainDetachPrepVsock(virDomainObj *vm, } =20 =20 +static int +qemuDomainDetachPrepFS(virDomainObj *vm, + virDomainFSDef *match, + virDomainFSDef **detach) +{ + ssize_t idx; + + if ((idx =3D virDomainFSDefFind(vm->def, match)) < 0) { + virReportError(VIR_ERR_DEVICE_MISSING, "%s", + _("matching filesystem not found")); + return -1; + } + + if (vm->def->fss[idx]->fsdriver !=3D VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOF= S) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("only virtiofs filesystems can be hotplugged")); + return -1; + } + + *detach =3D vm->def->fss[idx]; + + return 0; +} + + static int qemuDomainDetachDeviceLease(virQEMUDriver *driver, virDomainObj *vm, @@ -6141,6 +6212,12 @@ qemuDomainDetachDeviceLive(virDomainObj *vm, break; =20 case VIR_DOMAIN_DEVICE_FS: + if (qemuDomainDetachPrepFS(vm, match->data.fs, + &detach.data.fs) < 0) { + return -1; + } + break; + case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_GRAPHICS: --=20 2.31.1