From nobody Sun Jun 14 16:18:36 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; dkim=fail; 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=1781089192; cv=none; d=zohomail.com; s=zohoarc; b=m6LnKqG1Vu7wKWiTfVjV7hr+Hm4pTJDsjQwq9ekANd+f1FJ/HfDugmwsPJnwhg0psd1XeabAslAt+EhVEoKiQl9AsAFFb2sRJamfkLjmZJMirfs3x27mBbFFoF6AhomlKTA0G2idLuFWe1dICyWm6GX9LJ0QP4GCwL5NpWe9Tzs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781089192; 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=QYy55Ueg64Nam25FhL04l1NSsTlMPD3XOgHYewyaiOs=; b=FHXM34K80kX/5TI3MHT3zo+o0v184Bz7TtZV7cJQrnLw3SrZQOY5WGgOySWJ5BrG7WmlZ5EIEA6ZE7nuxMTYdMqZxJ1O/F/YOd3a5y4iwvewjZAv8MXXYCtgosg7h8z6KDzXLFJGCgGTDpsP1KNmIjEp0mUBna7PslinoPh2DeY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1781089192180575.4042151068743; Wed, 10 Jun 2026 03:59:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A854A41DBD; Wed, 10 Jun 2026 06:58:37 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id D872B41D3A; Wed, 10 Jun 2026 06:56:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 45FED41B7C; Wed, 10 Jun 2026 06:55:45 -0400 (EDT) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 CD9C941B70 for ; Wed, 10 Jun 2026 06:55:28 -0400 (EDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65A6Pdb53559529 for ; Wed, 10 Jun 2026 10:55:24 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4embkjec50-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jun 2026 10:55:23 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 65AAh4sb020464 for ; Wed, 10 Jun 2026 10:55:23 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4eq69u8k5c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jun 2026 10:55:23 +0000 (GMT) Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 65AAtLJ6018639 for ; Wed, 10 Jun 2026 10:55:22 GMT Received: from akulhall-vm1-ol9.osdevelopmeniad.oraclevcn.com (akulhall-vm1-ol9.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.255.191]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4eq69u8k45-2; Wed, 10 Jun 2026 10:55:22 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=QYy55 Ueg64Nam25FhL04l1NSsTlMPD3XOgHYewyaiOs=; b=pcrGgKfFBFUqy77ubD+a+ 2LPwTwPtzEpyo9E0Bpe/tQQKXPX9ziGO14AvUDzn/MxvxyzfvUS7Y3eaWprrZLzH zWHh20KSPfTLJTsMaGsLKoqszv5lMqWMsfsSUfUKiIOCwQkMolEGlDQUtBS2ZRKM RUUbX+kRHmAULaupmG2UmdF/SYdMRwDLATgAnQH6lgCJBoCv7RGxe35xq13poXiT 2QUEtte6a/+M1TS2JGtW7YYkovvpSwRrtD/OR9KDFr3vk3oa/5JfOuZmojlBS8S+ qkg/UWoPwj3aeKapWdoPYOqIJnlU4Te/8NtPef46R6QkUtwzaxjw75joGbsEiu4R Q== To: devel@lists.libvirt.org Subject: [PATCH v2 1/5] qemu: expose process event handler to tests Date: Wed, 10 Jun 2026 16:24:10 +0530 Message-ID: <20260610105454.3886530-3-akash.kulhalli@oracle.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260610105454.3886530-2-akash.kulhalli@oracle.com> References: <20260610105454.3886530-2-akash.kulhalli@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-10_02,2026-06-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2605130000 definitions=main-2606100102 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjEwMDEwNCBTYWx0ZWRfX1ECm2QmxSWuj 30ozmUHB3B1z3WBQK02kTn06+uZ1uYUJxft+7XN6jyz0pYMRuRQfgSfFbQnFGdZfgGGKJxNmJaT dJkXpvj0GLyBoYgpwHPASZ+LPrOrYhN0Yhv+t8B8bhbhsui+Xi1PK2+yCL4gMYfSmjpiLmwYE0N u8bQa1Q/1vD5Q5r/rMTNVen0k/YOmS/5Pdx1Pz3TWhP9Bk77AVS6YedABj9LMr++SuNuMd22u/l B/Py19a+AytL2JhaUhA6hKLP9huGsrlgYzJP9rlyW0df+vqfyWIBSw08kByhHFURKZSsWsr8/E/ 63fKQEwy524J3GT9YL4Q2LBy9SiPvbh1YwF7WKPe76ANi2hohxly8kwpBFsuUqpW1PhnsnBdTw/ 3KkKWUu/+nFxrGTsAneSO8kWSic4i4QMBHhbWRgRjhLPw8Tz9DySRNSaxBL8/X00xYET7y3nly/ Joe96xBqUohy7CPOhUA== X-Authority-Analysis: v=2.4 cv=ROSD2Yi+ c=1 sm=1 tr=0 ts=6a29429c b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=BqU2WV_vvsyTyxaotp0D:22 a=mDV3o1hIAAAA:8 a=yPCof4ZbAAAA:8 a=HTlyMO5rB3nywkCtlK0A:9 X-Proofpoint-GUID: JE8fNSqWX99T3yJvF1R5ybPA6IGN7Wsn X-Proofpoint-ORIG-GUID: JE8fNSqWX99T3yJvF1R5ybPA6IGN7Wsn Message-ID-Hash: WPP7MCAN3TYJKV5KAAMK5CWDDU4WE7RO X-Message-ID-Hash: WPP7MCAN3TYJKV5KAAMK5CWDDU4WE7RO X-MailFrom: akash.kulhalli@oracle.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 CC: akash.kulhalli@oracle.com 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: Akash Kulhalli via Devel Reply-To: Akash Kulhalli X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781089196421158500 Content-Type: text/plain; charset="utf-8" From: Akash Kulhalli Async QEMU process events are normally completed through qemuProcessEventHandler(). Tests that exercise DEVICE_DELETED completion need to drive that same path instead of mirroring the production logic loca= lly. Move the declaration to a guarded private header and make the handler non-static so test code can wire it into a test worker pool. This does not change runtime behaviour. Signed-off-by: Akash Kulhalli --- src/qemu/qemu_driver.c | 9 +++++---- src/qemu/qemu_driverpriv.h | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 src/qemu/qemu_driverpriv.h diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 544955ecf907..de760ce7f02c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -31,6 +31,8 @@ #include =20 #include "qemu_driver.h" +#define LIBVIRT_QEMU_DRIVERPRIV_H_ALLOW +#include "qemu_driverpriv.h" #include "qemu_agent.h" #include "qemu_alias.h" #include "qemu_block.h" @@ -140,9 +142,6 @@ VIR_ENUM_IMPL(qemuDumpFormat, "win-dmp", ); =20 - -static void qemuProcessEventHandler(void *data, void *opaque); - static int qemuStateCleanup(void); =20 static int qemuDomainObjStart(virConnectPtr conn, @@ -4171,7 +4170,9 @@ processShutdownCompletedEvent(virDomainObj *vm) } =20 =20 -static void qemuProcessEventHandler(void *data, void *opaque) +void +qemuProcessEventHandler(void *data, + void *opaque) { struct qemuProcessEvent *processEvent =3D data; virDomainObj *vm =3D processEvent->vm; diff --git a/src/qemu/qemu_driverpriv.h b/src/qemu/qemu_driverpriv.h new file mode 100644 index 000000000000..4fb0cc22b026 --- /dev/null +++ b/src/qemu/qemu_driverpriv.h @@ -0,0 +1,27 @@ +/* + * qemu_driverpriv.h: private declarations for QEMU driver internals + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#ifndef LIBVIRT_QEMU_DRIVERPRIV_H_ALLOW +# error "qemu_driverpriv.h may only be included by qemu_driver.c or test s= uites" +#endif /* LIBVIRT_QEMU_DRIVERPRIV_H_ALLOW */ + +#pragma once + +void +qemuProcessEventHandler(void *data, + void *opaque); --=20 2.47.3 From nobody Sun Jun 14 16:18:36 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; dkim=fail; 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=1781089079; cv=none; d=zohomail.com; s=zohoarc; b=T+0NjNm4fR15tHzqJHU213/H2kEx6Ke2wVIPH0DJJW2pM7zjQDuds6hLSnABAfHv9fyIvt9Lw6tJNtwFYdRpvLw+ckmD4EZNbubvtJVkPYfrSC2Z50PVQK/y8XL5eQvHSe24Yn7HhZVPFCrORv7f3iAfY78f20+PrCj1GA7ED68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781089079; 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=l8wqrR9RH5lZHRzCGqonHhsDBpM1t2wZznwXOrzzhts=; b=P/+8Pbo8KQQJxQykFyWae8sO1tJ2MeGi3nlvwuFd1CiBhTgmfMIdO3p9xQ89K/MB5BmYXVPiAZPSSW86bE2z2+OLj/rYmTEV4WmEEhk3ioZjzCz7eVO/tNDtQpzRkmjA8azE8R8ePXh75kL0YX+OmCb5NW5AQYSV9fzqdRAtV14= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1781089079124247.90419899469907; Wed, 10 Jun 2026 03:57:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id F169B41C96; Wed, 10 Jun 2026 06:56:58 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id DA96641CC9; Wed, 10 Jun 2026 06:56:04 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B3E7541B7C; Wed, 10 Jun 2026 06:55:44 -0400 (EDT) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 CBD744198B for ; Wed, 10 Jun 2026 06:55:35 -0400 (EDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65A6MnAn812651 for ; Wed, 10 Jun 2026 10:55:25 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4em9ybeabn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jun 2026 10:55:24 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 65AAh5NX020482 for ; Wed, 10 Jun 2026 10:55:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4eq69u8k65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jun 2026 10:55:23 +0000 (GMT) Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 65AAtLJ8018639 for ; Wed, 10 Jun 2026 10:55:23 GMT Received: from akulhall-vm1-ol9.osdevelopmeniad.oraclevcn.com (akulhall-vm1-ol9.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.255.191]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4eq69u8k45-3; Wed, 10 Jun 2026 10:55:23 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=l8wqr R9RH5lZHRzCGqonHhsDBpM1t2wZznwXOrzzhts=; b=Jjo+GLgkjfnRBrJ0TMU5D J9Otntfbp739a1trWE4TuRAyuv9abqSDadiUFXGWmIN9i5B3ltBE2t0mvydmUaFx o3NJnFc5JpPWlbQSLhqPvO+eGC33rMTH6K03QNU9X8upM6YW8x7ULAxKHncaS5HF VfT9m5oBYSUU1ioGNdZHJRnsWfON3EeaddCk2P0DdsQuNM2+84mRbsO6CKJHrBgw 0+OI0qetu5RvWbobjCylb57npmBgyaZttGjvXkSsGBDcGpzzwApWmmY5+4gbFMTA igMZw45mNS6dbBFH7sTa1wwN8Ftb3+xbc2J4O96R087W9t/fcm01DhVB/Hk+zCYG Q== To: devel@lists.libvirt.org Subject: [PATCH v2 2/5] tests: add helper for DEVICE_DELETED events Date: Wed, 10 Jun 2026 16:24:11 +0530 Message-ID: <20260610105454.3886530-4-akash.kulhalli@oracle.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260610105454.3886530-2-akash.kulhalli@oracle.com> References: <20260610105454.3886530-2-akash.kulhalli@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-10_02,2026-06-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2605130000 definitions=main-2606100102 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjEwMDEwNCBTYWx0ZWRfX8V0f0VRsYdEZ Lnu3YEh8t1sVrhtTECLlfOylD9Hd9PxLAkWPeqX+AIRj1sn/ox7lfSbtExMNS06HPFyZYndD6Jv Wu/WdeXr7HtHLfGa1CfLk5bXsM9v8Y3EetIXAiujAroEYH9ZjKq9b9rLj4EFJaER/HI4ap6apxH d+AmDffTS1tIGZkbi5hlJeV7tmvmLM+p2tJJqufsp+rEA0TXT/rqn+SVXjz6oKoPwx93eKrFupl 1hdd9gm6cycwXs16EP9C1LXOr+1QN6zzCqepEQje5uO8yj1ijuCHtd9iU/hWWSOwXbNU4OPH5fG iE14OUkPv/CquU1fAm1nfl3Ib9Jku0B1K2Cii/eZ7DZPsDdqVIApYPxfg0SRLFYgaDUtFO2RqGP FH9RhT33TD0te6r4o5gLgpa1fUcY1MgJ3TKh+aexy9W1aj/ftGK9JzogVfPB/IWal+Y6rEaCTsG Yd2i4hClHIT4rteLnzQ== X-Authority-Analysis: v=2.4 cv=IYK3n2qa c=1 sm=1 tr=0 ts=6a29429c b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=x4eqshVgHu-cdnggieHk:22 a=yPCof4ZbAAAA:8 a=tjU_jw4RVW5mis4LcWkA:9 X-Proofpoint-GUID: HeA1bRzu4-aDvqKUWrQEfvt3viaBol1I X-Proofpoint-ORIG-GUID: HeA1bRzu4-aDvqKUWrQEfvt3viaBol1I Message-ID-Hash: BFRJFJLRO2O3IDADAVPZKEN777IYI4XD X-Message-ID-Hash: BFRJFJLRO2O3IDADAVPZKEN777IYI4XD X-MailFrom: akash.kulhalli@oracle.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 CC: akash.kulhalli@oracle.com 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: Akash Kulhalli via Devel Reply-To: Akash Kulhalli X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781089089057154100 Content-Type: text/plain; charset="utf-8" From: Akash Kulhalli Add qemuMonitorTestEmitDeviceDeleted() so monitor tests can emit a DEVICE_DELETED event after the command reply has already been consumed. The helper uses the monitor callback path directly and avoids adding event JSON to command/reply fixtures. Signed-off-by: Akash Kulhalli --- tests/qemumonitortestutils.c | 9 +++++++++ tests/qemumonitortestutils.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index b6e17fc2cac4..e83dd1d9c40b 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1240,3 +1240,12 @@ qemuMonitorTestGetDomainObj(qemuMonitorTest *test) { return test->vm; } + +void +qemuMonitorTestEmitDeviceDeleted(qemuMonitorTest *test, + const char *alias) +{ + virObjectLock(test->mon); + qemuMonitorEmitDeviceDeleted(test->mon, alias); + virObjectUnlock(test->mon); +} diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index 4f136410ee61..c87cdf0e6a32 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -109,5 +109,8 @@ qemuAgent * qemuMonitorTestGetAgent(qemuMonitorTest *test); virDomainObj * qemuMonitorTestGetDomainObj(qemuMonitorTest *test); +void +qemuMonitorTestEmitDeviceDeleted(qemuMonitorTest *test, + const char *alias); =20 G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuMonitorTest, qemuMonitorTestFree); --=20 2.47.3 From nobody Sun Jun 14 16:18:36 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; dkim=fail; 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=1781089593; cv=none; d=zohomail.com; s=zohoarc; b=BBmmVaWYLh6QKiiWlShJaINp1xq8I5arbMjvpiLzgcRupdJonzW8W6sI71IYczERGdtRutvkqbTT/sQUc5MDpmqw3K4rDbTyAbQbRJL/bj/WCndrj0eZwikGOGt38kJLL2NzspUPTVYNDHlHSw0c3Y9ofXbVMDiJ65xnXXe4bQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781089593; 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=ohz6GbPbmxLDGLsy0knhsTfvYeJCBCj8IEEFO68H9W0=; b=KFwlK3b+LOox2FG8/psvIO1igrsRU9jeb/E00XhPuHCcWQVbyoIe9XdyGXBZG8aOZu8cjiDuv1bKAXMMrMriSKeCrBAdoI+tuOFYUYg7WuJ4EGnixgLebGY7eaTEHDwLtvz8QWCzui72pIYo2KT0rOeVIOi9z4R11QGmULcdPWU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1781089593779201.64816898235767; Wed, 10 Jun 2026 04:06:33 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 1A43B41C25; Wed, 10 Jun 2026 07:06:02 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 7FD2041CAC; Wed, 10 Jun 2026 06:57:28 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id ECC5841B73; Wed, 10 Jun 2026 06:55:59 -0400 (EDT) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 123CD41B73 for ; Wed, 10 Jun 2026 06:55:33 -0400 (EDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65A6PUX43559127 for ; Wed, 10 Jun 2026 10:55:26 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4embkjec55-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jun 2026 10:55:25 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 65AAh4r9020435 for ; Wed, 10 Jun 2026 10:55:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4eq69u8k77-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jun 2026 10:55:24 +0000 (GMT) Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 65AAtLJA018639 for ; Wed, 10 Jun 2026 10:55:24 GMT Received: from akulhall-vm1-ol9.osdevelopmeniad.oraclevcn.com (akulhall-vm1-ol9.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.255.191]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4eq69u8k45-4; Wed, 10 Jun 2026 10:55:24 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=ohz6G bPbmxLDGLsy0knhsTfvYeJCBCj8IEEFO68H9W0=; b=OEm3aO345tpU5eTRJjGa7 VPruBLQ88dAwAFVAkJg0u9rujRtIVF6PQovJQ+uCYj8YjYxTYtfW1ljGuS94PmMG TWh6D4Jw53IcrlDb6ByOvucVmHAysZk5pKkW2OJCWiLykxNYgr5IhSirO+aoy36t GMz0idYDaOuxHklCvSZSj58HMk+up8WBVZVag72dm49z6jlBIZhU302Vp3HZnsXq zXGIn6u0VkNcdgzEaDgKD6qD24dgZ4t+BMVm/5Wvya0MeP58hEPcFEMVQsC7pF+6 LJE/BM35iO5uZTg7wgdIyD/WIQNlD7fz+PoOwDR0FYfOlrR4ZDWXUUX4q7/c5I/B g== To: devel@lists.libvirt.org Subject: [PATCH v2 3/5] qemuhotplugtest: support async vcpu unplug completion Date: Wed, 10 Jun 2026 16:24:12 +0530 Message-ID: <20260610105454.3886530-5-akash.kulhalli@oracle.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260610105454.3886530-2-akash.kulhalli@oracle.com> References: <20260610105454.3886530-2-akash.kulhalli@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-10_02,2026-06-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2605130000 definitions=main-2606100102 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjEwMDEwNCBTYWx0ZWRfXxzkU9sqU8BQZ CAAOt7N9ejW9lSu9lWm+7DLtNh+1mg3ioV0PED7cPmLVLlHRPD9sGx1zl8jDAteWF6e9i8DmdU2 5McWgcmFTapTXpqDC2AXyIjw5YdnqidE122wAfZXOzI7Wsq7Zv1hruVpNSSJlAmV5Dl45MKIWlZ YPAh8E7yFFw4VGp6N3gRjqYnhxaeHWVHpuwwfZ/Ald5eCzbI++/fX+wcbv41Zi/tGp1fVk0JMZx tic88yT6ujaaR3RHwQl0eWcxzsw3Q2T5JSfgY7RtswglwjS2bvwfQgdhve9m8zuICIiymvVTbfy /tV1dBn0xjKnhIG+CcmSTWJhC/7XxI8cn+3jXrxCjov7+4/cLp9O88Lt6hC7GH7EdsJhG/fvMfc asHqn06nhN3orkWA7VsMmzzZQvjUStIxPJzXKNsHADIxam29CjDKkArvFdqn4udP61EIkh7vN2M Hd2Dy1IBijICxnqB4jw== X-Authority-Analysis: v=2.4 cv=ROSD2Yi+ c=1 sm=1 tr=0 ts=6a29429d b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=BqU2WV_vvsyTyxaotp0D:22 a=yPCof4ZbAAAA:8 a=PxoBaiUbynIOylaeyzEA:9 X-Proofpoint-GUID: FXPBiOzFctXqhQaD78ky5t_lKPN2EmWo X-Proofpoint-ORIG-GUID: FXPBiOzFctXqhQaD78ky5t_lKPN2EmWo Message-ID-Hash: YXP4M4I4J5IZER34S7BHWCEEKHC64DFV X-Message-ID-Hash: YXP4M4I4J5IZER34S7BHWCEEKHC64DFV X-MailFrom: akash.kulhalli@oracle.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 CC: akash.kulhalli@oracle.com 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: Akash Kulhalli via Devel Reply-To: Akash Kulhalli X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781089597727154100 Content-Type: text/plain; charset="utf-8" From: Akash Kulhalli Add async CPU hotplug harness support so tests can observe the state between device_del and DEVICE_DELETED, and then complete the unplug through the QEMU driver's normal process-event path. The async path compares the pending live XML, emits DEVICE_DELETED events via the monitor test helper, waits for the driver worker to process them, and validates the vcpu-removed events before running the existing final XML checks. Signed-off-by: Akash Kulhalli --- tests/qemuhotplugtest.c | 350 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 350 insertions(+) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 7e49b9ad3661..0ea2789aec51 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -19,8 +19,11 @@ =20 #include =20 +#include "domain_event.h" #include "qemu/qemu_alias.h" #include "qemu/qemu_conf.h" +#define LIBVIRT_QEMU_DRIVERPRIV_H_ALLOW +#include "qemu/qemu_driverpriv.h" #include "qemu/qemu_hotplug.h" #include "qemumonitortestutils.h" #include "testutils.h" @@ -28,6 +31,9 @@ #include "testutilsqemuschema.h" #include "virhostdev.h" #include "virfile.h" +#include "virthread.h" +#include "virthreadpool.h" +#include "virtime.h" #include "qemufakedrivers.h" =20 #define LIBVIRT_QEMU_CAPSPRIV_H_ALLOW @@ -44,6 +50,7 @@ enum { }; =20 #define QEMU_HOTPLUG_TEST_DOMAIN_ID 7 +#define QEMU_HOTPLUG_TEST_DOMAIN_PID 12345 =20 struct qemuHotplugTestData { const char *domain_filename; @@ -325,6 +332,146 @@ struct testQemuHotplugCpuParams { }; =20 =20 +struct testQemuHotplugCpuAsyncParams { + const char *test; + int newcpus; + const char *cpumap; + virConnectPtr conn; + const char **deviceDeletedAliases; + size_t ndeviceDeletedAliases; + const char *removedVcpus; + const char *arch; + GHashTable *capsLatestFiles; + GHashTable *capsCache; + GHashTable *schemaCache; +}; + + +struct testQemuHotplugCpuAsyncData { + int eventCallbackID; + virMutex lock; + virCond cond; + bool lockInitialized; + bool condInitialized; + virBitmap *removedVcpusExpected; + virBitmap *removedVcpusActual; + bool removedVcpusInvalid; + bool removedVcpusDuplicate; + bool ownsWorkerPool; +}; + + +static int +testQemuHotplugCpuAsyncDataInit(struct testQemuHotplugCpuAsyncData *asyncD= ata, + const char *test) +{ + asyncData->eventCallbackID =3D -1; + + if (driver.workerPool) { + VIR_TEST_VERBOSE("stale qemu worker pool in async cpu test '%s'", + test); + return -1; + } + + if (virMutexInit(&asyncData->lock) < 0) + return -1; + asyncData->lockInitialized =3D true; + + if (virCondInit(&asyncData->cond) < 0) + return -1; + asyncData->condInitialized =3D true; + + if (!(driver.workerPool =3D virThreadPoolNewFull(0, 1, 0, + qemuProcessEventHandler, + "qemuProcessEventHandle= r", + NULL, &driver))) + return -1; + + asyncData->ownsWorkerPool =3D true; + + return 0; +} + + +static void +testQemuHotplugCpuAsyncDataClear(struct testQemuHotplugCpuAsyncData *async= Data, + virConnectPtr conn) +{ + if (asyncData->eventCallbackID >=3D 0) + virObjectEventStateDeregisterID(conn, driver.domainEventState, + asyncData->eventCallbackID, true); + + if (asyncData->ownsWorkerPool) + g_clear_pointer(&driver.workerPool, virThreadPoolFree); + + if (asyncData->condInitialized) + virCondDestroy(&asyncData->cond); + if (asyncData->lockInitialized) + virMutexDestroy(&asyncData->lock); + + g_clear_pointer(&asyncData->removedVcpusExpected, virBitmapFree); + g_clear_pointer(&asyncData->removedVcpusActual, virBitmapFree); +} + + +static int +testQemuHotplugCpuWaitVcpuRemoved(struct testQemuHotplugCpuAsyncData *asyn= cData) +{ + g_autofree char *expected =3D NULL; + g_autofree char *actual =3D NULL; + unsigned long long now; + unsigned long long deadline; + size_t expectedCount =3D virBitmapCountBits(asyncData->removedVcpusExp= ected); + size_t actualCount; + int ret =3D -1; + + if (virTimeMillisNow(&now) < 0) + return -1; + deadline =3D now + 1000; + + virMutexLock(&asyncData->lock); + while (virBitmapCountBits(asyncData->removedVcpusActual) < expectedCou= nt) { + if (virCondWaitUntil(&asyncData->cond, &asyncData->lock, deadline)= < 0) + break; + } + + actualCount =3D virBitmapCountBits(asyncData->removedVcpusActual); + + if (asyncData->removedVcpusInvalid) { + VIR_TEST_VERBOSE("async cpu test reported an unexpected vCPU id"); + goto cleanup; + } + + if (asyncData->removedVcpusDuplicate) { + VIR_TEST_VERBOSE("async cpu test received duplicate vcpu-removed e= vents"); + goto cleanup; + } + + if (actualCount < expectedCount) { + VIR_TEST_VERBOSE("timed out waiting for vcpu-removed events" + " (%zu/%zu received)", + actualCount, expectedCount); + goto cleanup; + } + + if (!virBitmapEqual(asyncData->removedVcpusExpected, + asyncData->removedVcpusActual)) { + expected =3D virBitmapFormat(asyncData->removedVcpusExpected); + actual =3D virBitmapFormat(asyncData->removedVcpusActual); + VIR_TEST_VERBOSE("expected removed vCPUs '%s', got '%s'", + NULLSTR(expected), NULLSTR(actual)); + goto cleanup; + } + + ret =3D 0; + + cleanup: + virMutexUnlock(&asyncData->lock); + + return ret; +} + + static struct testQemuHotplugCpuData * testQemuHotplugCpuPrepare(const struct testQemuHotplugCpuParams *params) { @@ -407,6 +554,124 @@ testQemuHotplugCpuFinalize(struct testQemuHotplugCpuD= ata *data) } =20 =20 +static void +testQemuHotplugCpuVcpuRemoved(virConnectPtr conn G_GNUC_UNUSED, + virDomainPtr dom G_GNUC_UNUSED, + unsigned int vcpuid, + void *opaque) +{ + struct testQemuHotplugCpuAsyncData *asyncData =3D opaque; + + virMutexLock(&asyncData->lock); + + if (virBitmapIsBitSet(asyncData->removedVcpusActual, vcpuid)) + asyncData->removedVcpusDuplicate =3D true; + + if (virBitmapSetBit(asyncData->removedVcpusActual, vcpuid) < 0) + asyncData->removedVcpusInvalid =3D true; + + virCondBroadcast(&asyncData->cond); + virMutexUnlock(&asyncData->lock); +} + + +static int +testQemuHotplugCpuRegisterVcpuRemoved(struct testQemuHotplugCpuData *data, + const struct testQemuHotplugCpuAsync= Params *async, + struct testQemuHotplugCpuAsyncData *= asyncData) +{ + g_autoptr(virBitmap) expected =3D NULL; + size_t maxvcpus =3D virDomainDefGetVcpusMax(data->vm->def); + + if (!async->removedVcpus) { + VIR_TEST_VERBOSE("async cpu test '%s' is missing expected removed = vCPUs", + async->test); + return -1; + } + + if (virBitmapParse(async->removedVcpus, &expected, maxvcpus) < 0) + return -1; + + if (!(asyncData->removedVcpusActual =3D virBitmapNew(maxvcpus))) + return -1; + + asyncData->removedVcpusExpected =3D g_steal_pointer(&expected); + + if (virDomainEventStateRegisterID(async->conn, + driver.domainEventState, + NULL, + VIR_DOMAIN_EVENT_ID_VCPU_REMOVED, + VIR_DOMAIN_EVENT_CALLBACK(testQemuHo= tplugCpuVcpuRemoved), + asyncData, + NULL, + &asyncData->eventCallbackID) < 0) + return -1; + + return 0; +} + + +static int +testQemuHotplugCpuCompleteAsync(struct testQemuHotplugCpuData *data, + const struct testQemuHotplugCpuAsyncParams= *async, + struct testQemuHotplugCpuAsyncData *asyncD= ata) +{ + g_autofree char *activeXML =3D NULL; + g_autofree char *pendingLiveFile =3D NULL; + size_t i; + bool vmUnlocked =3D false; + int ret =3D -1; + + if (!async->deviceDeletedAliases || + async->ndeviceDeletedAliases =3D=3D 0) { + VIR_TEST_VERBOSE("async cpu test '%s' is missing DEVICE_DELETED al= iases", + async->test); + return -1; + } + + if (!(activeXML =3D virDomainDefFormat(data->vm->def, driver.xmlopt, + VIR_DOMAIN_DEF_FORMAT_SECURE))) + return -1; + + pendingLiveFile =3D g_strdup_printf("%s/qemuhotplugtestcpus/%s-result-= pending-live.xml", + abs_srcdir, async->test); + + if (virTestCompareToFile(activeXML, pendingLiveFile) < 0) + return -1; + + if (testQemuHotplugCpuRegisterVcpuRemoved(data, async, asyncData) < 0) + return -1; + + /* qemuDomainRefreshVcpuInfo() validates vCPU TIDs against the emulator + * PID. A running QEMU process always has a non-zero PID, so mirror th= at + * before DEVICE_DELETED processing reports unplugged vCPUs with tid = =3D=3D 0. */ + data->vm->pid =3D QEMU_HOTPLUG_TEST_DOMAIN_PID; + + virObjectUnlock(data->vm); + vmUnlocked =3D true; + + for (i =3D 0; i < async->ndeviceDeletedAliases; i++) + qemuMonitorTestEmitDeviceDeleted(data->mon, + async->deviceDeletedAliases[i]); + + if (testQemuHotplugCpuWaitVcpuRemoved(asyncData) < 0) + goto cleanup; + + virThreadPoolDrain(driver.workerPool); + + virObjectLock(data->vm); + vmUnlocked =3D false; + + ret =3D 0; + + cleanup: + if (vmUnlocked) + virObjectLock(data->vm); + + return ret; +} + + static int testQemuHotplugCpuGroup(const void *opaque) { @@ -442,6 +707,71 @@ testQemuHotplugCpuGroup(const void *opaque) } =20 =20 +static int +testQemuHotplugCpuAsync(const struct testQemuHotplugCpuAsyncParams *async, + bool group) +{ + struct testQemuHotplugCpuData *data =3D NULL; + struct testQemuHotplugCpuAsyncData asyncData =3D { .eventCallbackID = =3D -1 }; + struct testQemuHotplugCpuParams params =3D { + .test =3D async->test, + .arch =3D async->arch, + .capsLatestFiles =3D async->capsLatestFiles, + .capsCache =3D async->capsCache, + .schemaCache =3D async->schemaCache, + }; + g_autoptr(virBitmap) map =3D NULL; + int ret =3D -1; + int rc; + + if (!(data =3D testQemuHotplugCpuPrepare(¶ms))) + return -1; + + if (testQemuHotplugCpuAsyncDataInit(&asyncData, async->test) < 0) + goto cleanup; + + if (group) { + rc =3D qemuDomainSetVcpusInternal(&driver, data->vm, data->vm->def, + data->vm->newDef, async->newcpus, + true, true); + } else { + if (virBitmapParse(async->cpumap, &map, 128) < 0) + goto cleanup; + + rc =3D qemuDomainSetVcpuInternal(&driver, data->vm, data->vm->def, + data->vm->newDef, map, false, + true); + } + + if (rc < 0) + goto cleanup; + + if (testQemuHotplugCpuCompleteAsync(data, async, &asyncData) < 0) + goto cleanup; + + ret =3D testQemuHotplugCpuFinalize(data); + + cleanup: + testQemuHotplugCpuAsyncDataClear(&asyncData, async->conn); + testQemuHotplugCpuDataFree(data); + return ret; +} + + +static int G_GNUC_UNUSED +testQemuHotplugCpuGroupAsync(const void *opaque) +{ + return testQemuHotplugCpuAsync(opaque, true); +} + + +static int G_GNUC_UNUSED +testQemuHotplugCpuIndividualAsync(const void *opaque) +{ + return testQemuHotplugCpuAsync(opaque, false); +} + + static int testQemuHotplugCpuIndividual(const void *opaque) { @@ -818,6 +1148,26 @@ mymain(void) ret =3D -1; \ } while (0) =20 +#define DO_TEST_CPU_INDIVIDUAL_ASYNC(archname, prefix, mapstr, alias, remo= ved) \ + do { \ + const char *aliases[] =3D { alias }; \ + const struct testQemuHotplugCpuAsyncParams async =3D { \ + .test =3D prefix, \ + .cpumap =3D mapstr, \ + .conn =3D conn, \ + .deviceDeletedAliases =3D aliases, \ + .ndeviceDeletedAliases =3D G_N_ELEMENTS(aliases), \ + .removedVcpus =3D removed, \ + .arch =3D archname, \ + .capsLatestFiles =3D capsLatestFiles, \ + .capsCache =3D capsCache, \ + .schemaCache =3D schemaCache, \ + }; \ + if (virTestRun("hotplug vcpus individual async " prefix, \ + testQemuHotplugCpuIndividualAsync, &async) < 0) \ + ret =3D -1; \ + } while (0) + DO_TEST_CPU_INDIVIDUAL("x86_64", "x86-modern-individual-add", "7", tru= e, false); DO_TEST_CPU_INDIVIDUAL("x86_64", "x86-modern-individual-add", "6,7", t= rue, true); DO_TEST_CPU_INDIVIDUAL("x86_64", "x86-modern-individual-add", "7", fal= se, true); --=20 2.47.3 From nobody Sun Jun 14 16:18:36 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; dkim=fail; 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=1781089441; cv=none; d=zohomail.com; s=zohoarc; b=i7rfscFmrxI5EApB+At76pymnNTGHHzWNWRNteakjZATfjgxzzcIGUD6+2v9dLpGme9dqd0/7A+bT4ogc0Fo7bJSsGfC4BncxAXb48gnylKaSYTBJuZ3bL2Q8yFDMKEdNDKnlGeWpZzG+heIMVXevzTzvTfbdJI48ga+UQym54w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781089441; 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=0cl/xyu6qB0m7wxn7hYnzbL735aNW2+YoiD+9nLy624=; b=TPi6GloOWcvDwdlou/YTH50McVBnhAwqctVg1GLTRiPs3g9VIybWBX7A1Qz2ee8U4CvVg6XljpypSx0S351uV6zFWXa4guUN5OYYniec4hTYoqtdGhgop0PGbeKQdfWmXoh3LA0RzMr9gYUli4cPzsP+ahd8T7dt+SMhSbhrxrA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1781089441630976.3576734691412; Wed, 10 Jun 2026 04:04:01 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9BF4D417D7; Wed, 10 Jun 2026 07:03:29 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 7952041DF0; Wed, 10 Jun 2026 06:56:56 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 60A4A41ABC; Wed, 10 Jun 2026 06:55:54 -0400 (EDT) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 1631E41B77 for ; Wed, 10 Jun 2026 06:55:33 -0400 (EDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65A6MlfM1108383 for ; Wed, 10 Jun 2026 10:55:27 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4emb5sxakr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jun 2026 10:55:26 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 65AAh4rA020435 for ; Wed, 10 Jun 2026 10:55:26 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4eq69u8k7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jun 2026 10:55:25 +0000 (GMT) Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 65AAtLJC018639 for ; Wed, 10 Jun 2026 10:55:25 GMT Received: from akulhall-vm1-ol9.osdevelopmeniad.oraclevcn.com (akulhall-vm1-ol9.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.255.191]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4eq69u8k45-5; Wed, 10 Jun 2026 10:55:24 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=0cl/x yu6qB0m7wxn7hYnzbL735aNW2+YoiD+9nLy624=; b=aIDXTF1rnQtuPN59H56cM KN91XJ5+50Dd+CbrkPvNDECy/6/pDE6m0UjfK3aggN9C4LJ11tXvImNXrTVQJI1r 07P1TYdwFmMHXix1jxS37kfTo2PcdTDGdext7byYmVzIQA1AJQ1pS7CpzZZi/VeG bmG6LZy5GVShi6qBpBP/WX+jOFOmymYC4jd6LFJrDZrjgqHYRDjcGvav4xPF2Eox LhbE1SdbRuFtEDecoMjsrbyi5fq5X5TVDS9AjmwL0B8W33JTqsShv1imc9jfpx4A 7I4ay5zeEqnzoLfMck/fgWarN7Tff3/lZM0r0LIed1Okzq9rCxJkvvRuDGgtKz4O g== To: devel@lists.libvirt.org Subject: [PATCH v2 4/5] qemuhotplugtest: test setvcpu async unplug Date: Wed, 10 Jun 2026 16:24:13 +0530 Message-ID: <20260610105454.3886530-6-akash.kulhalli@oracle.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260610105454.3886530-2-akash.kulhalli@oracle.com> References: <20260610105454.3886530-2-akash.kulhalli@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-10_02,2026-06-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2605130000 definitions=main-2606100102 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjEwMDEwNCBTYWx0ZWRfX+NPVu9mRQ4aO A3H5/fWVjzrF6j9ezBQkn4zQm3N6u8bQP40COkBZ+jLXt93jwt/E6GZMhwtmWoplGCTe0v5Ijz9 aLLynXoBPBA+5MJ9UUyWbnJ4ANFCYBpXlErzlKWyQGhOhFZn2i7+q84e7Cbp19P6weZVang/Zjc uB/FaUpQVnXPQ0uocuydvq8o3du8M0DNvVNaltKfqKq8DzMvCwr2UKHIgJRUCJyAVueTo2b7dB5 UHgDSFH/Nj2YPh5pv6dyWxtQep+qoZSJdgcJC5qm4a24+iQy85rcCbPiqv6U3J8n4kPrpav6T0p GAGkPycYaNhTLFDhtfPwbTqvv4AcRK8u3mAwKykXO4pCdGRX+FHwY0bh+3y5Vz+lUodD/x4Hems ZofEG34EZ3eGZAh0rn/McinEH9RrPk7PjGtDfjCDkKGloLUSWAHMr13IIN+j90e4UguEU8ybcDR 8Oq0f6qhCEsMmKan+2w== X-Authority-Analysis: v=2.4 cv=XeC5Co55 c=1 sm=1 tr=0 ts=6a29429f b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=3I1J8UUJPc9JN9BFgKH3:22 a=yPCof4ZbAAAA:8 a=poIMxrWE-6J9Kj8ljIgA:9 a=twhJ2ZlS-ekJXLOV:21 X-Proofpoint-ORIG-GUID: roV7z_eFAPJS863KVgAbpRXpGU3Cow9T X-Proofpoint-GUID: roV7z_eFAPJS863KVgAbpRXpGU3Cow9T Message-ID-Hash: QUUH6Z5VBSEU523HALJ2EG4XFFFNC26Q X-Message-ID-Hash: QUUH6Z5VBSEU523HALJ2EG4XFFFNC26Q X-MailFrom: akash.kulhalli@oracle.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 CC: akash.kulhalli@oracle.com 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: Akash Kulhalli via Devel Reply-To: Akash Kulhalli X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781089447001154100 Content-Type: text/plain; charset="utf-8" From: Akash Kulhalli Add async unplug coverage for the setvcpu path. The x86 case covers removal of a single hotpluggable vCPU entity, while the ppc64 case covers removal of a grouped hotpluggable entity. Both cases veri= fy the pending XML before DEVICE_DELETED, the final XML after completion, and = the expected vcpu-removed events. Signed-off-by: Akash Kulhalli --- tests/qemuhotplugtest.c | 6 +- ...c64-modern-individual-del-async-domain.xml | 68 ++++++ ...4-modern-individual-del-async-monitor.json | 227 ++++++++++++++++++ ...odern-individual-del-async-result-conf.xml | 68 ++++++ ...odern-individual-del-async-result-live.xml | 71 ++++++ ...dividual-del-async-result-pending-live.xml | 71 ++++++ ...x86-modern-individual-del-async-domain.xml | 42 ++++ ...6-modern-individual-del-async-monitor.json | 186 ++++++++++++++ ...odern-individual-del-async-result-conf.xml | 42 ++++ ...odern-individual-del-async-result-live.xml | 50 ++++ ...dividual-del-async-result-pending-live.xml | 50 ++++ 11 files changed, 880 insertions(+), 1 deletion(-) create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-del-a= sync-domain.xml create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-del-a= sync-monitor.json create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-del-a= sync-result-conf.xml create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-del-a= sync-result-live.xml create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-del-a= sync-result-pending-live.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-del-asy= nc-domain.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-del-asy= nc-monitor.json create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-del-asy= nc-result-conf.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-del-asy= nc-result-live.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-del-asy= nc-result-pending-live.xml diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 0ea2789aec51..d6924202e637 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -765,7 +765,7 @@ testQemuHotplugCpuGroupAsync(const void *opaque) } =20 =20 -static int G_GNUC_UNUSED +static int testQemuHotplugCpuIndividualAsync(const void *opaque) { return testQemuHotplugCpuAsync(opaque, false); @@ -1171,10 +1171,14 @@ mymain(void) DO_TEST_CPU_INDIVIDUAL("x86_64", "x86-modern-individual-add", "7", tru= e, false); DO_TEST_CPU_INDIVIDUAL("x86_64", "x86-modern-individual-add", "6,7", t= rue, true); DO_TEST_CPU_INDIVIDUAL("x86_64", "x86-modern-individual-add", "7", fal= se, true); + DO_TEST_CPU_INDIVIDUAL_ASYNC("x86_64", "x86-modern-individual-del-asyn= c", + "7", "vcpu7", "7"); =20 DO_TEST_CPU_INDIVIDUAL("ppc64", "ppc64-modern-individual", "16-23", tr= ue, false); DO_TEST_CPU_INDIVIDUAL("ppc64", "ppc64-modern-individual", "16-22", tr= ue, true); DO_TEST_CPU_INDIVIDUAL("ppc64", "ppc64-modern-individual", "17", true,= true); + DO_TEST_CPU_INDIVIDUAL_ASYNC("ppc64", "ppc64-modern-individual-del-asy= nc", + "16-23", "vcpu16", "16-23"); =20 qemuTestDriverFree(&driver); virObjectUnref(data.vm); diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-del-async-do= main.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-del-async-doma= in.xml new file mode 100644 index 000000000000..29f1a5ac45dc --- /dev/null +++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-del-async-domain.xml @@ -0,0 +1,68 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hvm + + + + POWER9 + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + +
+ + + + + +