From nobody Tue Feb 10 07:42:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=riseup.net ARC-Seal: i=1; a=rsa-sha256; t=1687787778; cv=none; d=zohomail.com; s=zohoarc; b=ly8CLcIjsVWElOSTPkZhJ1eJV0+UYziGf/PoeAoj9g/kQvbnWwRAyvDZmOkqMB1fvcb3qQygplEKWEcpZBVtFpmg9jC/dpzEUBio6IQXRlb9Hsi8iFneFJn1Nmt/u5GmEyOzk+17bJrEh79LAeMvV5XhwqjLNQ/ba4BSgYfE1rM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687787778; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=K6ZP2+FLhdWe6Sk6Mwr1ieehhN/Km6oMdwPSnX0Cmr0=; b=XTmqR2O0DHcgzqVTLgqZPy+hsx7e0shFdmK86APOuHG/AL5Ys9qm5/j+uHqaMK09ElZC7jdcsGI7o8H85qOzUobsc9YMgrkZm8mzLPCZrjnINI8tq5GdBtkqDajhWdHYzenZQ/Hll8EvwtcHwPuEYvces8lfEuzrT3Fa+iK8Z24= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1687787778003800.8102705160991; Mon, 26 Jun 2023 06:56:18 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-509-FS62j61JOO6CoOoNJwk3ng-1; Mon, 26 Jun 2023 09:56:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9898A3810D5F; Mon, 26 Jun 2023 13:56:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40383207B2C3; Mon, 26 Jun 2023 13:56:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C2FE61946A6B; Mon, 26 Jun 2023 13:56:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 24ECC1946A68 for ; Mon, 26 Jun 2023 13:56:01 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id CA0332014F94; Mon, 26 Jun 2023 13:56:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C27EC200C0CD for ; Mon, 26 Jun 2023 13:56:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A79851C09A44 for ; Mon, 26 Jun 2023 13:56:01 +0000 (UTC) Received: from mx0.riseup.net (mx0.riseup.net [198.252.153.6]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-xe2Z-82nN-KHbaf0uL7cCg-1; Mon, 26 Jun 2023 09:55:59 -0400 Received: from fews02-sea.riseup.net (fews02-sea-pn.riseup.net [10.0.1.112]) (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 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx0.riseup.net (Postfix) with ESMTPS id 4QqTrt41Qbz9tKH for ; Mon, 26 Jun 2023 13:55:58 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4QqTrs2PZfzFpcn; Mon, 26 Jun 2023 13:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687787776; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=K6ZP2+FLhdWe6Sk6Mwr1ieehhN/Km6oMdwPSnX0Cmr0=; b=ZytLq8gBtS+yVVMQCMDLKD9E4ObpYtCDeKFCpF+7mM2tcSbslzVSCTArk0qTTt+8gnj6C3 t96Z3VBPexb2deduTc+jXJwVlFHjnaxC7PivVBp6D8k0Y4VrXasxY798bB4a59EayiFtP2 VgZKGq3ImStDgtvI2HVtmyo0h+w1PHs= X-MC-Unique: FS62j61JOO6CoOoNJwk3ng-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: xe2Z-82nN-KHbaf0uL7cCg-1 X-Riseup-User-ID: 08287BD34C2256F4A8091ACB474BA4C32ECA5620ABA8671931130C6095AC1F6F From: K Shiva To: libvir-list@redhat.com Subject: [libvirt PATCH v3 5/8] Methods to relay metadata change callbacks Date: Mon, 26 Jun 2023 19:25:20 +0530 Message-ID: <20230626135523.18404-6-shiva_kr@riseup.net> In-Reply-To: <20230626135523.18404-1-shiva_kr@riseup.net> References: <20230626135523.18404-1-shiva_kr@riseup.net> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: K Shiva Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: riseup.net Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687787778919100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Added: - Methods for relaying metadata change callbacks. - Enums representing the same. Signed-off-by: K Shiva --- src/remote/remote_daemon_dispatch.c | 39 +++++++++++++++++++++++++++++ src/remote/remote_driver.c | 32 +++++++++++++++++++++++ src/remote/remote_protocol.x | 15 ++++++++++- src/remote_protocol-structs | 6 +++++ 4 files changed, 91 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 7144e9e7ca..3e5eaec9e6 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1420,8 +1420,47 @@ remoteRelayNetworkEventLifecycle(virConnectPtr conn, return 0; } =20 +static int +remoteRelayNetworkEventMetadataChange(virConnectPtr conn, + virNetworkPtr net, + int type, + const char *nsuri, + void *opaque) +{ + daemonClientEventCallback *callback =3D opaque; + remote_network_event_callback_metadata_change_msg data; + + if (callback->callbackID < 0 || + !remoteRelayNetworkEventCheckACL(callback->client, conn, net)) + return -1; + + VIR_DEBUG("Relaying network metadata change %s %d %s, callback %d", + net->name, type, NULLSTR(nsuri), callback->callbackID); + + /* build return data */ + memset(&data, 0, sizeof(data)); + + data.type =3D type; + if (nsuri) { + data.nsuri =3D g_new0(remote_nonnull_string, 1); + *(data.nsuri) =3D g_strdup(nsuri); + } + + make_nonnull_network(&data.net, net); + data.callbackID =3D callback->callbackID; + + remoteDispatchObjectEventSend(callback->client, callback->program, + REMOTE_PROC_NETWORK_EVENT_CALLBACK_METAD= ATA_CHANGE, + (xdrproc_t)xdr_remote_network_event_call= back_metadata_change_msg, + &data); + + return 0; +} + + static virConnectNetworkEventGenericCallback networkEventCallbacks[] =3D { VIR_NETWORK_EVENT_CALLBACK(remoteRelayNetworkEventLifecycle), + VIR_NETWORK_EVENT_CALLBACK(remoteRelayNetworkEventMetadataChange), }; =20 G_STATIC_ASSERT(G_N_ELEMENTS(networkEventCallbacks) =3D=3D VIR_NETWORK_EVE= NT_ID_LAST); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 65ec239fb7..310f53fe5e 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -378,6 +378,12 @@ remoteNetworkBuildEventLifecycle(virNetClientProgram *= prog G_GNUC_UNUSED, virNetClient *client G_GNUC_UNUSED, void *evdata, void *opaque); =20 +static void +remoteNetworkBuildEventCallbackMetadataChange(virNetClientProgram *prog, + virNetClient *client, + void *evdata, void *opaque); + + static void remoteStoragePoolBuildEventLifecycle(virNetClientProgram *prog G_GNUC_UNUS= ED, virNetClient *client G_GNUC_UNUSED, @@ -505,6 +511,10 @@ static virNetClientProgramEvent remoteEvents[] =3D { remoteNetworkBuildEventLifecycle, sizeof(remote_network_event_lifecycle_msg), (xdrproc_t)xdr_remote_network_event_lifecycle_msg }, + { REMOTE_PROC_NETWORK_EVENT_CALLBACK_METADATA_CHANGE, + remoteNetworkBuildEventCallbackMetadataChange, + sizeof(remote_network_event_callback_metadata_change_msg), + (xdrproc_t)xdr_remote_network_event_callback_metadata_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE, remoteDomainBuildEventCallbackLifecycle, sizeof(remote_domain_event_callback_lifecycle_msg), @@ -4951,6 +4961,28 @@ remoteNetworkBuildEventLifecycle(virNetClientProgram= *prog G_GNUC_UNUSED, virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackI= D); } =20 +static void +remoteNetworkBuildEventCallbackMetadataChange(virNetClientProgram *prog G_= GNUC_UNUSED, + virNetClient *client G_GNUC_U= NUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn =3D opaque; + remote_network_event_callback_metadata_change_msg *msg =3D evdata; + struct private_data *priv =3D conn->privateData; + virNetworkPtr net; + virObjectEvent *event =3D NULL; + + if (!(net =3D get_nonnull_network(conn, msg->net))) + return; + + event =3D virNetworkEventMetadataChangeNewFromNet(net, msg->type, msg-= >nsuri ? *msg->nsuri : NULL); + + virObjectUnref(net); + + virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackI= D); +} + + static void remoteStoragePoolBuildEventLifecycle(virNetClientProgram *prog G_GNUC_UNUS= ED, virNetClient *client G_GNUC_UNUSED, diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 5d86a51116..72aa69e580 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3323,6 +3323,13 @@ struct remote_network_event_lifecycle_msg { int detail; }; =20 +struct remote_network_event_callback_metadata_change_msg { + int callbackID; + remote_nonnull_network net; + int type; + remote_string nsuri; +}; + struct remote_connect_storage_pool_event_register_any_args { int eventID; remote_storage_pool pool; @@ -6974,5 +6981,11 @@ enum remote_procedure { * @generate: none * @acl: domain:write */ - REMOTE_PROC_DOMAIN_FD_ASSOCIATE =3D 443 + REMOTE_PROC_DOMAIN_FD_ASSOCIATE =3D 443, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_NETWORK_EVENT_CALLBACK_METADATA_CHANGE =3D 444 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 3c6c230a16..3f7256051e 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -2687,6 +2687,12 @@ struct remote_network_event_lifecycle_msg { int event; int detail; }; +struct remote_network_event_callback_metadata_change_msg { + int callbackID; + remote_nonnull_network net; + int type; + remote_string nsuri; +}; struct remote_connect_storage_pool_event_register_any_args { int eventID; remote_storage_pool pool; --=20 2.41.0