From nobody Fri May 3 08:52:46 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 1522925587353802.566221370558; Thu, 5 Apr 2018 03:53:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0BAD4A459D; Thu, 5 Apr 2018 10:53:06 +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 CFD008F6E4; Thu, 5 Apr 2018 10:53:05 +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 8A4461800CAB; Thu, 5 Apr 2018 10:53:05 +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 w35AppR5006073 for ; Thu, 5 Apr 2018 06:51:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6BE2B2024CA6; Thu, 5 Apr 2018 10:51:51 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC1822024CA4; Thu, 5 Apr 2018 10:51:50 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 11:51:40 +0100 Message-Id: <20180405105147.20196-2-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 1/8] 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 05 Apr 2018 10:53:06 +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. Reviewed-by: John Ferlan Signed-off-by: Daniel P. Berrang=C3=A9 --- src/rpc/gendispatch.pl | 57 +++++++++++++++++++++-------------------------= ---- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index fb15cc4849..d5e61f5bb8 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 @@ -613,7 +609,7 @@ elsif ($mode eq "server") { =20 push(@vars_list, "virNet${type_name}Ptr $2 =3D NULL"); push(@getters_list, - " if (!($2 =3D get_nonnull_$1(priv->dmn, args-= >$2)))\n" . + " if (!($2 =3D get_nonnull_$1($conn, args->$2)= ))\n" . " goto cleanup;\n"); push(@args_list, "$2"); push(@free_list, @@ -624,7 +620,7 @@ elsif ($mode eq "server") { push(@vars_list, "virNetServerPtr srv =3D NULL"); push(@vars_list, "virNetServer${type_name}Ptr $2 =3D N= ULL"); push(@getters_list, - " if (!(srv =3D get_nonnull_server(priv->dmn, = args->$2.srv)))\n" . + " if (!(srv =3D get_nonnull_server($conn, args= ->$2.srv)))\n" . " goto cleanup;\n"); push(@getters_list, " if (!($2 =3D get_nonnull_$1(srv, args->$2)))= \n" . @@ -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); @@ -999,12 +995,7 @@ elsif ($mode eq "server") { =20 print "\n"; =20 - if ($structprefix eq "admin") { - print " if (!priv->dmn) {\n"; - } else { - print " if (!priv->conn) {\n"; - } - + print " if (!$conn) {\n"; print " virReportError(VIR_ERR_INTERNAL_ERROR, \"%s\", _(\"= connection not open\"));\n"; print " goto cleanup;\n"; print " }\n"; @@ -1034,7 +1025,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 +1042,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 Fri May 3 08:52:46 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 1522925518817183.17659067951763; Thu, 5 Apr 2018 03:51:58 -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 6FD9FC04BE27; Thu, 5 Apr 2018 10:51:57 +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 418626A251; Thu, 5 Apr 2018 10:51: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 C78D31800CA2; Thu, 5 Apr 2018 10:51:56 +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 w35Aprgo006084 for ; Thu, 5 Apr 2018 06:51:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id EC37D2024CA6; Thu, 5 Apr 2018 10:51:52 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id D86DE2024CA4; Thu, 5 Apr 2018 10:51:51 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 11:51:41 +0100 Message-Id: <20180405105147.20196-3-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 2/8] remote: push check for conn down into remoteClientFreePrivateCallbacks 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.31]); Thu, 05 Apr 2018 10:51:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 There will shortly be many connection objects, so we should not assume a single check against priv->conn is sufficient. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: John Ferlan --- src/remote/remote_daemon_dispatch.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 121d114ae3..853e63901b 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1673,6 +1673,11 @@ void remoteRelayConnectionClosedEvent(virConnectPtr = conn ATTRIBUTE_UNUSED, int r #define DEREG_CB(conn, eventCallbacks, neventCallbacks, deregFcn, name) \ do { \ size_t i; \ + if (neventCallbacks && !conn) { \ + VIR_WARN("Have %zu %s event callbacks but no connection", \ + neventCallbacks, name); \ + break; \ + } \ for (i =3D 0; i < neventCallbacks; i++) { \ int callbackID =3D eventCallbacks[i]->callbackID; \ if (callbackID < 0) { \ @@ -1715,7 +1720,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientP= rivate *priv) priv->nqemuEventCallbacks, virConnectDomainQemuMonitorEventDeregister, "qemu monitor"); =20 - if (priv->closeRegistered) { + if (priv->closeRegistered && priv->conn) { if (virConnectUnregisterCloseCallback(priv->conn, remoteRelayConnectionClosedE= vent) < 0) VIR_WARN("unexpected close callback event deregister failure"); @@ -1751,9 +1756,7 @@ static void remoteClientCloseFunc(virNetServerClientP= tr client) =20 daemonRemoveAllClientStreams(priv->streams); =20 - /* Deregister event delivery callback */ - if (priv->conn) - remoteClientFreePrivateCallbacks(priv); + remoteClientFreePrivateCallbacks(priv); } =20 =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 08:52:46 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 1522925591013111.88242675515778; Thu, 5 Apr 2018 03:53:11 -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 8347D804F7; Thu, 5 Apr 2018 10:53:09 +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 50D782C8EB; Thu, 5 Apr 2018 10:53:09 +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 1AFF04CA97; Thu, 5 Apr 2018 10:53:09 +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 w35ApsxP006093 for ; Thu, 5 Apr 2018 06:51:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6093B2024CA6; Thu, 5 Apr 2018 10:51:54 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A26A2024CA4; Thu, 5 Apr 2018 10:51:53 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 11:51:42 +0100 Message-Id: <20180405105147.20196-4-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 3/8] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 05 Apr 2018 10:53:10 +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 | 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 853e63901b..34c140e613 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1745,6 +1745,8 @@ void remoteClientFree(void *data) =20 if (priv->conn) virConnectClose(priv->conn); + if (priv->interfaceConn) + virConnectClose(priv->interfaceConn); =20 VIR_FREE(priv); } @@ -1817,6 +1819,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 d5e61f5bb8..88fcd46c45 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 Fri May 3 08:52:46 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 152292559413663.752491534208616; Thu, 5 Apr 2018 03:53:14 -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 BD3A180475; Thu, 5 Apr 2018 10:53:12 +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 8B8772C8DF; Thu, 5 Apr 2018 10:53:12 +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 565204CA9F; Thu, 5 Apr 2018 10:53:12 +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 w35AptG7006108 for ; Thu, 5 Apr 2018 06:51:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9A16A2024CA6; Thu, 5 Apr 2018 10:51:55 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id C554B2024CA4; Thu, 5 Apr 2018 10:51:54 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 11:51:43 +0100 Message-Id: <20180405105147.20196-5-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 4/8] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 05 Apr 2018 10:53:13 +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 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 34c140e613..bc26bccf65 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1704,7 +1704,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, @@ -1747,6 +1747,8 @@ void remoteClientFree(void *data) virConnectClose(priv->conn); if (priv->interfaceConn) virConnectClose(priv->interfaceConn); + if (priv->networkConn) + virConnectClose(priv->networkConn); =20 VIR_FREE(priv); } @@ -1820,6 +1822,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 @@ -5716,7 +5719,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; } @@ -5724,7 +5727,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)= { @@ -5750,7 +5753,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], @@ -5789,7 +5792,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; } @@ -5807,7 +5810,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, @@ -6470,12 +6473,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 88fcd46c45..51faa899c6 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 Fri May 3 08:52:46 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 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 From nobody Fri May 3 08:52:46 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 1522925523416912.8287779923188; Thu, 5 Apr 2018 03:52:03 -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 213994A6F3; Thu, 5 Apr 2018 10:52:02 +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 E4F337F344; Thu, 5 Apr 2018 10:52:01 +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 943D14CA9E; Thu, 5 Apr 2018 10:52:01 +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 w35Apw24006135 for ; Thu, 5 Apr 2018 06:51:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 207DD2024CA6; Thu, 5 Apr 2018 10:51:58 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71BC82024CA4; Thu, 5 Apr 2018 10:51:57 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 11:51:45 +0100 Message-Id: <20180405105147.20196-7-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 6/8] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 05 Apr 2018 10:52:02 +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 | 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 668f67cca8..36190de8f2 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1751,6 +1751,8 @@ void remoteClientFree(void *data) virConnectClose(priv->networkConn); if (priv->nodedevConn) virConnectClose(priv->nodedevConn); + if (priv->nwfilterConn) + virConnectClose(priv->nwfilterConn); =20 VIR_FREE(priv); } @@ -1826,6 +1828,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 af29d88b99..cccfcab743 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->nwfilterConn"; + } =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 Fri May 3 08:52:46 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 1522925530920702.9724872334124; Thu, 5 Apr 2018 03:52:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 639ED80E79; Thu, 5 Apr 2018 10:52:09 +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 3638F18E4F; Thu, 5 Apr 2018 10:52:09 +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 D3A73180BADC; Thu, 5 Apr 2018 10:52:08 +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 w35ApxKS006141 for ; Thu, 5 Apr 2018 06:51:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 648392024CA5; Thu, 5 Apr 2018 10:51:59 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F7C22024CA4; Thu, 5 Apr 2018 10:51:58 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 11:51:46 +0100 Message-Id: <20180405105147.20196-8-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 7/8] 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 05 Apr 2018 10:52:09 +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 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 36190de8f2..8f1b537db9 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1713,7 +1713,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, @@ -1753,6 +1753,8 @@ void remoteClientFree(void *data) virConnectClose(priv->nodedevConn); if (priv->nwfilterConn) virConnectClose(priv->nwfilterConn); + if (priv->secretConn) + virConnectClose(priv->secretConn); =20 VIR_FREE(priv); } @@ -1829,6 +1831,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 @@ -4050,12 +4053,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))) @@ -6089,7 +6092,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; } @@ -6097,7 +6100,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) { @@ -6123,7 +6126,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], @@ -6161,7 +6164,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; } @@ -6179,7 +6182,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 cccfcab743..0c575cd055 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->nwfilterConn"; } + 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 Fri May 3 08:52:46 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 1522925535127329.1503889411674; Thu, 5 Apr 2018 03:52:15 -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 CCD888046D; Thu, 5 Apr 2018 10:52:13 +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 A97B21965C; Thu, 5 Apr 2018 10:52:13 +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 65C62180BAE7; Thu, 5 Apr 2018 10:52:13 +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 w35Aq0ag006155 for ; Thu, 5 Apr 2018 06:52:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 527032024CA7; Thu, 5 Apr 2018 10:52:00 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0DE72024CA4; Thu, 5 Apr 2018 10:51:59 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 11:51:47 +0100 Message-Id: <20180405105147.20196-9-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 8/8] 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.28]); Thu, 05 Apr 2018 10:52:14 +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 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 8f1b537db9..5b764bab48 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1707,7 +1707,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientP= rivate *priv) DEREG_CB(priv->networkConn, priv->networkEventCallbacks, priv->nnetworkEventCallbacks, virConnectNetworkEventDeregisterAny, "network"); - DEREG_CB(priv->conn, priv->storageEventCallbacks, + DEREG_CB(priv->storageConn, priv->storageEventCallbacks, priv->nstorageEventCallbacks, virConnectStoragePoolEventDeregisterAny, "storage"); DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks, @@ -1755,6 +1755,8 @@ void remoteClientFree(void *data) virConnectClose(priv->nwfilterConn); if (priv->secretConn) virConnectClose(priv->secretConn); + if (priv->storageConn) + virConnectClose(priv->storageConn); =20 VIR_FREE(priv); } @@ -1832,6 +1834,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 @@ -5850,7 +5853,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; } @@ -5858,7 +5861,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) { @@ -5884,7 +5887,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], @@ -5922,7 +5925,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; } @@ -5940,7 +5943,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, @@ -6914,12 +6917,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 0c575cd055..b8b83b6b40 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 @@ -160,6 +163,9 @@ sub get_conn_arg { if ($proc =3D~ /Connect.*Secret/) { return "priv->secretConn"; } + 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