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 1522250330369475.0480937390781; Wed, 28 Mar 2018 08:18:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F27AF80F7C; Wed, 28 Mar 2018 15:18:48 +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 B8CFD65AC4; Wed, 28 Mar 2018 15:18:48 +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 7D8594CA9D; Wed, 28 Mar 2018 15:18:48 +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 w2SFIe7F014187 for ; Wed, 28 Mar 2018 11:18:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2BF1F94581; Wed, 28 Mar 2018 15:18:40 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id B16006353C; Wed, 28 Mar 2018 15:18:39 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 28 Mar 2018 16:18:28 +0100 Message-Id: <20180328151832.7683-4-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 3/7] remote: use a separate connection for network 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.16 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:49 +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 31f433c15d..60be78fe0b 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -75,6 +75,7 @@ struct daemonClientPrivate { */ virConnectPtr conn; virConnectPtr interfaceConn; + virConnectPtr networkConn; =20 daemonClientStreamPtr streams; }; diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 7971646c28..d0bc474850 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1699,7 +1699,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientP= rivate *priv) DEREG_CB(priv->conn, priv->domainEventCallbacks, priv->ndomainEventCallbacks, virConnectDomainEventDeregisterAny, "domain"); - DEREG_CB(priv->conn, priv->networkEventCallbacks, + DEREG_CB(priv->networkConn, priv->networkEventCallbacks, priv->nnetworkEventCallbacks, virConnectNetworkEventDeregisterAny, "network"); DEREG_CB(priv->conn, priv->storageEventCallbacks, @@ -1742,6 +1742,8 @@ void remoteClientFree(void *data) virConnectClose(priv->conn); if (priv->interfaceConn) virConnectClose(priv->interfaceConn); + if (priv->networkConn) + virConnectClose(priv->networkConn); =20 VIR_FREE(priv); } @@ -1817,6 +1819,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTR= IBUTE_UNUSED, goto cleanup; =20 priv->interfaceConn =3D virObjectRef(priv->conn); + priv->networkConn =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 @@ -5713,7 +5716,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server ATTRIBUTE_UN virNetServerClientGetPrivateData(client); virNetworkPtr net =3D NULL; =20 - if (!priv->conn) { + if (!priv->networkConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } @@ -5721,7 +5724,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server ATTRIBUTE_UN virMutexLock(&priv->lock); =20 if (args->net && - !(net =3D get_nonnull_network(priv->conn, *args->net))) + !(net =3D get_nonnull_network(priv->networkConn, *args->net))) goto cleanup; =20 if (args->eventID >=3D VIR_NETWORK_EVENT_ID_LAST || args->eventID < 0)= { @@ -5747,7 +5750,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server ATTRIBUTE_UN callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectNetworkEventRegisterAny(priv->conn, + if ((callbackID =3D virConnectNetworkEventRegisterAny(priv->networkCon= n, net, args->eventID, networkEventCallba= cks[args->eventID], @@ -5786,7 +5789,7 @@ remoteDispatchConnectNetworkEventDeregisterAny(virNet= ServerPtr server ATTRIBUTE_ struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 - if (!priv->conn) { + if (!priv->networkConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } @@ -5804,7 +5807,7 @@ remoteDispatchConnectNetworkEventDeregisterAny(virNet= ServerPtr server ATTRIBUTE_ goto cleanup; } =20 - if (virConnectNetworkEventDeregisterAny(priv->conn, args->callbackID) = < 0) + if (virConnectNetworkEventDeregisterAny(priv->networkConn, args->callb= ackID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->networkEventCallbacks, i, @@ -6467,12 +6470,12 @@ remoteDispatchNetworkGetDHCPLeases(virNetServerPtr = server ATTRIBUTE_UNUSED, virNetworkPtr net =3D NULL; int nleases =3D 0; =20 - if (!priv->conn) { + if (!priv->networkConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 - if (!(net =3D get_nonnull_network(priv->conn, args->net))) + if (!(net =3D get_nonnull_network(priv->networkConn, args->net))) goto cleanup; =20 if ((nleases =3D virNetworkGetDHCPLeases(net, diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 23b17c0815..5bab13bb7b 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -128,6 +128,9 @@ sub get_conn_arg { if ($type =3D~ /remote_nonnull_interface/) { return "priv->interfaceConn"; } + if ($type =3D~ /remote_nonnull_network/) { + return "priv->networkConn"; + } } =20 # This is for the few virConnect APIs that @@ -136,6 +139,9 @@ sub get_conn_arg { if ($proc =3D~ /Connect.*Interface/ || $proc =3D~ /InterfaceChange/) { return "priv->interfaceConn"; } + if ($proc =3D~ /Connect.*Network/) { + return "priv->networkConn"; + } =20 return "priv->conn"; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list