Reviewed-by: John Ferlan <jferlan(a)redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
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 2b757d9cd6..2834da04a9 100644
--- a/src/remote/remote_daemon.h
+++ b/src/remote/remote_daemon.h
@@ -79,6 +79,7 @@ struct daemonClientPrivate {
virConnectPtr nodedevConn;
virConnectPtr nwfilterConn;
virConnectPtr secretConn;
+ virConnectPtr storageConn;
daemonClientStreamPtr streams;
};
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 8f1b537db9..5b764bab48 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -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)
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 0c575cd055..b8b83b6b40 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -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";
}
--
2.14.3