Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- src/remote/remote_daemon.h | 1 + src/remote/remote_daemon_dispatch.c | 19 +++++++++++-------- src/rpc/gendispatch.pl | 6 ++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h index 60be78fe0b..517eec1fc2 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -76,6 +76,7 @@ struct daemonClientPrivate { virConnectPtr conn; virConnectPtr interfaceConn; virConnectPtr networkConn; + virConnectPtr nodedevConn; daemonClientStreamPtr streams; }; diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c index bc26bccf65..668f67cca8 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1710,7 +1710,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv) DEREG_CB(priv->conn, priv->storageEventCallbacks, priv->nstorageEventCallbacks, virConnectStoragePoolEventDeregisterAny, "storage"); - DEREG_CB(priv->conn, priv->nodeDeviceEventCallbacks, + DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks, priv->nnodeDeviceEventCallbacks, virConnectNodeDeviceEventDeregisterAny, "node device"); DEREG_CB(priv->conn, priv->secretEventCallbacks, @@ -1749,6 +1749,8 @@ void remoteClientFree(void *data) virConnectClose(priv->interfaceConn); if (priv->networkConn) virConnectClose(priv->networkConn); + if (priv->nodedevConn) + virConnectClose(priv->nodedevConn); VIR_FREE(priv); } @@ -1823,6 +1825,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED, priv->interfaceConn = virObjectRef(priv->conn); priv->networkConn = virObjectRef(priv->conn); + priv->nodedevConn = virObjectRef(priv->conn); /* force update the @readonly attribute which was inherited from the * virNetServerService object - this is important for sockets that are RW @@ -3782,12 +3785,12 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr server ATTRIBUTE_UNUSED, struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - if (!priv->conn) { + if (!priv->nodedevConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } - if (!(dev = virNodeDeviceLookupByName(priv->conn, args->name))) + if (!(dev = virNodeDeviceLookupByName(priv->nodedevConn, args->name))) goto cleanup; parent = virNodeDeviceGetParent(dev); @@ -5962,7 +5965,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATTRIBUTE virNetServerClientGetPrivateData(client); virNodeDevicePtr dev = NULL; - if (!priv->conn) { + if (!priv->nodedevConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -5970,7 +5973,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATTRIBUTE virMutexLock(&priv->lock); if (args->dev && - !(dev = get_nonnull_node_device(priv->conn, *args->dev))) + !(dev = get_nonnull_node_device(priv->nodedevConn, *args->dev))) goto cleanup; if (args->eventID >= VIR_NODE_DEVICE_EVENT_ID_LAST || args->eventID < 0) { @@ -5996,7 +5999,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATTRIBUTE callback) < 0) goto cleanup; - if ((callbackID = virConnectNodeDeviceEventRegisterAny(priv->conn, + if ((callbackID = virConnectNodeDeviceEventRegisterAny(priv->nodedevConn, dev, args->eventID, nodeDeviceEventCallbacks[args->eventID], @@ -6034,7 +6037,7 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(virNetServerPtr server ATTRIBU struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - if (!priv->conn) { + if (!priv->nodedevConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -6052,7 +6055,7 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(virNetServerPtr server ATTRIBU goto cleanup; } - if (virConnectNodeDeviceEventDeregisterAny(priv->conn, args->callbackID) < 0) + if (virConnectNodeDeviceEventDeregisterAny(priv->nodedevConn, args->callbackID) < 0) goto cleanup; VIR_DELETE_ELEMENT(priv->nodeDeviceEventCallbacks, i, diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 51faa899c6..af29d88b99 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -131,6 +131,9 @@ sub get_conn_arg { if ($type =~ /remote_nonnull_network/) { return "priv->networkConn"; } + if ($type =~ /remote_nonnull_node_device/) { + return "priv->nodedevConn"; + } } # This is for the few virConnect APIs that @@ -142,6 +145,9 @@ sub get_conn_arg { if ($proc =~ /Connect.*Network/) { return "priv->networkConn"; } + if ($proc =~ /Node.*Device/) { + return "priv->nodedevConn"; + } return "priv->conn"; } -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list