From nobody Wed May 14 11:36:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522250339432666.9938715403375; Wed, 28 Mar 2018 08:18:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B4F07FD50; Wed, 28 Mar 2018 15:18:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E234C60244; Wed, 28 Mar 2018 15:18:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A868F4CAA1; Wed, 28 Mar 2018 15:18:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2SFIgks014211 for ; Wed, 28 Mar 2018 11:18:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A0651C722; Wed, 28 Mar 2018 15:18:42 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE9997C29; Wed, 28 Mar 2018 15:18:41 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 28 Mar 2018 16:18:31 +0100 Message-Id: <20180328151832.7683-7-berrange@redhat.com> In-Reply-To: <20180328151832.7683-1-berrange@redhat.com> References: <20180328151832.7683-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/7] remote: use a separate connection for secret APIs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 28 Mar 2018 15:18:58 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: John Ferlan --- 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 1b906401d3..2b757d9cd6 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -78,6 +78,7 @@ struct daemonClientPrivate { virConnectPtr networkConn; virConnectPtr nodedevConn; virConnectPtr nwfilterConn; + virConnectPtr secretConn; =20 daemonClientStreamPtr streams; }; diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index dcfc0abf46..1a30d73049 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1708,7 +1708,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientP= rivate *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, @@ -1748,6 +1748,8 @@ void remoteClientFree(void *data) virConnectClose(priv->nodedevConn); if (priv->nwfilterConn) virConnectClose(priv->nwfilterConn); + if (priv->secretConn) + virConnectClose(priv->secretConn); =20 VIR_FREE(priv); } @@ -1826,6 +1828,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTR= IBUTE_UNUSED, priv->networkConn =3D virObjectRef(priv->conn); priv->nodedevConn =3D virObjectRef(priv->conn); priv->nwfilterConn =3D virObjectRef(priv->conn); + priv->secretConn =3D virObjectRef(priv->conn); =20 /* force update the @readonly attribute which was inherited from the * virNetServerService object - this is important for sockets that are= RW @@ -4047,12 +4050,12 @@ remoteDispatchSecretGetValue(virNetServerPtr server= ATTRIBUTE_UNUSED, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 - if (!priv->conn) { + if (!priv->secretConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 - if (!(secret =3D get_nonnull_secret(priv->conn, args->secret))) + if (!(secret =3D get_nonnull_secret(priv->secretConn, args->secret))) goto cleanup; =20 if (!(value =3D virSecretGetValue(secret, &value_size, args->flags))) @@ -6086,7 +6089,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU virNetServerClientGetPrivateData(client); virSecretPtr secret =3D NULL; =20 - if (!priv->conn) { + if (!priv->secretConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } @@ -6094,7 +6097,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU virMutexLock(&priv->lock); =20 if (args->secret && - !(secret =3D get_nonnull_secret(priv->conn, *args->secret))) + !(secret =3D get_nonnull_secret(priv->secretConn, *args->secret))) goto cleanup; =20 if (args->eventID >=3D VIR_SECRET_EVENT_ID_LAST || args->eventID < 0) { @@ -6120,7 +6123,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectSecretEventRegisterAny(priv->conn, + if ((callbackID =3D virConnectSecretEventRegisterAny(priv->secretConn, secret, args->eventID, secretEventCallback= s[args->eventID], @@ -6158,7 +6161,7 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetS= erverPtr server ATTRIBUTE_U struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 - if (!priv->conn) { + if (!priv->secretConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } @@ -6176,7 +6179,7 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetS= erverPtr server ATTRIBUTE_U goto cleanup; } =20 - if (virConnectSecretEventDeregisterAny(priv->conn, args->callbackID) <= 0) + if (virConnectSecretEventDeregisterAny(priv->secretConn, args->callbac= kID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->secretEventCallbacks, i, diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index d8ab8b17dd..58de379c8a 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -137,6 +137,9 @@ sub get_conn_arg { if ($type =3D~ /remote_nonnull_nwfilter/) { return "priv->nwfilterConn"; } + if ($type =3D~ /remote_nonnull_secret/) { + return "priv->secretConn"; + } } =20 # This is for the few virConnect APIs that @@ -154,6 +157,9 @@ sub get_conn_arg { if ($proc =3D~ /Connect.*NWFilter/) { return "priv->nodedevConn"; } + if ($proc =3D~ /Connect.*Secret/) { + return "priv->secretConn"; + } =20 return "priv->conn"; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list