From nobody Sun Apr 28 10:35:34 2024 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 1522250323926864.5132178731747; Wed, 28 Mar 2018 08:18:43 -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 0CB0664D83; Wed, 28 Mar 2018 15:18:42 +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 BBF4D63143; Wed, 28 Mar 2018 15:18:41 +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 77E9E181BA07; Wed, 28 Mar 2018 15:18:41 +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 w2SFIcav014168 for ; Wed, 28 Mar 2018 11:18:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id CB2241C722; Wed, 28 Mar 2018 15:18:38 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4108894581; Wed, 28 Mar 2018 15:18:38 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 28 Mar 2018 16:18:26 +0100 Message-Id: <20180328151832.7683-2-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 1/7] rpc: refactor way connection object is generated for remote dispatch 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.38]); Wed, 28 Mar 2018 15:18:42 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Calling a push_privconn method to directly push the connection object name into the arg list is inconvenient. Refactor so that we acquire the connection variable name upfront, and push it to the arg list separately. This allows various hardcoded usage of "priv->conn" to be parameterized. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: John Ferlan --- src/rpc/gendispatch.pl | 48 ++++++++++++++++++++++------------------------= -- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index fb15cc4849..e11921f3d9 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -110,19 +110,13 @@ sub name_to_TypeName { return $typename; } =20 -sub push_privconn { - my $args =3D shift; - - if (!@$args) { - if ($structprefix eq "admin") { - push(@$args, "priv->dmn"); - } else { - push(@$args, "priv->conn"); - } +sub get_conn_arg { + if ($structprefix eq "admin") { + return "priv->dmn"; } + return "priv->conn"; } =20 - # Read the input file (usually remote_protocol.x) and form an # opinion about the name, args and return type of each RPC. my ($name, $ProcName, $id, $flags, %calls, @calls, %opts); @@ -487,6 +481,8 @@ elsif ($mode eq "server") { my @free_list =3D (); my @free_list_on_error =3D ("virNetMessageSaveError(rerr);"); =20 + my $conn =3D get_conn_arg(); + # handle arguments to the function if ($argtype ne "void") { # node device is special, as it's identified by name @@ -497,7 +493,7 @@ elsif ($mode eq "server") { $has_node_device =3D 1; push(@vars_list, "virNodeDevicePtr dev =3D NULL"); push(@getters_list, - " if (!(dev =3D virNodeDeviceLookupByName(priv->co= nn, args->name)))\n" . + " if (!(dev =3D virNodeDeviceLookupByName($conn, a= rgs->name)))\n" . " goto cleanup;\n"); push(@args_list, "dev"); push(@free_list, @@ -513,7 +509,7 @@ elsif ($mode eq "server") { =20 push(@vars_list, "vir${type_name}Ptr $2 =3D NULL"); push(@getters_list, - " if (!($2 =3D get_nonnull_$1(priv->conn, args= ->$2)))\n" . + " if (!($2 =3D get_nonnull_$1($conn, args->$2)= ))\n" . " goto cleanup;\n"); push(@args_list, "$2"); push(@free_list, @@ -522,7 +518,7 @@ elsif ($mode eq "server") { push(@vars_list, "virDomainPtr dom =3D NULL"); push(@vars_list, "virDomainSnapshotPtr snapshot =3D NU= LL"); push(@getters_list, - " if (!(dom =3D get_nonnull_domain(priv->conn,= args->${1}.dom)))\n" . + " if (!(dom =3D get_nonnull_domain($conn, args= ->${1}.dom)))\n" . " goto cleanup;\n" . "\n" . " if (!(snapshot =3D get_nonnull_domain_snapsh= ot(dom, args->${1})))\n" . @@ -532,11 +528,11 @@ elsif ($mode eq "server") { " virObjectUnref(snapshot);\n" . " virObjectUnref(dom);"); } elsif ($args_member =3D~ m/^(?:(?:admin|remote)_string|r= emote_uuid) (\S+)<\S+>;/) { - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; push(@args_list, "args->$1.$1_val"); push(@args_list, "args->$1.$1_len"); } elsif ($args_member =3D~ m/^(?:opaque|(?:admin|remote)_n= onnull_string) (\S+)<\S+>;(.*)$/) { - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; =20 my $cast =3D ""; my $arg_name =3D $1; @@ -553,7 +549,7 @@ elsif ($mode eq "server") { push(@args_list, "${cast}args->$arg_name.${arg_name}_v= al"); push(@args_list, "args->$arg_name.${arg_name}_len"); } elsif ($args_member =3D~ m/^(?:unsigned )?int (\S+)<\S+>= ;/) { - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; =20 push(@args_list, "args->$1.$1_val"); push(@args_list, "args->$1.$1_len"); @@ -561,7 +557,7 @@ elsif ($mode eq "server") { push(@vars_list, "virTypedParameterPtr $1 =3D NULL"); push(@vars_list, "int n$1 =3D 0"); if ($call->{ProcName} eq "NodeSetMemoryParameters") { - push(@args_list, "priv->conn"); + push(@args_list, "$conn"); } push(@args_list, "$1"); push(@args_list, "n$1"); @@ -576,25 +572,25 @@ elsif ($mode eq "server") { # just make all other array types fail die "unhandled type for argument value: $args_member"; } elsif ($args_member =3D~ m/^remote_uuid (\S+);/) { - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; =20 push(@args_list, "(unsigned char *) args->$1"); } elsif ($args_member =3D~ m/^(?:admin|remote)_string (\S+= );/) { - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; =20 push(@vars_list, "char *$1"); push(@optionals_list, "$1"); push(@args_list, "$1"); } elsif ($args_member =3D~ m/^(?:admin|remote)_nonnull_str= ing (\S+);/) { - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; =20 push(@args_list, "args->$1"); } elsif ($args_member =3D~ m/^(unsigned )?int (\S+);/) { - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; =20 push(@args_list, "args->$2"); } elsif ($args_member =3D~ m/^(unsigned )?hyper (\S+);/) { - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; =20 my $arg_name =3D $2; =20 @@ -900,7 +896,7 @@ elsif ($mode eq "server") { # select struct type for multi-return-value functions if ($multi_ret) { if (defined $call->{ret_offset}) { - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; =20 if ($modern_ret_as_list) { my $struct_name =3D name_to_TypeName($modern_ret_struc= t_name); @@ -1002,7 +998,7 @@ elsif ($mode eq "server") { if ($structprefix eq "admin") { print " if (!priv->dmn) {\n"; } else { - print " if (!priv->conn) {\n"; + print " if (!$conn) {\n"; } =20 print " virReportError(VIR_ERR_INTERNAL_ERROR, \"%s\", _(\"= connection not open\"));\n"; @@ -1034,7 +1030,7 @@ elsif ($mode eq "server") { } =20 if ($call->{streamflag} ne "none") { - print " if (!(st =3D virStreamNew(priv->conn, VIR_STREAM_NO= NBLOCK)))\n"; + print " if (!(st =3D virStreamNew($conn, VIR_STREAM_NONBLOC= K)))\n"; print " goto cleanup;\n"; print "\n"; print " if (!(stream =3D daemonCreateClientStream(client, s= t, remoteProgram, &msg->header, sparse)))\n"; @@ -1051,7 +1047,7 @@ elsif ($mode eq "server") { } elsif (!$multi_ret) { my $proc_name =3D $call->{ProcName}; =20 - push_privconn(\@args_list); + push(@args_list, $conn) if !@args_list; =20 if ($structprefix eq "qemu" && $call->{ProcName} =3D~ /^(Connect)?Domain/) { --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 10:35:34 2024 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 1522250326958860.0878550161151; Wed, 28 Mar 2018 08:18:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC72751453; Wed, 28 Mar 2018 15:18:45 +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 826115D6A8; Wed, 28 Mar 2018 15:18:45 +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 4C10B4CA97; 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 w2SFIdYM014180 for ; Wed, 28 Mar 2018 11:18:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7C79B94581; Wed, 28 Mar 2018 15:18:39 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CE1B6353C; Wed, 28 Mar 2018 15:18:38 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 28 Mar 2018 16:18:27 +0100 Message-Id: <20180328151832.7683-3-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 2/7] remote: use a separate connection for interface 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); 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 | 4 ++++ src/rpc/gendispatch.pl | 25 ++++++++++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h index 4467f71da9..31f433c15d 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -74,6 +74,7 @@ struct daemonClientPrivate { * called, it will be set back to NULL if that succeeds. */ virConnectPtr conn; + virConnectPtr interfaceConn; =20 daemonClientStreamPtr streams; }; diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 121d114ae3..7971646c28 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1740,6 +1740,8 @@ void remoteClientFree(void *data) =20 if (priv->conn) virConnectClose(priv->conn); + if (priv->interfaceConn) + virConnectClose(priv->interfaceConn); =20 VIR_FREE(priv); } @@ -1814,6 +1816,8 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTR= IBUTE_UNUSED, if (priv->conn =3D=3D NULL) goto cleanup; =20 + priv->interfaceConn =3D virObjectRef(priv->conn); + /* force update the @readonly attribute which was inherited from the * virNetServerService object - this is important for sockets that are= RW * by default, but do accept RO flags, e.g. TCP diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index e11921f3d9..23b17c0815 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -111,9 +111,32 @@ sub name_to_TypeName { } =20 sub get_conn_arg { + my $proc =3D shift; + my $args =3D shift; + my $rets =3D shift; + if ($structprefix eq "admin") { return "priv->dmn"; } + + my @types; + push @types, @{$args} if $args; + push @types, @{$rets} if $rets; + + # This correctly detects most APIs + foreach my $type (@types) { + if ($type =3D~ /remote_nonnull_interface/) { + return "priv->interfaceConn"; + } + } + + # This is for the few virConnect APIs that + # return things which aren't objects. eg list + # of pool names, or number of pools. + if ($proc =3D~ /Connect.*Interface/ || $proc =3D~ /InterfaceChange/) { + return "priv->interfaceConn"; + } + return "priv->conn"; } =20 @@ -481,7 +504,7 @@ elsif ($mode eq "server") { my @free_list =3D (); my @free_list_on_error =3D ("virNetMessageSaveError(rerr);"); =20 - my $conn =3D get_conn_arg(); + my $conn =3D get_conn_arg($call->{ProcName}, $call->{args_members}= , $call->{ret_members}); =20 # handle arguments to the function if ($argtype ne "void") { --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 10:35:34 2024 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 From nobody Sun Apr 28 10:35:34 2024 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 1522250333307776.0386526438408; Wed, 28 Mar 2018 08:18:53 -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 DC94844BDD; Wed, 28 Mar 2018 15:18:51 +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 B6D6860476; Wed, 28 Mar 2018 15:18:51 +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 7FA784CA9F; Wed, 28 Mar 2018 15:18:51 +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 w2SFIe4P014194 for ; Wed, 28 Mar 2018 11:18:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id CFE7E1C722; 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 617A9A9F4B; Wed, 28 Mar 2018 15:18:40 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 28 Mar 2018 16:18:29 +0100 Message-Id: <20180328151832.7683-5-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 4/7] 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 28 Mar 2018 15:18:52 +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 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 d0bc474850..baa4f1eadc 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1705,7 +1705,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, @@ -1744,6 +1744,8 @@ void remoteClientFree(void *data) virConnectClose(priv->interfaceConn); if (priv->networkConn) virConnectClose(priv->networkConn); + if (priv->nodedevConn) + virConnectClose(priv->nodedevConn); =20 VIR_FREE(priv); } @@ -1820,6 +1822,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 @@ -3779,12 +3782,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); @@ -5959,7 +5962,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; } @@ -5967,7 +5970,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) { @@ -5993,7 +5996,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], @@ -6031,7 +6034,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; } @@ -6049,7 +6052,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 5bab13bb7b..0e7567fbde 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 From nobody Sun Apr 28 10:35:34 2024 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 1522250336092560.2992398211727; Wed, 28 Mar 2018 08:18:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD6577FD47; Wed, 28 Mar 2018 15:18:54 +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 841A118227; Wed, 28 Mar 2018 15:18:54 +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 4EBEB180BAD6; Wed, 28 Mar 2018 15:18:54 +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 w2SFIfZM014204 for ; Wed, 28 Mar 2018 11:18:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8013C6353C; Wed, 28 Mar 2018 15:18:41 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1155994581; Wed, 28 Mar 2018 15:18:40 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 28 Mar 2018 16:18:30 +0100 Message-Id: <20180328151832.7683-6-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 5/7] remote: use a separate connection for nwfilter 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.13 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:55 +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 | 3 +++ src/rpc/gendispatch.pl | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h index 517eec1fc2..1b906401d3 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -77,6 +77,7 @@ struct daemonClientPrivate { virConnectPtr interfaceConn; virConnectPtr networkConn; virConnectPtr nodedevConn; + virConnectPtr nwfilterConn; =20 daemonClientStreamPtr streams; }; diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index baa4f1eadc..dcfc0abf46 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1746,6 +1746,8 @@ void remoteClientFree(void *data) virConnectClose(priv->networkConn); if (priv->nodedevConn) virConnectClose(priv->nodedevConn); + if (priv->nwfilterConn) + virConnectClose(priv->nwfilterConn); =20 VIR_FREE(priv); } @@ -1823,6 +1825,7 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTR= IBUTE_UNUSED, priv->interfaceConn =3D virObjectRef(priv->conn); priv->networkConn =3D virObjectRef(priv->conn); priv->nodedevConn =3D virObjectRef(priv->conn); + priv->nwfilterConn =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 diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 0e7567fbde..d8ab8b17dd 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -134,6 +134,9 @@ sub get_conn_arg { if ($type =3D~ /remote_nonnull_node_device/) { return "priv->nodedevConn"; } + if ($type =3D~ /remote_nonnull_nwfilter/) { + return "priv->nwfilterConn"; + } } =20 # This is for the few virConnect APIs that @@ -148,6 +151,9 @@ sub get_conn_arg { if ($proc =3D~ /Node.*Device/) { return "priv->nodedevConn"; } + if ($proc =3D~ /Connect.*NWFilter/) { + 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 From nobody Sun Apr 28 10:35:34 2024 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 From nobody Sun Apr 28 10:35:34 2024 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