From nobody Mon Feb 9 01:22:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561391036; cv=none; d=zoho.com; s=zohoarc; b=DSL2527OtJ5pd+kmoMCZiLPG3svZJ8FhAQAcEwRIdvFWOblaFJ8GSxqFTNitsVkiaWFRWtb4WBCmP4sbu3mAtRbekNT/EXQ3Nm76xpNasmgMdJKNM9Qw9z9kP3/4Zx3oUIjlX3pqYvhu569xhMB5mIA59x5MgE/26AblyAYl0i4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561391036; 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:ARC-Authentication-Results; bh=HtnONEpoqX2hx5sB8xnBYRhgV3OlAUHcOvedvAS2Rr4=; b=BsmrfjtKpWrlYJAlV2phnRk+tSItbfwSbuXAXJ9vx2JHaHabn3Zogtio+iddjpfsyO/seL/OZGNWtbcantSLPs6S2mpiLKrZMOol6udgDMYvSXAErV50AADStNS2ko46PwoMudtDKW0/Zswwvwb/jBH+0mvssnoq99mxkhscBA4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156139103694166.78977989693522; Mon, 24 Jun 2019 08:43:56 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 542F4295E; Mon, 24 Jun 2019 15:43:50 +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 2E6D75C23A; Mon, 24 Jun 2019 15:43:50 +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 D785DC57E; Mon, 24 Jun 2019 15:43:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5OFd6lp020988 for ; Mon, 24 Jun 2019 11:39:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 170DC5D9DE; Mon, 24 Jun 2019 15:39:06 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F5095D9C5 for ; Mon, 24 Jun 2019 15:39:05 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 24 Jun 2019 17:38:53 +0200 Message-Id: <3e3dd4f1a7c8c1589d8dbc19a3f85c2507964fdf.1561390513.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/10] qemu: hotplug: Use storage chain helpers in qemuDomainRemoveDiskDevice 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 24 Jun 2019 15:43:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use the new helpers for removing the backing chain in case when -blockdev is used. For -drive this function has a local implementation. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 413b81c0c7..1b1d2ba5ce 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4381,7 +4381,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, virDomainDiskDefPtr disk) { qemuDomainDiskPrivatePtr diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); - qemuHotplugDiskSourceDataPtr diskbackend =3D NULL; + VIR_AUTOPTR(qemuBlockStorageSourceChainData) diskBackend =3D NULL; virDomainDeviceDef dev; size_t i; qemuDomainObjPrivatePtr priv =3D vm->privateData; @@ -4392,13 +4392,21 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, VIR_DEBUG("Removing disk %s from domain %p %s", disk->info.alias, vm, vm->def->name); - if (!(diskbackend =3D qemuHotplugDiskSourceRemovePrepare(disk, disk->s= rc, - priv->qemuCaps)= )) - return -1; if (blockdev) { if (VIR_STRDUP(corAlias, diskPriv->nodeCopyOnRead) < 0) goto cleanup; + + if (!(diskBackend =3D qemuBlockStorageSourceChainDetachPrepareBloc= kdev(disk->src))) + goto cleanup; + } else { + char *driveAlias; + + if (!(driveAlias =3D qemuAliasDiskDriveFromDisk(disk))) + goto cleanup; + + if (!(diskBackend =3D qemuBlockStorageSourceChainDetachPrepareDriv= e(disk->src, driveAlias))) + goto cleanup; } for (i =3D 0; i < vm->def->ndisks; i++) { @@ -4413,7 +4421,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, if (corAlias) ignore_value(qemuMonitorDelObject(priv->mon, corAlias)); - qemuHotplugDiskSourceRemove(priv->mon, diskbackend); + qemuBlockStorageSourceChainDetach(priv->mon, diskBackend); if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; @@ -4435,7 +4443,6 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, ret =3D 0; cleanup: - qemuHotplugDiskSourceDataFree(diskbackend); virDomainDiskDefFree(disk); return ret; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list