[PATCH 2/3] Introduce NIC_MAC_CHANGE event

Martin Kletzander mkletzan at redhat.com
Wed Jul 26 14:47:42 UTC 2023


On Wed, Jun 28, 2023 at 12:53:36PM +0200, Michal Privoznik wrote:
>The aim off this event is to notify management application that
>guest changed MAC address on one of its vNICs so the app can
>update its internal records, e.g. for finding match between
>guest/host view of vNICs.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> examples/c/misc/event-test.c        | 14 +++++
> include/libvirt/libvirt-domain.h    | 28 +++++++++
> src/conf/domain_event.c             | 93 +++++++++++++++++++++++++++++
> src/conf/domain_event.h             | 12 ++++
> src/libvirt_private.syms            |  2 +
> src/remote/remote_daemon_dispatch.c | 32 ++++++++++
> src/remote/remote_driver.c          | 34 +++++++++++
> src/remote/remote_protocol.x        | 17 +++++-
> tools/virsh-domain-event.c          | 20 +++++++
> 9 files changed, 251 insertions(+), 1 deletion(-)
>

[...]

>diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
>index 7144e9e7ca..f347e7bcce 100644
>--- a/src/remote/remote_daemon_dispatch.c
>+++ b/src/remote/remote_daemon_dispatch.c
>@@ -1357,6 +1357,37 @@ remoteRelayDomainEventMemoryDeviceSizeChange(virConnectPtr conn,
> }
>
>
>+static int
>+remoteRelayDomainEventNICMACChange(virConnectPtr conn,
>+                                   virDomainPtr dom,
>+                                   const char *alias,
>+                                   const char *oldMAC,
>+                                   const char *newMAC,
>+                                   void *opaque)
>+{
>+    daemonClientEventCallback *callback = opaque;
>+    remote_domain_event_nic_mac_change_msg data;
>+
>+    if (callback->callbackID < 0 ||
>+        !remoteRelayDomainEventCheckACL(callback->client, conn, dom))
>+        return -1;
>+
>+    /* build return data */
>+    memset(&data, 0, sizeof(data));

Just a nit pick, but instead of this you should be able to do:

     remote_domain_event_nic_mac_change_msg data = {0};

above.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20230726/083a50a0/attachment.sig>


More information about the libvir-list mailing list