From nobody Tue May 21 11:48:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1698328124; cv=none; d=zohomail.com; s=zohoarc; b=L3pUy7U0LLrHghgz3Mt0Uv+UGxcgEhA022fHgYzxsVhHdndo+QwOknf2vwH0ngK/xFj051kULjqdjirp1UdSvffXTcBLIHdKNy2L8X+/xjLuUtcEbSKD9nFypPd2bEJkwKY1xSsk5oTQ8FZP3QlFtCoeMkPe2VYegDJo2mQlhq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698328124; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=sk7Fp3HP5OzyVdU/BgVB3gdsxnYMrnf56CQsXXesqDQ=; b=ggh6LtSagcLN1YNkf4OU17tpkbYONjDHlY7ulc19WoL8LygN+V6AYnGTsKtCMarE4mwJgABTpjYkIeUMihTS4dRRe44O2dLeL3CvDqlloZ1lX6n88KyRa/CQA2qk01vmoUJZ0Udwn9ipY5sjFgo5A7lzTVtg5JflZXFqWz8FjnA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1698328124120925.104715044687; Thu, 26 Oct 2023 06:48:44 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-OCEyr5o7O3Krp0_4hFkkjA-1; Thu, 26 Oct 2023 09:48:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C1CFD856A2B; Thu, 26 Oct 2023 13:48:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BCE11C060B0; Thu, 26 Oct 2023 13:48:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9658B19465BC; Thu, 26 Oct 2023 13:48:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9EDF3194658C for ; Thu, 26 Oct 2023 13:48:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8238E492BE7; Thu, 26 Oct 2023 13:48:33 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C761492BEE for ; Thu, 26 Oct 2023 13:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698328123; 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=sk7Fp3HP5OzyVdU/BgVB3gdsxnYMrnf56CQsXXesqDQ=; b=PoCtkiVBYrwy23OsQuC/hM3Z0+gyE2kSkgLNYETQ4eDG3Ag9B48sUTNVxUoydasVZQiagD mJbMjL0C1V4wQisetAru+HwQjnojMkSZEkSAyX/TSG6vWNc8nr1D2F6LDI4dBGtwOGquoE rUYGEjlDmSQu7obwa4oYC1jzXks0guo= X-MC-Unique: OCEyr5o7O3Krp0_4hFkkjA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 1/3] qemu: process: Extract host setup of disk device into helpers Date: Thu, 26 Oct 2023 15:48:29 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1698328126364100004 Content-Type: text/plain; charset="utf-8" Currently the code sets up only VDPA backends but will be used later in hotplug code too. This patch also uses normal forward iteration in the loop in qemuProcessPrepareHostStorage as we don't need to remove disks from the disk list at that point. Signed-off-by: Peter Krempa --- src/qemu/qemu_process.c | 76 ++++++++++++++++++++++++++++++++++++----- src/qemu/qemu_process.h | 7 ++++ 2 files changed, 74 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 63c0c62a46..1ef032dbd2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6777,6 +6777,69 @@ qemuProcessPrepareHostStorageSourceVDPA(virStorageSo= urce *src, } +/** + * See qemuProcessPrepareHostStorageSourceChain + */ +int +qemuProcessPrepareHostStorageSource(virDomainObj *vm, + virStorageSource *src) +{ + /* connect to any necessary vdpa block devices */ + if (qemuProcessPrepareHostStorageSourceVDPA(src, vm->privateData) < 0) + return -1; + + return 0; +} + + +/** + * qemuProcessPrepareHostStorageSourceChain: + * + * @vm: domain object + * @chain: source chain + * + * Prepare the host side of a disk for use with the VM. Note that this fun= ction + * accesses host resources. + */ +int +qemuProcessPrepareHostStorageSourceChain(virDomainObj *vm, + virStorageSource *chain) +{ + virStorageSource *n; + + for (n =3D chain; virStorageSourceIsBacking(n); n =3D n->backingStore)= { + if (qemuProcessPrepareHostStorageSource(vm, n) < 0) + return -1; + } + + return 0; +} + + +/** + * qemuProcessPrepareHostStorageDisk: + * + * @vm: domain object + * @disk: disk definition object + * + * Prepare the host side of a disk for use with the VM. Note that this fun= ction + * accesses host resources. + * + * Note that this function does not call qemuDomainDetermineDiskChain as t= hat is + * needed in qemuProcessPrepareHostStorage to remove disks based on the st= artup + * policy, thus other callers need to call it explicitly. + */ +int +qemuProcessPrepareHostStorageDisk(virDomainObj *vm, + virDomainDiskDef *disk) +{ + if (qemuProcessPrepareHostStorageSourceChain(vm, disk->src) < 0) + return -1; + + return 0; +} + + static int qemuProcessPrepareHostStorage(virQEMUDriver *driver, virDomainObj *vm, @@ -6813,16 +6876,11 @@ qemuProcessPrepareHostStorage(virQEMUDriver *driver, return -1; } - /* connect to any necessary vdpa block devices */ - for (i =3D vm->def->ndisks; i > 0; i--) { - size_t idx =3D i - 1; - virDomainDiskDef *disk =3D vm->def->disks[idx]; - virStorageSource *src; + for (i =3D 0; i < vm->def->ndisks; i++) { + virDomainDiskDef *disk =3D vm->def->disks[i]; - for (src =3D disk->src; virStorageSourceIsBacking(src); src =3D sr= c->backingStore) { - if (qemuProcessPrepareHostStorageSourceVDPA(src, vm->privateDa= ta) < 0) - return -1; - } + if (qemuProcessPrepareHostStorageDisk(vm, disk) < 0) + return -1; } return 0; diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index ef05b46892..c1ea949215 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -133,6 +133,13 @@ int qemuProcessPrepareHost(virQEMUDriver *driver, virDomainObj *vm, unsigned int flags); +int qemuProcessPrepareHostStorageSource(virDomainObj *vm, + virStorageSource *src); +int qemuProcessPrepareHostStorageSourceChain(virDomainObj *vm, + virStorageSource *chain); +int qemuProcessPrepareHostStorageDisk(virDomainObj *vm, + virDomainDiskDef *disk); + int qemuProcessDeleteThreadContext(virDomainObj *vm); int qemuProcessLaunch(virConnectPtr conn, --=20 2.41.0 From nobody Tue May 21 11:48:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1698328124; cv=none; d=zohomail.com; s=zohoarc; b=LWhfK+2f8JU510zT16/oPXDOqBNzRO43IGM4/StsSu8qtnu4z4+jrNe5yjEfnedzkM6bVRDkafYXHWzubjQ6SE4da9xNmfurlnA0/IDqj+ZHTWjifik4TOXbgCKhGhpvrsBG/zj/lTMRFPfl/+59coQFnJNBTTQ7EdiIS3aHmic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698328124; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=CCNRA6Q+EBYACFGtT7L7nbUO7rH7m6Kbt0FmOsdMQKs=; b=Lx6rhEPWdymPSi0393iqbMqrzHde0JanMXVgWNWwN9P4aLT3Tb2cKgVeMxJsGwKZ2saESgbkjf+ssIx5AbiYh0cYEfNjGirm7zF1xZtsa9xMYIavRLwLST9T92Seuea3mgAFZVioFGSdBbMq90m9o1rHUrTJimC9KsEz992RTAI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 169832812414541.56777195654968; Thu, 26 Oct 2023 06:48:44 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-UJkWzda2PjmgVmfr25OEpg-1; Thu, 26 Oct 2023 09:48:40 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 944EA881E2F; Thu, 26 Oct 2023 13:48:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75C4140C6F79; Thu, 26 Oct 2023 13:48:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D2F9A19465A0; Thu, 26 Oct 2023 13:48:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 57252194658C for ; Thu, 26 Oct 2023 13:48:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4C121492BE7; Thu, 26 Oct 2023 13:48:34 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC0DB492BEE for ; Thu, 26 Oct 2023 13:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698328123; 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=CCNRA6Q+EBYACFGtT7L7nbUO7rH7m6Kbt0FmOsdMQKs=; b=Tpeje8dIfBzbx+0FIk8jeakEgcjNO0xkW/vnozXEwso4mf5yQPnuMVZ+4qDPBBhtcDqW3x 2AlTiKJxCo4PfYaYj3RMY9Uds/ysmOMpT73J/Ab6enYRj/ci8hFm+Wo+ackxVpNLC3UM7e YxDZh9Qe9rmYPQSnJNQgH5lkMo6+jL4= X-MC-Unique: UJkWzda2PjmgVmfr25OEpg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 2/3] qemu: hotplug: Setup host side of VDPA device for disk hotplug Date: Thu, 26 Oct 2023 15:48:30 +0200 Message-ID: <240aa11815d78f7ddbe9a8acb802e5ed0e61ed80.1698328017.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1698328126351100003 Content-Type: text/plain; charset="utf-8" The code which opens the VDPA device and prepares it for FD passing was not called in the hotplug code path, preventing hotplug of VDPA disks with: error: internal error: argument key 'path' must not have null value Use the new helper qemuProcessPrepareHostStorageDisk to setup the VDPA definition. Closes: https://gitlab.com/libvirt/libvirt/-/issues/539 Signed-off-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 1f7f5bdd26..fec7c4be4e 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1007,6 +1007,9 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver = *driver, if (qemuDomainDetermineDiskChain(driver, vm, disk, NULL) < 0) goto cleanup; + if (qemuProcessPrepareHostStorageDisk(vm, disk) < 0) + goto cleanup; + if (qemuHotplugAttachManagedPR(vm, disk->src, VIR_ASYNC_JOB_NONE) < 0) goto cleanup; --=20 2.41.0 From nobody Tue May 21 11:48:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1698328128; cv=none; d=zohomail.com; s=zohoarc; b=Dh2S//7iTJgZax/Hs/wVWVtnHudfgO1xMCI+DSZDBHJaHNILNZlei9qd823zJ+lc4q1PBfz/z2Ho5TempJkz2G8MYHzuKGGOd5gwlbBdvDgvYM8XJ/U/Uj/iJBq7rX8oRItRK5+VbMy+3xDTvvgurFj6ftGe5OBb/7/S2+xMvWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698328128; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=BOJBnDkbHx9cuL8O2qZPj+EvSa8Je0l7LtJM54astvE=; b=MmMWLclEXDlsNs38HsX0eBEougE3rfc2B2H4Zyt7X0sW0cFrknAFeZpGN2Y190SJ0QuRzCqPmKfWY8wo7auj+7cfXtXAlX4fdbLkrTp5i9lW/QyKKqvirL7NMfU1T5FN5liMOLXkl/RHh46UWtyTPv8Vo3RVlTmD/2Dy1l/KIz4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1698328128853350.52832171715806; Thu, 26 Oct 2023 06:48:48 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-669-dnia301zN6CXoUWNh0oPNw-1; Thu, 26 Oct 2023 09:48:44 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C6F388D01A; Thu, 26 Oct 2023 13:48:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77D422026D66; Thu, 26 Oct 2023 13:48:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 612D61946595; Thu, 26 Oct 2023 13:48:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 304FC19465A0 for ; Thu, 26 Oct 2023 13:48:35 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2022D492BE7; Thu, 26 Oct 2023 13:48:35 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id A187E492BE9 for ; Thu, 26 Oct 2023 13:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698328127; 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=BOJBnDkbHx9cuL8O2qZPj+EvSa8Je0l7LtJM54astvE=; b=EzBeoo6IXMiltrpYF303uILCb5WjNLSjnpzvWRwOGHfLXf1syVZ+u7eQNoFbgNx91Smwzo dcd90RFAb2hnILy07POt7L1OZW/Ut+PUFgXGK3zELidnsT7spBzXM7dR3Ez17iEE7EY7ZO NzTHGTznKiZfMVK+jD6E+4fLF00Zo7E= X-MC-Unique: dnia301zN6CXoUWNh0oPNw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 3/3] qemu: Setup host side of VDPA device for block copy Date: Thu, 26 Oct 2023 15:48:31 +0200 Message-ID: <498bb56f1dad14289a041c651adf1979d4308fd6.1698328017.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1698328130431100001 Content-Type: text/plain; charset="utf-8" Setup the VDPA bits of the appropriate part of the image chain for block copy. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 4 ++++ src/qemu/qemu_driver.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 41038fb994..42c12a5e9b 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -23,6 +23,7 @@ #include "qemu_domain.h" #include "qemu_alias.h" #include "qemu_security.h" +#include "qemu_process.h" #include "storage_source.h" #include "viralloc.h" @@ -3675,6 +3676,9 @@ qemuBlockPivot(virDomainObj *vm, virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_SNAPSHOT= _ALLOW_WRITE_ONLY) && virStorageSourceHasBacking(disk->mirror)) { + if (qemuProcessPrepareHostStorageSourceChain(vm, disk->mir= ror->backingStore) < 0) + return -1; + if (!(chainattachdata =3D qemuBuildStorageSourceChainAttac= hPrepareBlockdev(disk->mirror->backingStore))) return -1; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 86da8da777..d00d2a27c6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14290,10 +14290,16 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALL= OW_WRITE_ONLY)) { g_autoptr(virStorageSource) terminator =3D virStorageSourceNew= (); + if (qemuProcessPrepareHostStorageSource(vm, mirror) < 0) + goto endjob; + if (!(data =3D qemuBuildStorageSourceChainAttachPrepareBlockde= vTop(mirror, = terminator))) goto endjob; } else { + if (qemuProcessPrepareHostStorageSourceChain(vm, mirror) < 0) + goto endjob; + if (!(data =3D qemuBuildStorageSourceChainAttachPrepareBlockde= v(mirror))) goto endjob; } @@ -14308,6 +14314,9 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, if (mirror_shallow) { /* if external backing store is populated we'll need to open i= t */ if (virStorageSourceHasBacking(mirror)) { + if (qemuProcessPrepareHostStorageSourceChain(vm, mirror->b= ackingStore) < 0) + goto endjob; + if (!(data =3D qemuBuildStorageSourceChainAttachPrepareBlo= ckdev(mirror->backingStore))) goto endjob; @@ -14321,6 +14330,9 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, mirrorBacking =3D mirror->backingStore; } + if (qemuProcessPrepareHostStorageSource(vm, mirror) < 0) + goto endjob; + if (!(crdata =3D qemuBuildStorageSourceChainAttachPrepareBlockdevT= op(mirror, = mirrorBacking))) goto endjob; --=20 2.41.0