mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
remote: use a separate connection for storage APIs
Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
3a33a83602
commit
78038351c7
@ -79,6 +79,7 @@ struct daemonClientPrivate {
|
||||
virConnectPtr nodedevConn;
|
||||
virConnectPtr nwfilterConn;
|
||||
virConnectPtr secretConn;
|
||||
virConnectPtr storageConn;
|
||||
|
||||
daemonClientStreamPtr streams;
|
||||
};
|
||||
|
@ -1707,7 +1707,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv)
|
||||
DEREG_CB(priv->networkConn, priv->networkEventCallbacks,
|
||||
priv->nnetworkEventCallbacks,
|
||||
virConnectNetworkEventDeregisterAny, "network");
|
||||
DEREG_CB(priv->conn, priv->storageEventCallbacks,
|
||||
DEREG_CB(priv->storageConn, priv->storageEventCallbacks,
|
||||
priv->nstorageEventCallbacks,
|
||||
virConnectStoragePoolEventDeregisterAny, "storage");
|
||||
DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks,
|
||||
@ -1755,6 +1755,8 @@ void remoteClientFree(void *data)
|
||||
virConnectClose(priv->nwfilterConn);
|
||||
if (priv->secretConn)
|
||||
virConnectClose(priv->secretConn);
|
||||
if (priv->storageConn)
|
||||
virConnectClose(priv->storageConn);
|
||||
|
||||
VIR_FREE(priv);
|
||||
}
|
||||
@ -1832,6 +1834,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
priv->nodedevConn = virObjectRef(priv->conn);
|
||||
priv->nwfilterConn = virObjectRef(priv->conn);
|
||||
priv->secretConn = virObjectRef(priv->conn);
|
||||
priv->storageConn = virObjectRef(priv->conn);
|
||||
|
||||
/* force update the @readonly attribute which was inherited from the
|
||||
* virNetServerService object - this is important for sockets that are RW
|
||||
@ -5850,7 +5853,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT
|
||||
virNetServerClientGetPrivateData(client);
|
||||
virStoragePoolPtr pool = NULL;
|
||||
|
||||
if (!priv->conn) {
|
||||
if (!priv->storageConn) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -5858,7 +5861,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT
|
||||
virMutexLock(&priv->lock);
|
||||
|
||||
if (args->pool &&
|
||||
!(pool = get_nonnull_storage_pool(priv->conn, *args->pool)))
|
||||
!(pool = get_nonnull_storage_pool(priv->storageConn, *args->pool)))
|
||||
goto cleanup;
|
||||
|
||||
if (args->eventID >= VIR_STORAGE_POOL_EVENT_ID_LAST || args->eventID < 0) {
|
||||
@ -5884,7 +5887,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT
|
||||
callback) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if ((callbackID = virConnectStoragePoolEventRegisterAny(priv->conn,
|
||||
if ((callbackID = virConnectStoragePoolEventRegisterAny(priv->storageConn,
|
||||
pool,
|
||||
args->eventID,
|
||||
storageEventCallbacks[args->eventID],
|
||||
@ -5922,7 +5925,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(virNetServerPtr server ATTRIB
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
|
||||
if (!priv->conn) {
|
||||
if (!priv->storageConn) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -5940,7 +5943,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(virNetServerPtr server ATTRIB
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virConnectStoragePoolEventDeregisterAny(priv->conn, args->callbackID) < 0)
|
||||
if (virConnectStoragePoolEventDeregisterAny(priv->storageConn, args->callbackID) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DELETE_ELEMENT(priv->storageEventCallbacks, i,
|
||||
@ -6914,12 +6917,12 @@ remoteDispatchStorageVolGetInfoFlags(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
|
||||
if (!priv->conn) {
|
||||
if (!priv->storageConn) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(vol = get_nonnull_storage_vol(priv->conn, args->vol)))
|
||||
if (!(vol = get_nonnull_storage_vol(priv->storageConn, args->vol)))
|
||||
goto cleanup;
|
||||
|
||||
if (virStorageVolGetInfoFlags(vol, &tmp, args->flags) < 0)
|
||||
|
@ -140,6 +140,9 @@ sub get_conn_arg {
|
||||
if ($type =~ /remote_nonnull_secret/) {
|
||||
return "priv->secretConn";
|
||||
}
|
||||
if ($type =~ /remote_nonnull_storage/) {
|
||||
return "priv->storageConn";
|
||||
}
|
||||
}
|
||||
|
||||
# This is for the few virConnect APIs that
|
||||
@ -160,6 +163,9 @@ sub get_conn_arg {
|
||||
if ($proc =~ /Connect.*Secret/) {
|
||||
return "priv->secretConn";
|
||||
}
|
||||
if ($proc =~ /Connect.*Storage/) {
|
||||
return "priv->storageConn";
|
||||
}
|
||||
|
||||
return "priv->conn";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user