From nobody Mon Feb 9 16:03:02 2026 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=1621601306; cv=none; d=zohomail.com; s=zohoarc; b=C92kA68XuyAwNFfSmNNKYK/oqgqXWDNonf1RRR0u6LvIjIKXS6DtDgw3UL05ASvyhhONYE2U8vbfE9uINhUM4DN1VrH/EenQC3+tJaTZkGnE0QKF1NYOgpM7OsQdV7HmGoMa/4jEMnnHgMC0bYPb9/HvRTxRpfCQpiXkz3Srgj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621601306; 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=cD2ru2QPTenkVNui9uAw4ZhMkU1PNhfF+bCKf3rv0JU=; b=F0369YC3VJM1p22H0jj++z5ll2txedELITmlMjjar/uh7r/ZBLA/nL3Cbcr/4Wy8UnsF2h03YaSXT/c5pBQlQi1/jOrVab9FXm0XKXiKdnhs3fcW7fVWeD5PfH0BB+ueUao/LrcFjTbz+PsjImURXGI/3bHXJBAkTy5WDRRQ+OQ= 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) header.from= 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 1621601306345411.54964111305264; Fri, 21 May 2021 05:48: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-233-Z_F4ljupP1CgQ_wYWpDmgA-1; Fri, 21 May 2021 08:48:21 -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 D1C5418BA280; Fri, 21 May 2021 12:48:13 +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 AF84B5D9D5; Fri, 21 May 2021 12:48: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 809ED1801264; Fri, 21 May 2021 12:48:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14LCm942031197 for ; Fri, 21 May 2021 08:48:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 066B259472; Fri, 21 May 2021 12:48:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F672421F for ; Fri, 21 May 2021 12:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621601305; 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=cD2ru2QPTenkVNui9uAw4ZhMkU1PNhfF+bCKf3rv0JU=; b=ZJhRFQBJ82aHrDiv1Scjd4b2Nt988Oc2qMzthA5R04G6u1aAwIr3kaiRoN+nrc5hQoY0+F Iecman1eTC5tvbNnle/K44H1VwmjvBN8a0G4ka+XcYcUwKZESOe7QQxq7/Vj7rAbFL6O+k EkXT1isxwDmzYNi7oU97x9uEXGNvC5E= X-MC-Unique: Z_F4ljupP1CgQ_wYWpDmgA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 17/35] qemuDomainRemoveDiskDevice: Move 'copy-on-read' handling to qemuBlockStorageSourceChainData Date: Fri, 21 May 2021 14:47:17 +0200 Message-Id: <904afccf36c0fbefd1a72d4d1a4f2f835266e5ce.1621601161.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Unify the handling of the copy-on-read filter by changing the handling to use qemuBlockStorageSourceChainData. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 31dc9a43b2..86b2027be7 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4288,7 +4288,6 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, virDomainDeviceDef dev; size_t i; qemuDomainObjPrivate *priv =3D vm->privateData; - g_autofree char *corAlias =3D NULL; bool blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); int ret =3D -1; @@ -4301,10 +4300,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, if (!(diskBackend =3D qemuBlockStorageSourceChainDetachPrepareChar= dev(chardevAlias))) goto cleanup; - } else if (blockdev && - !qemuDiskBusIsSD(disk->bus)) { - corAlias =3D g_strdup(diskPriv->nodeCopyOnRead); - + } else if (blockdev && !qemuDiskBusIsSD(disk->bus)) { if (diskPriv->blockjob) { /* the block job keeps reference to the disk chain */ diskPriv->blockjob->disk =3D NULL; @@ -4314,6 +4310,13 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, if (!(diskBackend =3D qemuBlockStorageSourceChainDetachPrepare= Blockdev(disk->src))) goto cleanup; } + + if (diskPriv->nodeCopyOnRead) { + if (!diskBackend) + diskBackend =3D g_new0(qemuBlockStorageSourceChainData, 1); + diskBackend->copyOnReadNodename =3D g_strdup(diskPriv->nodeCop= yOnRead); + diskBackend->copyOnReadAttached =3D true; + } } else { char *driveAlias; @@ -4333,9 +4336,6 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); - if (corAlias) - ignore_value(qemuMonitorBlockdevDel(priv->mon, corAlias)); - if (diskBackend) qemuBlockStorageSourceChainDetach(priv->mon, diskBackend); --=20 2.31.1