From nobody Wed May 14 11:25:30 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 1522925521811284.6136279999582; Thu, 5 Apr 2018 03:52:01 -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 3F6CE369BD; Thu, 5 Apr 2018 10:52:00 +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 019621813E; Thu, 5 Apr 2018 10:52:00 +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 B9DFB4CA99; Thu, 5 Apr 2018 10:51:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w35Apvxa006120 for ; Thu, 5 Apr 2018 06:51:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1094D2024CA5; Thu, 5 Apr 2018 10:51:57 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 075F22024CA4; Thu, 5 Apr 2018 10:51:55 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 11:51:44 +0100 Message-Id: <20180405105147.20196-6-berrange@redhat.com> In-Reply-To: <20180405105147.20196-1-berrange@redhat.com> References: <20180405105147.20196-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 5/8] remote: use a separate connection for nodedev 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.30]); Thu, 05 Apr 2018 10:52:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Reviewed-by: John Ferlan Signed-off-by: Daniel P. Berrang=C3=A9 --- 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 60be78fe0b..517eec1fc2 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -76,6 +76,7 @@ struct daemonClientPrivate { virConnectPtr conn; virConnectPtr interfaceConn; virConnectPtr networkConn; + virConnectPtr nodedevConn; =20 daemonClientStreamPtr streams; }; diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index bc26bccf65..668f67cca8 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1710,7 +1710,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientP= rivate *priv) DEREG_CB(priv->conn, priv->storageEventCallbacks, priv->nstorageEventCallbacks, virConnectStoragePoolEventDeregisterAny, "storage"); - DEREG_CB(priv->conn, priv->nodeDeviceEventCallbacks, + DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks, priv->nnodeDeviceEventCallbacks, virConnectNodeDeviceEventDeregisterAny, "node device"); DEREG_CB(priv->conn, priv->secretEventCallbacks, @@ -1749,6 +1749,8 @@ void remoteClientFree(void *data) virConnectClose(priv->interfaceConn); if (priv->networkConn) virConnectClose(priv->networkConn); + if (priv->nodedevConn) + virConnectClose(priv->nodedevConn); =20 VIR_FREE(priv); } @@ -1823,6 +1825,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTR= IBUTE_UNUSED, =20 priv->interfaceConn =3D virObjectRef(priv->conn); priv->networkConn =3D virObjectRef(priv->conn); + priv->nodedevConn =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 @@ -3782,12 +3785,12 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr s= erver ATTRIBUTE_UNUSED, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 - if (!priv->conn) { + if (!priv->nodedevConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 - if (!(dev =3D virNodeDeviceLookupByName(priv->conn, args->name))) + if (!(dev =3D virNodeDeviceLookupByName(priv->nodedevConn, args->name)= )) goto cleanup; =20 parent =3D virNodeDeviceGetParent(dev); @@ -5962,7 +5965,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server ATTRIBUTE virNetServerClientGetPrivateData(client); virNodeDevicePtr dev =3D NULL; =20 - if (!priv->conn) { + if (!priv->nodedevConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } @@ -5970,7 +5973,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server ATTRIBUTE virMutexLock(&priv->lock); =20 if (args->dev && - !(dev =3D get_nonnull_node_device(priv->conn, *args->dev))) + !(dev =3D get_nonnull_node_device(priv->nodedevConn, *args->dev))) goto cleanup; =20 if (args->eventID >=3D VIR_NODE_DEVICE_EVENT_ID_LAST || args->eventID = < 0) { @@ -5996,7 +5999,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server ATTRIBUTE callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectNodeDeviceEventRegisterAny(priv->conn, + if ((callbackID =3D virConnectNodeDeviceEventRegisterAny(priv->nodedev= Conn, dev, args->eventID, nodeDeviceEvent= Callbacks[args->eventID], @@ -6034,7 +6037,7 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(vir= NetServerPtr server ATTRIBU struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 - if (!priv->conn) { + if (!priv->nodedevConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } @@ -6052,7 +6055,7 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(vir= NetServerPtr server ATTRIBU goto cleanup; } =20 - if (virConnectNodeDeviceEventDeregisterAny(priv->conn, args->callbackI= D) < 0) + if (virConnectNodeDeviceEventDeregisterAny(priv->nodedevConn, args->ca= llbackID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->nodeDeviceEventCallbacks, i, diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 51faa899c6..af29d88b99 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -131,6 +131,9 @@ sub get_conn_arg { if ($type =3D~ /remote_nonnull_network/) { return "priv->networkConn"; } + if ($type =3D~ /remote_nonnull_node_device/) { + return "priv->nodedevConn"; + } } =20 # This is for the few virConnect APIs that @@ -142,6 +145,9 @@ sub get_conn_arg { if ($proc =3D~ /Connect.*Network/) { return "priv->networkConn"; } + if ($proc =3D~ /Node.*Device/) { + return "priv->nodedevConn"; + } =20 return "priv->conn"; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list