On 08/11/2016 11:15 AM, Jovanka Gulicoska wrote:
Also includes node device update event implementation for udev
backend.
Hmm, because of the way nodedev-event and event-test.c are implemented, looks
like this throws some errors via the verify() and VIR_ENUM_IMPL sanity
checking. So looks like they all need to be updated at once
Node device Update API:
virConnectNodeDeviceEventUpdateCallback
Actually it doesn't add this, it just uses GenericCallback. So this reference
here should be dropped from the commit message.
---
daemon/remote.c | 29 ++++++++++++++++++++
include/libvirt/libvirt-nodedev.h | 1 +
src/conf/node_device_event.c | 55 ++++++++++++++++++++++++++++++++++++++
src/conf/node_device_event.h | 3 +++
src/libvirt_private.syms | 1 +
src/node_device/node_device_udev.c | 2 ++
src/remote/remote_driver.c | 30 +++++++++++++++++++++
src/remote/remote_protocol.x | 13 ++++++++-
src/remote_protocol-structs | 5 ++++
9 files changed, 138 insertions(+), 1 deletion(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 9e75472..155e9b0 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1388,8 +1388,37 @@ remoteRelayNodeDeviceEventLifecycle(virConnectPtr conn,
return 0;
}
+static int
+remoteRelayNodeDeviceEventUpdate(virConnectPtr conn,
+ virNodeDevicePtr dev,
+ void *opaque)
+{
+ daemonClientEventCallbackPtr callback = opaque;
+ remote_node_device_event_update_msg data;
+
+ if (callback->callbackID < 0 ||
+ !remoteRelayNodeDeviceEventCheckACL(callback->client, conn, dev))
+ return -1;
+
+ VIR_DEBUG("Relaying node device update event callback %d",
+ callback->callbackID);
+
+ /* build return data */
+ memset(&data, 0, sizeof(data));
+ make_nonnull_node_device(&data.dev, dev);
+ data.callbackID = callback->callbackID;
+
+ remoteDispatchObjectEventSend(callback->client, remoteProgram,
+ REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE,
+ (xdrproc_t)xdr_remote_node_device_event_update_msg,
+ &data);
+
+ return 0;
+}
+
static virConnectNodeDeviceEventGenericCallback nodeDeviceEventCallbacks[] = {
VIR_NODE_DEVICE_EVENT_CALLBACK(remoteRelayNodeDeviceEventLifecycle),
+ VIR_NODE_DEVICE_EVENT_CALLBACK(remoteRelayNodeDeviceEventUpdate),
};
verify(ARRAY_CARDINALITY(nodeDeviceEventCallbacks) == VIR_NODE_DEVICE_EVENT_ID_LAST);
diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h
index 4ab6917..4ff8b41 100644
--- a/include/libvirt/libvirt-nodedev.h
+++ b/include/libvirt/libvirt-nodedev.h
@@ -138,6 +138,7 @@ int virNodeDeviceDestroy (virNodeDevicePtr
dev);
*/
typedef enum {
VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE = 0, /*
virConnectNodeDeviceEventLifecycleCallback */
+ VIR_NODE_DEVICE_EVENT_ID_UPDATE = 1, /* virConnectNodeDeviceEventUpdateCallback */
This reference here in the comment should also be changed to GenericCallback
Otherwise the code looks good to me, so I made those adjustments, squashed
these patches together, tweaked the commit message a bit, and pushed.
Thanks,
Cole