On Tue, Dec 10, 2013 at 01:27:52PM +0000, Daniel P. Berrange wrote: > On Mon, Dec 02, 2013 at 05:39:49PM +0100, Cédric Bosdonnat wrote: > > --- > > daemon/libvirtd.h | 1 + > > daemon/remote.c | 140 +++++++++++++++++++++++++++++++++++++++++++ > > src/remote/remote_driver.c | 127 +++++++++++++++++++++++++++++++++++++++ > > src/remote/remote_protocol.x | 46 +++++++++++++- > > 4 files changed, 313 insertions(+), 1 deletion(-) > > > > @@ -5216,6 +5260,102 @@ cleanup: > > } > > > > > > +static int > > +remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server ATTRIBUTE_UNUSED, > > + virNetServerClientPtr client ATTRIBUTE_UNUSED, > > + virNetMessagePtr msg ATTRIBUTE_UNUSED, > > + virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED, > > + remote_connect_network_event_register_any_args *args, > > + remote_connect_network_event_register_any_ret *ret ATTRIBUTE_UNUSED) > > +{ > > + int callbackID; > > + int rv = -1; > > + struct daemonClientPrivate *priv = > > + virNetServerClientGetPrivateData(client); > > + > > + if (!priv->conn) { > > + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); > > + goto cleanup; > > + } > > + > > + virMutexLock(&priv->lock); > > + > > + if ((args->eventID & 0xFF) >= VIR_NETWORK_EVENT_ID_LAST || > > + ((args->eventID & 0xFF00) >> 8) != VIR_EVENT_NAMESPACE_NETWORK) { > > This is wrong - VIR_EVENT_NAMESPACE_NETWORK should not be visible in the wire > protocol. > > > + virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported event ID %d"), args->eventID); > > + goto cleanup; > > + } > > + > > + if (priv->networkEventCallbackID[args->eventID & 0xFF] != -1) { > > + virReportError(VIR_ERR_INTERNAL_ERROR, _("network event %d already registered"), args->eventID); > > + goto cleanup; > > + } > > + > > + if ((callbackID = virConnectNetworkEventRegisterAny(priv->conn, > > + NULL, > > + args->eventID, > > Just add VIR_EVENT_NAMESPACE_NETWORK in here. Opps, should not add it here either - this is calling public API so should have the raw eventID from the public header. > > diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c > > index 4a84a52..046f424 100644 > > --- a/src/remote/remote_driver.c > > +++ b/src/remote/remote_driver.c > > > @@ -2902,6 +2912,99 @@ done: > > } > > > > static int > > +remoteConnectNetworkEventRegisterAny(virConnectPtr conn, > > + virNetworkPtr net, > > + int eventID, > > + virConnectNetworkEventGenericCallback callback, > > + void *opaque, > > + virFreeCallback freecb) > > +{ > > + int rv = -1; > > + struct private_data *priv = conn->privateData; > > + remote_connect_network_event_register_any_args args; > > + int callbackID; > > + int count; > > + > > + remoteDriverLock(priv); > > + > > + if ((count = virNetworkEventStateRegisterID(conn, > > + priv->domainEventState, > > + net, eventID, > > Can add VIR_EVENT_NAMESPACE_NETWORK here Or actually just have virNetworkEventStateRegisterID do it instead of the callers Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list