From nobody Sun Sep 20 16:53:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1784625066; cv=none; d=zohomail.com; s=zohoarc; b=EKvLCy89pP3db5S1mj9Wv/8mnWpV05UH8WtBNBYju9HZjgvrOwyG1L+zxx5TwujjbnhXVJoc55kjzwxdsM4Th+C9rCMV0ZFhoX5N67S9Y1GQeT0XnXv2v9q0X6wS1LG/qmEyQatYSmbC9xBXvL6Ijfnk9ZWopfe4USonWBT6Z7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784625066; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=a6/xIYPandg5x3WbCHp0fzDfDYIkNRTO/edJxqTKNlI=; b=UiF/piSyv905uAezQ/RA5CIvR4ptHHAwXetriZMvFLj7NN1XkF9gjO7MYV0EhPmSah6BscXzQtSP0dZFtm+uMu25x1eh/eQFNNQ0Udvx1/C1gn8Qtj51MB1zfKHw9z0ohPcjZME9whZkHSEEgjsYSbmPbS8RefglJ8ex6q+digQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 178462506618181.25493151163221; Tue, 21 Jul 2026 02:11:06 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id CF67A41B57; Tue, 21 Jul 2026 05:11:04 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id B454341E10; Tue, 21 Jul 2026 05:07:48 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8F4B3419F9; Mon, 20 Jul 2026 03:13:49 -0400 (EDT) Received: from oss.nttdata.com (oss.nttdata.com [49.212.34.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 1193B419F3 for ; Mon, 20 Jul 2026 03:13:28 -0400 (EDT) Received: by oss.nttdata.com (Postfix, from userid 1024) id 8262B20202A2; Mon, 20 Jul 2026 16:06:23 +0900 (JST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Greylist: delayed 417 seconds by postgrey-1.37 at lists.libvirt.org; Mon, 20 Jul 2026 03:13:34 EDT To: devel@lists.libvirt.org Subject: [PATCH 1/2] qemu: Skip empty disk source when detaching a disk device Date: Mon, 20 Jul 2026 16:06:23 +0900 Message-ID: <20260720070624.2503482-2-Mitsuru.Kariya@oss.nttdata.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260720070624.2503482-1-Mitsuru.Kariya@oss.nttdata.com> References: <20260720070624.2503482-1-Mitsuru.Kariya@oss.nttdata.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: clamav-milter 1.4.3 at oss.nttdata.com X-Virus-Status: Clean X-MailFrom: kariyam@oss.nttdata.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation Message-ID-Hash: 5LPROBHU4AHCCGYMCSBWJJV55FF43KZK X-Message-ID-Hash: 5LPROBHU4AHCCGYMCSBWJJV55FF43KZK X-Mailman-Approved-At: Tue, 21 Jul 2026 09:07:30 +0000 CC: Mitsuru Kariya X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Mitsuru Kariya via Devel Reply-To: Mitsuru Kariya X-ZM-MESSAGEID: 1784625068219158500 Content-Type: text/plain; charset="utf-8" qemuDomainRemoveDiskDevice() called qemuBlockStorageSourceChainDetachPrepareBlockdev() unconditionally. A CD-ROM with no media has an empty source (path =3D=3D NULL), for which virStorageSourceIsEmpty() returns true while virStorageSourceIsBacking() still returns true, so the chain walk prepared a blockdev-del for a node that was never created in QEMU. Detaching such a device produced an internal error, either "Failed to find node with node-name=3D'libvirt-N-storage'" (when a prior eject had left a stale node name in the source) or "argument key 'node-name' must not have null value". Guard the detach preparation with virStorageSourceIsEmpty(), as the old-media detach in qemuDomainChangeMediaBlockdev() already does. The following qemuBlockStorageSourceChainDetach() and access revoke are already guarded by a non-NULL diskBackend, so an empty source is left untouched. Signed-off-by: Mitsuru Kariya Reviewed-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 5be567b510..c2cd5496e0 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4861,7 +4861,8 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, diskPriv->blockjob->disk =3D NULL; g_clear_pointer(&diskPriv->blockjob, virObjectUnref); } else { - if (!(diskBackend =3D qemuBlockStorageSourceChainDetachPrepare= Blockdev(disk->src))) + if (!virStorageSourceIsEmpty(disk->src) && + !(diskBackend =3D qemuBlockStorageSourceChainDetachPrepare= Blockdev(disk->src))) goto cleanup; } =20 --=20 2.43.0