From nobody Wed May 14 11:39:00 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 1522250327771634.725546974101; Wed, 28 Mar 2018 08:18:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3EED8C06A7ED; Wed, 28 Mar 2018 15:18:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 155CE60476; Wed, 28 Mar 2018 15:18:46 +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 C7791180BAD3; Wed, 28 Mar 2018 15:18:45 +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 w2SFIhD7014222 for ; Wed, 28 Mar 2018 11:18:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0A8AC94581; Wed, 28 Mar 2018 15:18:43 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F50B7C29; Wed, 28 Mar 2018 15:18:42 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 28 Mar 2018 16:18:32 +0100 Message-Id: <20180328151832.7683-8-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 7/7] remote: use a separate connection for storage 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 28 Mar 2018 15:18:46 +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 | 17 ++++++++++------- src/rpc/gendispatch.pl | 6 ++++++ 3 files changed, 17 insertions(+), 7 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; =20 daemonClientStreamPtr streams; }; diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 1a30d73049..10d9d73ff0 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1750,6 +1750,8 @@ void remoteClientFree(void *data) virConnectClose(priv->nwfilterConn); if (priv->secretConn) virConnectClose(priv->secretConn); + if (priv->storageConn) + virConnectClose(priv->storageConn); =20 VIR_FREE(priv); } @@ -1829,6 +1831,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTR= IBUTE_UNUSED, priv->nodedevConn =3D virObjectRef(priv->conn); priv->nwfilterConn =3D virObjectRef(priv->conn); priv->secretConn =3D virObjectRef(priv->conn); + priv->storageConn =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 @@ -5847,7 +5850,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server ATTRIBUT virNetServerClientGetPrivateData(client); virStoragePoolPtr pool =3D NULL; =20 - if (!priv->conn) { + if (!priv->storageConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } @@ -5855,7 +5858,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server ATTRIBUT virMutexLock(&priv->lock); =20 if (args->pool && - !(pool =3D get_nonnull_storage_pool(priv->conn, *args->pool))) + !(pool =3D get_nonnull_storage_pool(priv->storageConn, *args->pool= ))) goto cleanup; =20 if (args->eventID >=3D VIR_STORAGE_POOL_EVENT_ID_LAST || args->eventID= < 0) { @@ -5881,7 +5884,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server ATTRIBUT callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectStoragePoolEventRegisterAny(priv->conn, + if ((callbackID =3D virConnectStoragePoolEventRegisterAny(priv->storag= eConn, pool, args->eventID, storageEventCa= llbacks[args->eventID], @@ -5919,7 +5922,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(vi= rNetServerPtr server ATTRIB struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 - if (!priv->conn) { + if (!priv->storageConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } @@ -5937,7 +5940,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(vi= rNetServerPtr server ATTRIB goto cleanup; } =20 - if (virConnectStoragePoolEventDeregisterAny(priv->conn, args->callback= ID) < 0) + if (virConnectStoragePoolEventDeregisterAny(priv->storageConn, args->c= allbackID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->storageEventCallbacks, i, @@ -6911,12 +6914,12 @@ remoteDispatchStorageVolGetInfoFlags(virNetServerPt= r server ATTRIBUTE_UNUSED, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 - if (!priv->conn) { + if (!priv->storageConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 - if (!(vol =3D get_nonnull_storage_vol(priv->conn, args->vol))) + if (!(vol =3D get_nonnull_storage_vol(priv->storageConn, args->vol))) goto cleanup; =20 if (virStorageVolGetInfoFlags(vol, &tmp, args->flags) < 0) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 58de379c8a..656f66f1b5 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -140,6 +140,9 @@ sub get_conn_arg { if ($type =3D~ /remote_nonnull_secret/) { return "priv->secretConn"; } + if ($type =3D~ /remote_nonnull_storage/) { + return "priv->storageConn"; + } } =20 # This is for the few virConnect APIs that @@ -159,6 +162,9 @@ sub get_conn_arg { } if ($proc =3D~ /Connect.*Secret/) { return "priv->secretConn"; + }=20 + if ($proc =3D~ /Connect.*Storage/) { + return "priv->storageConn"; } =20 return "priv->conn"; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list