mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
remote: use a separate connection for nodedev APIs
Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
ca88bbc618
commit
3ebf8f5b80
@ -76,6 +76,7 @@ struct daemonClientPrivate {
|
|||||||
virConnectPtr conn;
|
virConnectPtr conn;
|
||||||
virConnectPtr interfaceConn;
|
virConnectPtr interfaceConn;
|
||||||
virConnectPtr networkConn;
|
virConnectPtr networkConn;
|
||||||
|
virConnectPtr nodedevConn;
|
||||||
|
|
||||||
daemonClientStreamPtr streams;
|
daemonClientStreamPtr streams;
|
||||||
};
|
};
|
||||||
|
@ -1710,7 +1710,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv)
|
|||||||
DEREG_CB(priv->conn, priv->storageEventCallbacks,
|
DEREG_CB(priv->conn, priv->storageEventCallbacks,
|
||||||
priv->nstorageEventCallbacks,
|
priv->nstorageEventCallbacks,
|
||||||
virConnectStoragePoolEventDeregisterAny, "storage");
|
virConnectStoragePoolEventDeregisterAny, "storage");
|
||||||
DEREG_CB(priv->conn, priv->nodeDeviceEventCallbacks,
|
DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks,
|
||||||
priv->nnodeDeviceEventCallbacks,
|
priv->nnodeDeviceEventCallbacks,
|
||||||
virConnectNodeDeviceEventDeregisterAny, "node device");
|
virConnectNodeDeviceEventDeregisterAny, "node device");
|
||||||
DEREG_CB(priv->conn, priv->secretEventCallbacks,
|
DEREG_CB(priv->conn, priv->secretEventCallbacks,
|
||||||
@ -1749,6 +1749,8 @@ void remoteClientFree(void *data)
|
|||||||
virConnectClose(priv->interfaceConn);
|
virConnectClose(priv->interfaceConn);
|
||||||
if (priv->networkConn)
|
if (priv->networkConn)
|
||||||
virConnectClose(priv->networkConn);
|
virConnectClose(priv->networkConn);
|
||||||
|
if (priv->nodedevConn)
|
||||||
|
virConnectClose(priv->nodedevConn);
|
||||||
|
|
||||||
VIR_FREE(priv);
|
VIR_FREE(priv);
|
||||||
}
|
}
|
||||||
@ -1823,6 +1825,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
priv->interfaceConn = virObjectRef(priv->conn);
|
priv->interfaceConn = virObjectRef(priv->conn);
|
||||||
priv->networkConn = virObjectRef(priv->conn);
|
priv->networkConn = virObjectRef(priv->conn);
|
||||||
|
priv->nodedevConn = virObjectRef(priv->conn);
|
||||||
|
|
||||||
/* force update the @readonly attribute which was inherited from the
|
/* force update the @readonly attribute which was inherited from the
|
||||||
* virNetServerService object - this is important for sockets that are RW
|
* virNetServerService object - this is important for sockets that are RW
|
||||||
@ -3782,12 +3785,12 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
struct daemonClientPrivate *priv =
|
struct daemonClientPrivate *priv =
|
||||||
virNetServerClientGetPrivateData(client);
|
virNetServerClientGetPrivateData(client);
|
||||||
|
|
||||||
if (!priv->conn) {
|
if (!priv->nodedevConn) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dev = virNodeDeviceLookupByName(priv->conn, args->name)))
|
if (!(dev = virNodeDeviceLookupByName(priv->nodedevConn, args->name)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
parent = virNodeDeviceGetParent(dev);
|
parent = virNodeDeviceGetParent(dev);
|
||||||
@ -5962,7 +5965,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATTRIBUTE
|
|||||||
virNetServerClientGetPrivateData(client);
|
virNetServerClientGetPrivateData(client);
|
||||||
virNodeDevicePtr dev = NULL;
|
virNodeDevicePtr dev = NULL;
|
||||||
|
|
||||||
if (!priv->conn) {
|
if (!priv->nodedevConn) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -5970,7 +5973,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATTRIBUTE
|
|||||||
virMutexLock(&priv->lock);
|
virMutexLock(&priv->lock);
|
||||||
|
|
||||||
if (args->dev &&
|
if (args->dev &&
|
||||||
!(dev = get_nonnull_node_device(priv->conn, *args->dev)))
|
!(dev = get_nonnull_node_device(priv->nodedevConn, *args->dev)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (args->eventID >= VIR_NODE_DEVICE_EVENT_ID_LAST || args->eventID < 0) {
|
if (args->eventID >= VIR_NODE_DEVICE_EVENT_ID_LAST || args->eventID < 0) {
|
||||||
@ -5996,7 +5999,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATTRIBUTE
|
|||||||
callback) < 0)
|
callback) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((callbackID = virConnectNodeDeviceEventRegisterAny(priv->conn,
|
if ((callbackID = virConnectNodeDeviceEventRegisterAny(priv->nodedevConn,
|
||||||
dev,
|
dev,
|
||||||
args->eventID,
|
args->eventID,
|
||||||
nodeDeviceEventCallbacks[args->eventID],
|
nodeDeviceEventCallbacks[args->eventID],
|
||||||
@ -6034,7 +6037,7 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(virNetServerPtr server ATTRIBU
|
|||||||
struct daemonClientPrivate *priv =
|
struct daemonClientPrivate *priv =
|
||||||
virNetServerClientGetPrivateData(client);
|
virNetServerClientGetPrivateData(client);
|
||||||
|
|
||||||
if (!priv->conn) {
|
if (!priv->nodedevConn) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -6052,7 +6055,7 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(virNetServerPtr server ATTRIBU
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virConnectNodeDeviceEventDeregisterAny(priv->conn, args->callbackID) < 0)
|
if (virConnectNodeDeviceEventDeregisterAny(priv->nodedevConn, args->callbackID) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
VIR_DELETE_ELEMENT(priv->nodeDeviceEventCallbacks, i,
|
VIR_DELETE_ELEMENT(priv->nodeDeviceEventCallbacks, i,
|
||||||
|
@ -131,6 +131,9 @@ sub get_conn_arg {
|
|||||||
if ($type =~ /remote_nonnull_network/) {
|
if ($type =~ /remote_nonnull_network/) {
|
||||||
return "priv->networkConn";
|
return "priv->networkConn";
|
||||||
}
|
}
|
||||||
|
if ($type =~ /remote_nonnull_node_device/) {
|
||||||
|
return "priv->nodedevConn";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# This is for the few virConnect APIs that
|
# This is for the few virConnect APIs that
|
||||||
@ -142,6 +145,9 @@ sub get_conn_arg {
|
|||||||
if ($proc =~ /Connect.*Network/) {
|
if ($proc =~ /Connect.*Network/) {
|
||||||
return "priv->networkConn";
|
return "priv->networkConn";
|
||||||
}
|
}
|
||||||
|
if ($proc =~ /Node.*Device/) {
|
||||||
|
return "priv->nodedevConn";
|
||||||
|
}
|
||||||
|
|
||||||
return "priv->conn";
|
return "priv->conn";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user