mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
remote: use a separate connection for secret APIs
Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
ad2b3fdd1c
commit
3a33a83602
@ -78,6 +78,7 @@ struct daemonClientPrivate {
|
||||
virConnectPtr networkConn;
|
||||
virConnectPtr nodedevConn;
|
||||
virConnectPtr nwfilterConn;
|
||||
virConnectPtr secretConn;
|
||||
|
||||
daemonClientStreamPtr streams;
|
||||
};
|
||||
|
@ -1713,7 +1713,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv)
|
||||
DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks,
|
||||
priv->nnodeDeviceEventCallbacks,
|
||||
virConnectNodeDeviceEventDeregisterAny, "node device");
|
||||
DEREG_CB(priv->conn, priv->secretEventCallbacks,
|
||||
DEREG_CB(priv->secretConn, priv->secretEventCallbacks,
|
||||
priv->nsecretEventCallbacks,
|
||||
virConnectSecretEventDeregisterAny, "secret");
|
||||
DEREG_CB(priv->conn, priv->qemuEventCallbacks,
|
||||
@ -1753,6 +1753,8 @@ void remoteClientFree(void *data)
|
||||
virConnectClose(priv->nodedevConn);
|
||||
if (priv->nwfilterConn)
|
||||
virConnectClose(priv->nwfilterConn);
|
||||
if (priv->secretConn)
|
||||
virConnectClose(priv->secretConn);
|
||||
|
||||
VIR_FREE(priv);
|
||||
}
|
||||
@ -1829,6 +1831,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
priv->networkConn = virObjectRef(priv->conn);
|
||||
priv->nodedevConn = virObjectRef(priv->conn);
|
||||
priv->nwfilterConn = virObjectRef(priv->conn);
|
||||
priv->secretConn = virObjectRef(priv->conn);
|
||||
|
||||
/* force update the @readonly attribute which was inherited from the
|
||||
* virNetServerService object - this is important for sockets that are RW
|
||||
@ -4050,12 +4053,12 @@ remoteDispatchSecretGetValue(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
|
||||
if (!priv->conn) {
|
||||
if (!priv->secretConn) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(secret = get_nonnull_secret(priv->conn, args->secret)))
|
||||
if (!(secret = get_nonnull_secret(priv->secretConn, args->secret)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(value = virSecretGetValue(secret, &value_size, args->flags)))
|
||||
@ -6089,7 +6092,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server ATTRIBUTE_UNU
|
||||
virNetServerClientGetPrivateData(client);
|
||||
virSecretPtr secret = NULL;
|
||||
|
||||
if (!priv->conn) {
|
||||
if (!priv->secretConn) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -6097,7 +6100,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server ATTRIBUTE_UNU
|
||||
virMutexLock(&priv->lock);
|
||||
|
||||
if (args->secret &&
|
||||
!(secret = get_nonnull_secret(priv->conn, *args->secret)))
|
||||
!(secret = get_nonnull_secret(priv->secretConn, *args->secret)))
|
||||
goto cleanup;
|
||||
|
||||
if (args->eventID >= VIR_SECRET_EVENT_ID_LAST || args->eventID < 0) {
|
||||
@ -6123,7 +6126,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server ATTRIBUTE_UNU
|
||||
callback) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if ((callbackID = virConnectSecretEventRegisterAny(priv->conn,
|
||||
if ((callbackID = virConnectSecretEventRegisterAny(priv->secretConn,
|
||||
secret,
|
||||
args->eventID,
|
||||
secretEventCallbacks[args->eventID],
|
||||
@ -6161,7 +6164,7 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetServerPtr server ATTRIBUTE_U
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
|
||||
if (!priv->conn) {
|
||||
if (!priv->secretConn) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -6179,7 +6182,7 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetServerPtr server ATTRIBUTE_U
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virConnectSecretEventDeregisterAny(priv->conn, args->callbackID) < 0)
|
||||
if (virConnectSecretEventDeregisterAny(priv->secretConn, args->callbackID) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DELETE_ELEMENT(priv->secretEventCallbacks, i,
|
||||
|
@ -137,6 +137,9 @@ sub get_conn_arg {
|
||||
if ($type =~ /remote_nonnull_nwfilter/) {
|
||||
return "priv->nwfilterConn";
|
||||
}
|
||||
if ($type =~ /remote_nonnull_secret/) {
|
||||
return "priv->secretConn";
|
||||
}
|
||||
}
|
||||
|
||||
# This is for the few virConnect APIs that
|
||||
@ -154,6 +157,9 @@ sub get_conn_arg {
|
||||
if ($proc =~ /Connect.*NWFilter/) {
|
||||
return "priv->nwfilterConn";
|
||||
}
|
||||
if ($proc =~ /Connect.*Secret/) {
|
||||
return "priv->secretConn";
|
||||
}
|
||||
|
||||
return "priv->conn";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user