Re: [PATCH 2/3] Introduce NIC_MAC_CHANGE event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
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.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux