From nobody Fri Dec 19 17:52:58 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=1744268384; cv=none; d=zohomail.com; s=zohoarc; b=Uzk3cNkj4DlxtCyb68mYpqfVM9+XQHG1JRi3uYLtq1zfz1bEP7ywr51TzD03ewhmg2HeR5KroXrNzi1CfaaN+/XT4WHC5zzeRFTtT94g/jALkmPQJlZPu8u/HfDP9w0utZuKOksV4XCdMAvIrz8OjCSvylRNp9SkZRJoTnym6lU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744268384; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=vKGCjEL9DAgwaktc7VgqRHum8pRIrZ5wMkec4IrsOz8=; b=iVOh3DGXvz62cELuhiuxKWlgLDWUbgntsSjI/SO1Qz80vX6KV8Enj54NAI4kZef4qtsecHdjcmKHmT8pQj4q48XSeWf7F49wqlQk+iMX++PBJ1T8AamdPzWgI3Cpg1vMtr2Pm+PGHaw0ta19Xx9h48sE52zBztPDv9IRFDRqXvc= 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 1744268384965672.6166130845281; Wed, 9 Apr 2025 23:59:44 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 01A141794; Thu, 10 Apr 2025 02:59:43 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EBFA617AC; Thu, 10 Apr 2025 02:58:42 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3E0271595; Thu, 10 Apr 2025 02:58:36 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C16BA1239 for ; Thu, 10 Apr 2025 02:58:35 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-259--IJ1LtquNYeL_DRw0eGa1Q-1; Thu, 10 Apr 2025 02:58:34 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4BA851954B36 for ; Thu, 10 Apr 2025 06:58:33 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.64.128]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AEFE6180175D; Thu, 10 Apr 2025 06:58:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744268315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rOw2sKGFRLYLMaKmsA0HtbNLyvwDXCEScgRS1fEtONA=; b=KM04L4eyy95UHoXAO3FdCpCF+DYyNU7tLOB6E27J+z6ARK5nyd8nd3ERj1q/T+wZuNvweQ rYBkc3pQcEHO8y3Npcdt1mICitsbASGoY3pPDwMLiLFbC5ifjWaHeI3GuOYF2gc69upVsw k63cnPgGYoDZ33xZ+s5junRLnZt5vc4= X-MC-Unique: -IJ1LtquNYeL_DRw0eGa1Q-1 X-Mimecast-MFC-AGG-ID: -IJ1LtquNYeL_DRw0eGa1Q_1744268313 To: devel@lists.libvirt.org Subject: [PATCH 2/5] qemu: make processNetDevStreamDisconnectedEvent() reusable Date: Thu, 10 Apr 2025 02:58:27 -0400 Message-ID: <20250410065830.380720-3-laine@redhat.com> In-Reply-To: <20250410065830.380720-1-laine@redhat.com> References: <20250410065830.380720-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Z768PmheI6qtwi6CCkLQ_nkYxn7pX7VabPhKC_czbsU_1744268313 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: W2MR7ZYGT2LESR4MKUV7HPKGPUXZSLMM X-Message-ID-Hash: W2MR7ZYGT2LESR4MKUV7HPKGPUXZSLMM X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Laurent Vivier , Stefano Brivio X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Laine Stump via Devel Reply-To: Laine Stump X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1744268387954019100 Content-Type: text/plain; charset="utf-8"; x-default="true" We will be adding a new event whose response will be *exactly* the same as the response to NETDEV_STREAM_DISCONNECTED. Rather than doing a copy-paste of the complete function that does the processing, turn that function into something more generic that takes the name of the event as an arg (the event name is only used in log messages). Signed-off-by: Laine Stump Reviewed-by: Jiri Denemark --- src/qemu/qemu_driver.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 411cf79317..f4b4d01d6c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3607,8 +3607,9 @@ processDeviceDeletedEvent(virQEMUDriver *driver, =20 =20 static void -processNetdevStreamDisconnectedEvent(virDomainObj *vm, - const char *netdevId) +processNetdevDisconnectedEvent(virDomainObj *vm, + const char *netdevId, + const char *eventName) { virDomainDeviceDef dev; virDomainNetDef *def; @@ -3623,13 +3624,13 @@ processNetdevStreamDisconnectedEvent(virDomainObj *= vm, */ =20 if (!devAlias) { - VIR_WARN("Received NETDEV_STREAM_DISCONNECTED event for unrecogniz= ed netdev %s from domain %p %s", - netdevId, vm, vm->def->name); + VIR_WARN("Received %s event for unrecognized netdev %s from domain= %p %s", + eventName, netdevId, vm, vm->def->name); return; } =20 - VIR_DEBUG("Received NETDEV_STREAM_DISCONNECTED event for device %s fro= m domain %p %s", - devAlias, vm, vm->def->name); + VIR_DEBUG("Received %s event for device %s from domain %p %s", + eventName, devAlias, vm, vm->def->name); =20 if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return; @@ -3640,28 +3641,28 @@ processNetdevStreamDisconnectedEvent(virDomainObj *= vm, } =20 if (virDomainDefFindDevice(vm->def, devAlias, &dev, true) < 0) { - VIR_WARN("NETDEV_STREAM_DISCONNECTED event received for non-existe= nt device %s in domain %s", - devAlias, vm->def->name); + VIR_WARN("%s event received for non-existent device %s in domain %= s", + eventName, devAlias, vm->def->name); goto endjob; } if (dev.type !=3D VIR_DOMAIN_DEVICE_NET) { - VIR_WARN("NETDEV_STREAM_DISCONNECTED event received for non-networ= k device %s in domain %s", - devAlias, vm->def->name); + VIR_WARN("%s event received for non-network device %s in domain %s= ", + eventName, devAlias, vm->def->name); goto endjob; } def =3D dev.data.net; =20 if (def->backend.type !=3D VIR_DOMAIN_NET_BACKEND_PASST) { - VIR_DEBUG("ignore NETDEV_STREAM_DISCONNECTED event for non-passt n= etwork device %s in domain %s", - def->info.alias, vm->def->name); + VIR_DEBUG("ignore %s event for non-passt network device %s in doma= in %s", + eventName, def->info.alias, vm->def->name); goto endjob; } =20 /* handle the event - restart the passt process with its original * parameters */ - VIR_DEBUG("process NETDEV_STREAM_DISCONNECTED event for network device= %s in domain %s", - def->info.alias, vm->def->name); + VIR_DEBUG("process %s event for network device %s in domain %s", + eventName, def->info.alias, vm->def->name); =20 if (qemuPasstStart(vm, def) < 0) goto endjob; @@ -3671,6 +3672,14 @@ processNetdevStreamDisconnectedEvent(virDomainObj *v= m, } =20 =20 +static void +processNetdevStreamDisconnectedEvent(virDomainObj *vm, + const char *netdevId) +{ + processNetdevDisconnectedEvent(vm, netdevId, "NETDEV_STREAM_DISCONNECT= ED"); +} + + static void processNicRxFilterChangedEvent(virQEMUDriver *driver, virDomainObj *vm, --=20 2.49.0