diff options
author | Ján Tomko <jtomko@redhat.com> | 2015-03-30 18:46:21 +0200 |
---|---|---|
committer | Ján Tomko <jtomko@redhat.com> | 2015-04-15 17:06:01 +0200 |
commit | 1882c0bd8d9ebedea527419df32098bdd24b4047 (patch) | |
tree | 51b7aec3586f5f496abc46b4c2884735084ac02f /daemon | |
parent | 96a21e975f4b9d2f66a6aee1a16188837c98f82c (diff) | |
download | libvirt-1882c0bd8d9ebedea527419df32098bdd24b4047.tar.gz |
Add VIR_DOMAIN_EVENT_ID_DEVICE_ADDED event
The counterpart to VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED.
https://bugzilla.redhat.com/show_bug.cgi?id=1206114
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/remote.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/daemon/remote.c b/daemon/remote.c index 2e1f973b94..3a3f1683e9 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -1045,6 +1045,42 @@ remoteRelayDomainEventAgentLifecycle(virConnectPtr conn, } +static int +remoteRelayDomainEventDeviceAdded(virConnectPtr conn, + virDomainPtr dom, + const char *devAlias, + void *opaque) +{ + daemonClientEventCallbackPtr callback = opaque; + remote_domain_event_callback_device_added_msg data; + + if (callback->callbackID < 0 || + !remoteRelayDomainEventCheckACL(callback->client, conn, dom)) + return -1; + + VIR_DEBUG("Relaying domain device added event %s %d %s, callback %d", + dom->name, dom->id, devAlias, callback->callbackID); + + /* build return data */ + memset(&data, 0, sizeof(data)); + + if (VIR_STRDUP(data.devAlias, devAlias) < 0) + return -1; + + make_nonnull_domain(&data.dom, dom); + data.callbackID = callback->callbackID, + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_ADDED, + (xdrproc_t)xdr_remote_domain_event_callback_device_added_msg, + &data); + + return 0; +} + + + + static virConnectDomainEventGenericCallback domainEventCallbacks[] = { VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle), VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventReboot), @@ -1065,6 +1101,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = { VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockJob2), VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventTunable), VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventAgentLifecycle), + VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventDeviceAdded), }; verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST); |