From nobody Mon Sep 16 19:17:43 2024 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; 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 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 169375361503211.084003325790832; Sun, 3 Sep 2023 08:06:55 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-249-Dy6AmZT2OZywJTZy7pTq-w-1; Sun, 03 Sep 2023 11:06:47 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 08B121817905; Sun, 3 Sep 2023 15:06:44 +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 E897A40ED77E; Sun, 3 Sep 2023 15:06:43 +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 CA5B91946588; Sun, 3 Sep 2023 15:06:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9C7E61946586 for ; Sun, 3 Sep 2023 15:06:42 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 900CF21EE561; Sun, 3 Sep 2023 15:06:42 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8867821EE560 for ; Sun, 3 Sep 2023 15:06:42 +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 680733806714 for ; Sun, 3 Sep 2023 15:06:42 +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-279-qgbh2IrmPkqY2wUaYrwZeA-1; Sun, 03 Sep 2023 11:06:40 -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) (No client certificate requested) by mx0.riseup.net (Postfix) with ESMTPS id 4Rdw8b5FzFz9tGn for ; Sun, 3 Sep 2023 15:06:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4Rdw8Z4RqlzFq1y; Sun, 3 Sep 2023 15:06:38 +0000 (UTC) X-MC-Unique: Dy6AmZT2OZywJTZy7pTq-w-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: qgbh2IrmPkqY2wUaYrwZeA-1 X-Riseup-User-ID: E4497EACC47778003A93620AC1C41E19BCAF0DCCAC3AD43B4FB03CC490C04125 From: K Shiva Kiran To: libvir-list@redhat.com Subject: [PATCH 4/8] Add methods to create Metadata change events Date: Sun, 3 Sep 2023 20:28:36 +0530 Message-ID: <20230903150541.200896-5-shiva_kr@riseup.net> In-Reply-To: <20230903150541.200896-1-shiva_kr@riseup.net> References: <20230903150541.200896-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.6 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 Kiran Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: riseup.net Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1693753615650100005 Content-Type: text/plain; charset="utf-8"; x-default="true" Adds two new private methods to create metadata change events: - virNetworkEventMetadataChangeNewFromNet() - virNetworkEventMetadataChangeNewFromObj() Signed-off-by: K Shiva Kiran --- src/conf/network_event.c | 48 ++++++++++++++++++++++++++++++++++++++++ src/conf/network_event.h | 11 +++++++++ src/libvirt_private.syms | 2 ++ 3 files changed, 61 insertions(+) diff --git a/src/conf/network_event.c b/src/conf/network_event.c index d1b3aa5721..5eb9c3d48f 100644 --- a/src/conf/network_event.c +++ b/src/conf/network_event.c @@ -267,3 +267,51 @@ virNetworkEventMetadataChangeDispose(void *obj) =20 g_free(event->nsuri); } + + +static virObjectEvent * +virNetworkEventMetadataChangeNew(const char *name, + unsigned char *uuid, + int type, + const char *nsuri) +{ + virNetworkEventMetadataChange *event; + char uuidstr[VIR_UUID_STRING_BUFLEN]; + + if (virNetworkEventsInitialize() < 0) + return NULL; + + virUUIDFormat(uuid, uuidstr); + if (!(event =3D virObjectEventNew(virNetworkEventMetadataChangeClass, + virNetworkEventDispatchDefaultFunc, + VIR_NETWORK_EVENT_ID_METADATA_CHANGE, + 0, name, uuid, uuidstr))) + return NULL; + + event->type =3D type; + if (nsuri) + event->nsuri =3D g_strdup(nsuri); + + return (virObjectEvent *)event; +} + + +virObjectEvent * +virNetworkEventMetadataChangeNewFromObj(virNetworkObj *obj, + int type, + const char *nsuri) +{ + virNetworkDef *def =3D virNetworkObjGetDef(obj); + return virNetworkEventMetadataChangeNew(def->name, def->uuid, + type, nsuri); +} + + +virObjectEvent * +virNetworkEventMetadataChangeNewFromNet(virNetworkPtr net, + int type, + const char *nsuri) +{ + return virNetworkEventMetadataChangeNew(net->name, net->uuid, + type, nsuri); +} diff --git a/src/conf/network_event.h b/src/conf/network_event.h index 4502bfcaef..a91a238fed 100644 --- a/src/conf/network_event.h +++ b/src/conf/network_event.h @@ -23,6 +23,7 @@ =20 #include "internal.h" #include "object_event.h" +#include "virnetworkobj.h" =20 int virNetworkEventStateRegisterID(virConnectPtr conn, @@ -53,3 +54,13 @@ virNetworkEventLifecycleNew(const char *name, const unsigned char *uuid, int type, int detail); + +virObjectEvent * +virNetworkEventMetadataChangeNewFromObj(virNetworkObj *obj, + int type, + const char *nsuri); + +virObjectEvent * +virNetworkEventMetadataChangeNewFromNet(virNetworkPtr net, + int type, + const char *nsuri); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 1e3e407097..7a59828af0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -861,6 +861,8 @@ virPortGroupFindByName; =20 # conf/network_event.h virNetworkEventLifecycleNew; +virNetworkEventMetadataChangeNewFromNet; +virNetworkEventMetadataChangeNewFromObj; virNetworkEventStateRegisterID; =20 =20 --=20 2.42.0