From nobody Sun Oct 5 01:52:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 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=1757491536; cv=none; d=zohomail.com; s=zohoarc; b=HI90yASdDSbhv3HTdNihojgqm9D4JWw2bYMPm3UKKhEDz3zoaDaFKkbhrNxBPvAp2V2+zVpxJ5jsP8ZxjwryRxkxqcpFo2g1XWKmNfGJpZmjLh1b9uVWATyM+121gEeE8eV5mBramYZIUJa3qtazJJZODwy1EMqg9Kxu2C5ejCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757491536; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=6lAEOUZqipenL61ZQ14UB0OtODqyXGq23GEj08oZiyU=; b=eQYbICQzkJqgskm/Q6c36pUunqxKuqWKwtF8N7S6nPbtTgekbHFBrIiSzA1yKV8RkhBPR1/Y5b5Kam42vsBgsWkm+qBWtA869i7iLSv44MpxRVktyp/wce/OlWSjCZWsLPIOTCPiviXWeBc1r9ZZgWJA/QGWYLXsd+Sx9cVA7ts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 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 [8.43.85.245]) by mx.zohomail.com with SMTPS id 1757491536028346.00718741419905; Wed, 10 Sep 2025 01:05:36 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 4B1BD41A9A; Wed, 10 Sep 2025 04:05:35 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 3962843DB0; Wed, 10 Sep 2025 04:04:16 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 986A0419D9; Wed, 10 Sep 2025 04:03:50 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 DB1F841B00 for ; Wed, 10 Sep 2025 04:03:49 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-42-_CVo-K8IOoWvnLTYUF_FuA-1; Wed, 10 Sep 2025 04:03:48 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8A2B71800577 for ; Wed, 10 Sep 2025 08:03:47 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.3.236]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DB51019560B8 for ; Wed, 10 Sep 2025 08:03:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757491429; h=from:from: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; bh=6lAEOUZqipenL61ZQ14UB0OtODqyXGq23GEj08oZiyU=; b=AMy+uYTCfNpob6mqLCj+pM/K7RX2ClZgGD51AUKoUKpigF4cZQqzZg+OFYzleEjk6GD7qi IvF5w+EwY78jp70315H8E7lo74k6uledIVMzyy2NcCbJ0na9aTug4NAw7JlzBoavNSC/4n Gm0JemP88pJZ3awrA3wQ0xGcCr3BmWQ= X-MC-Unique: _CVo-K8IOoWvnLTYUF_FuA-1 X-Mimecast-MFC-AGG-ID: _CVo-K8IOoWvnLTYUF_FuA_1757491427 To: devel@lists.libvirt.org Subject: [PATCH 1/4] ch: Actually remove device in chDomainDetachDeviceLive() Date: Wed, 10 Sep 2025 10:03:38 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 1zRmYzfZzCBAd4AbkaPecpLYiseOsLTBFn0A9pfOG8k_1757491427 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: I2VGRMMWTEG3LI76ZJPB7M4OGKGRPF37 X-Message-ID-Hash: I2VGRMMWTEG3LI76ZJPB7M4OGKGRPF37 X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1757491540265154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Inside of chDomainDetachDeviceLive() there are two variables that are important in this case: 'match' and 'detach'. The first one contains device definition as parsed from user provided XML, the other contains pointer to the device definition inside virDomainDef (as returned by chDomainFindDisk()). Now, when chDomainRemoveDevice() is called, it looks up the device inside virDomainDef and removes it (using pointer comparison). Well, that means 'detach' must be passed as an argument instead of 'match'. Signed-off-by: Michal Privoznik --- src/ch/ch_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch/ch_hotplug.c b/src/ch/ch_hotplug.c index 058954035d..b06fdbe5a8 100644 --- a/src/ch/ch_hotplug.c +++ b/src/ch/ch_hotplug.c @@ -336,7 +336,7 @@ chDomainDetachDeviceLive(virDomainObj *vm, return -1; } =20 - if (chDomainRemoveDevice(vm, match) < 0) + if (chDomainRemoveDevice(vm, &detach) < 0) return -1; =20 if (match->type =3D=3D VIR_DOMAIN_DEVICE_DISK) { --=20 2.49.1