提交 78038351 编写于 作者: D Daniel P. Berrangé

remote: use a separate connection for storage APIs

Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 3a33a836
...@@ -79,6 +79,7 @@ struct daemonClientPrivate { ...@@ -79,6 +79,7 @@ struct daemonClientPrivate {
virConnectPtr nodedevConn; virConnectPtr nodedevConn;
virConnectPtr nwfilterConn; virConnectPtr nwfilterConn;
virConnectPtr secretConn; virConnectPtr secretConn;
virConnectPtr storageConn;
daemonClientStreamPtr streams; daemonClientStreamPtr streams;
}; };
......
...@@ -1707,7 +1707,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv) ...@@ -1707,7 +1707,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv)
DEREG_CB(priv->networkConn, priv->networkEventCallbacks, DEREG_CB(priv->networkConn, priv->networkEventCallbacks,
priv->nnetworkEventCallbacks, priv->nnetworkEventCallbacks,
virConnectNetworkEventDeregisterAny, "network"); virConnectNetworkEventDeregisterAny, "network");
DEREG_CB(priv->conn, priv->storageEventCallbacks, DEREG_CB(priv->storageConn, priv->storageEventCallbacks,
priv->nstorageEventCallbacks, priv->nstorageEventCallbacks,
virConnectStoragePoolEventDeregisterAny, "storage"); virConnectStoragePoolEventDeregisterAny, "storage");
DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks, DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks,
...@@ -1755,6 +1755,8 @@ void remoteClientFree(void *data) ...@@ -1755,6 +1755,8 @@ void remoteClientFree(void *data)
virConnectClose(priv->nwfilterConn); virConnectClose(priv->nwfilterConn);
if (priv->secretConn) if (priv->secretConn)
virConnectClose(priv->secretConn); virConnectClose(priv->secretConn);
if (priv->storageConn)
virConnectClose(priv->storageConn);
VIR_FREE(priv); VIR_FREE(priv);
} }
...@@ -1832,6 +1834,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED, ...@@ -1832,6 +1834,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
priv->nodedevConn = virObjectRef(priv->conn); priv->nodedevConn = virObjectRef(priv->conn);
priv->nwfilterConn = virObjectRef(priv->conn); priv->nwfilterConn = virObjectRef(priv->conn);
priv->secretConn = virObjectRef(priv->conn); priv->secretConn = virObjectRef(priv->conn);
priv->storageConn = 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
...@@ -5850,7 +5853,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT ...@@ -5850,7 +5853,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT
virNetServerClientGetPrivateData(client); virNetServerClientGetPrivateData(client);
virStoragePoolPtr pool = NULL; virStoragePoolPtr pool = NULL;
if (!priv->conn) { if (!priv->storageConn) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup; goto cleanup;
} }
...@@ -5858,7 +5861,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT ...@@ -5858,7 +5861,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT
virMutexLock(&priv->lock); virMutexLock(&priv->lock);
if (args->pool && if (args->pool &&
!(pool = get_nonnull_storage_pool(priv->conn, *args->pool))) !(pool = get_nonnull_storage_pool(priv->storageConn, *args->pool)))
goto cleanup; goto cleanup;
if (args->eventID >= VIR_STORAGE_POOL_EVENT_ID_LAST || args->eventID < 0) { if (args->eventID >= VIR_STORAGE_POOL_EVENT_ID_LAST || args->eventID < 0) {
...@@ -5884,7 +5887,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT ...@@ -5884,7 +5887,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT
callback) < 0) callback) < 0)
goto cleanup; goto cleanup;
if ((callbackID = virConnectStoragePoolEventRegisterAny(priv->conn, if ((callbackID = virConnectStoragePoolEventRegisterAny(priv->storageConn,
pool, pool,
args->eventID, args->eventID,
storageEventCallbacks[args->eventID], storageEventCallbacks[args->eventID],
...@@ -5922,7 +5925,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(virNetServerPtr server ATTRIB ...@@ -5922,7 +5925,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(virNetServerPtr server ATTRIB
struct daemonClientPrivate *priv = struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client); virNetServerClientGetPrivateData(client);
if (!priv->conn) { if (!priv->storageConn) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup; goto cleanup;
} }
...@@ -5940,7 +5943,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(virNetServerPtr server ATTRIB ...@@ -5940,7 +5943,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(virNetServerPtr server ATTRIB
goto cleanup; goto cleanup;
} }
if (virConnectStoragePoolEventDeregisterAny(priv->conn, args->callbackID) < 0) if (virConnectStoragePoolEventDeregisterAny(priv->storageConn, args->callbackID) < 0)
goto cleanup; goto cleanup;
VIR_DELETE_ELEMENT(priv->storageEventCallbacks, i, VIR_DELETE_ELEMENT(priv->storageEventCallbacks, i,
...@@ -6914,12 +6917,12 @@ remoteDispatchStorageVolGetInfoFlags(virNetServerPtr server ATTRIBUTE_UNUSED, ...@@ -6914,12 +6917,12 @@ remoteDispatchStorageVolGetInfoFlags(virNetServerPtr server ATTRIBUTE_UNUSED,
struct daemonClientPrivate *priv = struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client); virNetServerClientGetPrivateData(client);
if (!priv->conn) { if (!priv->storageConn) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup; goto cleanup;
} }
if (!(vol = get_nonnull_storage_vol(priv->conn, args->vol))) if (!(vol = get_nonnull_storage_vol(priv->storageConn, args->vol)))
goto cleanup; goto cleanup;
if (virStorageVolGetInfoFlags(vol, &tmp, args->flags) < 0) if (virStorageVolGetInfoFlags(vol, &tmp, args->flags) < 0)
......
...@@ -140,6 +140,9 @@ sub get_conn_arg { ...@@ -140,6 +140,9 @@ sub get_conn_arg {
if ($type =~ /remote_nonnull_secret/) { if ($type =~ /remote_nonnull_secret/) {
return "priv->secretConn"; return "priv->secretConn";
} }
if ($type =~ /remote_nonnull_storage/) {
return "priv->storageConn";
}
} }
# This is for the few virConnect APIs that # This is for the few virConnect APIs that
...@@ -160,6 +163,9 @@ sub get_conn_arg { ...@@ -160,6 +163,9 @@ sub get_conn_arg {
if ($proc =~ /Connect.*Secret/) { if ($proc =~ /Connect.*Secret/) {
return "priv->secretConn"; return "priv->secretConn";
} }
if ($proc =~ /Connect.*Storage/) {
return "priv->storageConn";
}
return "priv->conn"; return "priv->conn";
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册