From nobody Sun Feb 8 12:18:57 2026 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565277244; cv=none; d=zoho.com; s=zohoarc; b=hpDkNR1Jv1QmTupGAOikM234ysBYkU0hwV1PwImBWvL6MYCCvnlk5gctJNDw/9cH3bW5EWaEqFGnoUq5bEMRLPGY8eNQpU46Yn6yw+pMNAOhC7hatNDmA3Q2Uef77LhQehwpS9DWkhjxl3ksZbtzhD/mri7hCLMRuBHBLjkQ/CE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565277244; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Ap2Vaictdl9cNuyTlA5o1DkfMol/Yi0AZvLvZQJOKIE=; b=YUZDnFDZ+S5BUwwesUiPiP7SuHJ7mSnw/tRbZRAWk30Dmko9oieVOs3qEzEopviRkOslMmkW4Wrtk9bvLy5+N3IDQtDhdWS1cM8CxUImTAo5LVyfUKzEBQ/5iWOchEtD8xXCc1KHK7kBmOWotPheqjTkwuE7M/u5lqTNBhItVu0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565277244318838.3726832634462; Thu, 8 Aug 2019 08:14:04 -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 DDBD330084AC; Thu, 8 Aug 2019 15:14:02 +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 A5ED76D0AD; Thu, 8 Aug 2019 15:14:02 +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 5D8B718005A4; Thu, 8 Aug 2019 15:14:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x78FC9iE028001 for ; Thu, 8 Aug 2019 11:12:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id F07181001948; Thu, 8 Aug 2019 15:12:09 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72A851001955; Thu, 8 Aug 2019 15:12:08 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 8 Aug 2019 16:10:39 +0100 Message-Id: <20190808151044.11385-38-berrange@redhat.com> In-Reply-To: <20190808151044.11385-1-berrange@redhat.com> References: <20190808151044.11385-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH v4 37/42] remote: change hand written methods to not directly access connection 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.40]); Thu, 08 Aug 2019 15:14:03 +0000 (UTC) The driver dispatch methods access the priv->conn variables directly. In future we want to dynamically open the connections for the secondary driver. Thus we want the methods to call a method to get the connection handle instead of assuming the private variable is non-NULL. Reviewed-by: Andrea Bolognani Signed-off-by: Daniel P. Berrang=C3=A9 --- src/remote/remote_daemon_dispatch.c | 718 ++++++++++------------------ 1 file changed, 257 insertions(+), 461 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 4a3312a944..5609eb4caf 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -2148,15 +2148,12 @@ remoteDispatchDomainGetSchedulerType(virNetServerPt= r server ATTRIBUTE_UNUSED, char *type; int nparams; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (!(type =3D virDomainGetSchedulerType(dom, &nparams))) @@ -2185,13 +2182,10 @@ remoteDispatchDomainGetSchedulerParameters(virNetSe= rverPtr server ATTRIBUTE_UNUS virTypedParameterPtr params =3D NULL; int nparams =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"= )); @@ -2201,7 +2195,7 @@ remoteDispatchDomainGetSchedulerParameters(virNetServ= erPtr server ATTRIBUTE_UNUS goto cleanup; nparams =3D args->nparams; =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetSchedulerParameters(dom, params, &nparams) < 0) @@ -2235,13 +2229,10 @@ remoteDispatchDomainGetSchedulerParametersFlags(vir= NetServerPtr server ATTRIBUTE virTypedParameterPtr params =3D NULL; int nparams =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"= )); @@ -2251,7 +2242,7 @@ remoteDispatchDomainGetSchedulerParametersFlags(virNe= tServerPtr server ATTRIBUTE goto cleanup; nparams =3D args->nparams; =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, @@ -2287,13 +2278,10 @@ remoteDispatchDomainMemoryStats(virNetServerPtr ser= ver ATTRIBUTE_UNUSED, int nr_stats; size_t i; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->maxStats > REMOTE_DOMAIN_MEMORY_STATS_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -2301,7 +2289,7 @@ remoteDispatchDomainMemoryStats(virNetServerPtr serve= r ATTRIBUTE_UNUSED, goto cleanup; } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 /* Allocate stats array for making dispatch call */ @@ -2346,15 +2334,12 @@ remoteDispatchDomainBlockPeek(virNetServerPtr serve= r ATTRIBUTE_UNUSED, size_t size; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; path =3D args->path; offset =3D args->offset; @@ -2400,15 +2385,12 @@ remoteDispatchDomainBlockStatsFlags(virNetServerPtr= server ATTRIBUTE_UNUSED, int nparams =3D 0; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; flags =3D args->flags; =20 @@ -2462,15 +2444,12 @@ remoteDispatchDomainMemoryPeek(virNetServerPtr serv= er ATTRIBUTE_UNUSED, size_t size; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; offset =3D args->offset; size =3D args->size; @@ -2512,15 +2491,12 @@ remoteDispatchDomainGetSecurityLabel(virNetServerPt= r server ATTRIBUTE_UNUSED, virDomainPtr dom =3D NULL; virSecurityLabelPtr seclabel =3D NULL; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (VIR_ALLOC(seclabel) < 0) @@ -2557,15 +2533,12 @@ remoteDispatchDomainGetSecurityLabelList(virNetServ= erPtr server ATTRIBUTE_UNUSED virSecurityLabelPtr seclabels =3D NULL; int len, rv =3D -1; size_t i; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if ((len =3D virDomainGetSecurityLabelList(dom, &seclabels)) < 0) { @@ -2611,16 +2584,13 @@ remoteDispatchNodeGetSecurityModel(virNetServerPtr = server ATTRIBUTE_UNUSED, { virSecurityModel secmodel; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 memset(&secmodel, 0, sizeof(secmodel)); - if (virNodeGetSecurityModel(priv->conn, &secmodel) < 0) + if (virNodeGetSecurityModel(conn, &secmodel) < 0) goto cleanup; =20 ret->model.model_len =3D strlen(secmodel.model) + 1; @@ -2653,15 +2623,12 @@ remoteDispatchDomainGetVcpuPinInfo(virNetServerPtr = server ATTRIBUTE_UNUSED, unsigned char *cpumaps =3D NULL; int num; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (args->ncpumaps > REMOTE_VCPUINFO_MAX) { @@ -2715,15 +2682,12 @@ remoteDispatchDomainPinEmulator(virNetServerPtr ser= ver ATTRIBUTE_UNUSED, { int rv =3D -1; virDomainPtr dom =3D NULL; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainPinEmulator(dom, @@ -2754,15 +2718,12 @@ remoteDispatchDomainGetEmulatorPinInfo(virNetServer= Ptr server ATTRIBUTE_UNUSED, unsigned char *cpumaps =3D NULL; int r; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 /* Allocate buffers to take the results */ @@ -2805,15 +2766,12 @@ remoteDispatchDomainGetVcpus(virNetServerPtr server= ATTRIBUTE_UNUSED, int info_len; size_t i; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (args->maxinfo > REMOTE_VCPUINFO_MAX) { @@ -2882,18 +2840,16 @@ remoteDispatchDomainGetIOThreadInfo(virNetServerPtr= server ATTRIBUTE_UNUSED, { int rv =3D -1; size_t i; - struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(= client); virDomainIOThreadInfoPtr *info =3D NULL; virDomainPtr dom =3D NULL; remote_domain_iothread_info *dst; int ninfo =3D 0; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if ((ninfo =3D virDomainGetIOThreadInfo(dom, &info, args->flags)) < 0) @@ -2958,13 +2914,10 @@ remoteDispatchDomainMigratePrepare(virNetServerPtr = server ATTRIBUTE_UNUSED, char **uri_out; char *dname; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 uri_in =3D args->uri_in =3D=3D NULL ? NULL : *args->uri_in; dname =3D args->dname =3D=3D NULL ? NULL : *args->dname; @@ -2973,7 +2926,7 @@ remoteDispatchDomainMigratePrepare(virNetServerPtr se= rver ATTRIBUTE_UNUSED, if (VIR_ALLOC(uri_out) < 0) goto cleanup; =20 - if (virDomainMigratePrepare(priv->conn, &cookie, &cookielen, + if (virDomainMigratePrepare(conn, &cookie, &cookielen, uri_in, uri_out, args->flags, dname, args->resource) < 0) goto cleanup; @@ -3013,13 +2966,10 @@ remoteDispatchDomainMigratePrepare2(virNetServerPtr= server ATTRIBUTE_UNUSED, char **uri_out; char *dname; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 uri_in =3D args->uri_in =3D=3D NULL ? NULL : *args->uri_in; dname =3D args->dname =3D=3D NULL ? NULL : *args->dname; @@ -3028,7 +2978,7 @@ remoteDispatchDomainMigratePrepare2(virNetServerPtr s= erver ATTRIBUTE_UNUSED, if (VIR_ALLOC(uri_out) < 0) goto cleanup; =20 - if (virDomainMigratePrepare2(priv->conn, &cookie, &cookielen, + if (virDomainMigratePrepare2(conn, &cookie, &cookielen, uri_in, uri_out, args->flags, dname, args->resource, args->dom_xml) < 0) @@ -3064,13 +3014,10 @@ remoteDispatchDomainGetMemoryParameters(virNetServe= rPtr server ATTRIBUTE_UNUSED, int nparams =3D 0; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 flags =3D args->flags; =20 @@ -3082,7 +3029,7 @@ remoteDispatchDomainGetMemoryParameters(virNetServerP= tr server ATTRIBUTE_UNUSED, goto cleanup; nparams =3D args->nparams; =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetMemoryParameters(dom, params, &nparams, flags) < 0) @@ -3126,13 +3073,10 @@ remoteDispatchDomainGetNumaParameters(virNetServerP= tr server ATTRIBUTE_UNUSED, int nparams =3D 0; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 flags =3D args->flags; =20 @@ -3144,7 +3088,7 @@ remoteDispatchDomainGetNumaParameters(virNetServerPtr= server ATTRIBUTE_UNUSED, goto cleanup; nparams =3D args->nparams; =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetNumaParameters(dom, params, &nparams, flags) < 0) @@ -3188,13 +3132,10 @@ remoteDispatchDomainGetBlkioParameters(virNetServer= Ptr server ATTRIBUTE_UNUSED, int nparams =3D 0; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 flags =3D args->flags; =20 @@ -3206,7 +3147,7 @@ remoteDispatchDomainGetBlkioParameters(virNetServerPt= r server ATTRIBUTE_UNUSED, goto cleanup; nparams =3D args->nparams; =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetBlkioParameters(dom, params, &nparams, flags) < 0) @@ -3251,13 +3192,10 @@ remoteDispatchNodeGetCPUStats(virNetServerPtr serve= r ATTRIBUTE_UNUSED, int nparams =3D 0; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 flags =3D args->flags; =20 @@ -3269,7 +3207,7 @@ remoteDispatchNodeGetCPUStats(virNetServerPtr server = ATTRIBUTE_UNUSED, goto cleanup; nparams =3D args->nparams; =20 - if (virNodeGetCPUStats(priv->conn, cpuNum, params, &nparams, flags) < = 0) + if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, flags) < 0) goto cleanup; =20 /* In this case, we need to send back the number of stats @@ -3323,13 +3261,10 @@ remoteDispatchNodeGetMemoryStats(virNetServerPtr se= rver ATTRIBUTE_UNUSED, int nparams =3D 0; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 flags =3D args->flags; =20 @@ -3341,7 +3276,7 @@ remoteDispatchNodeGetMemoryStats(virNetServerPtr serv= er ATTRIBUTE_UNUSED, goto cleanup; nparams =3D args->nparams; =20 - if (virNodeGetMemoryStats(priv->conn, cellNum, params, &nparams, flags= ) < 0) + if (virNodeGetMemoryStats(conn, cellNum, params, &nparams, flags) < 0) goto cleanup; =20 /* In this case, we need to send back the number of parameters @@ -3393,15 +3328,12 @@ remoteDispatchDomainGetLaunchSecurityInfo(virNetSer= verPtr server ATTRIBUTE_UNUSE virTypedParameterPtr params =3D NULL; int nparams =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetLaunchSecurityInfo(dom, ¶ms, &nparams, args->flags= ) < 0) @@ -3440,15 +3372,12 @@ remoteDispatchDomainGetPerfEvents(virNetServerPtr s= erver ATTRIBUTE_UNUSED, virTypedParameterPtr params =3D NULL; int nparams =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetPerfEvents(dom, ¶ms, &nparams, args->flags) < 0) @@ -3486,15 +3415,12 @@ remoteDispatchDomainGetBlockJobInfo(virNetServerPtr= server ATTRIBUTE_UNUSED, virDomainPtr dom =3D NULL; virDomainBlockJobInfo tmp; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 rv =3D virDomainGetBlockJobInfo(dom, args->path, &tmp, args->flags); @@ -3527,13 +3453,10 @@ remoteDispatchDomainGetBlockIoTune(virNetServerPtr = server ATTRIBUTE_UNUSED, int rv =3D -1; virTypedParameterPtr params =3D NULL; int nparams =3D 0; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->nparams > REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"= )); @@ -3544,7 +3467,7 @@ remoteDispatchDomainGetBlockIoTune(virNetServerPtr se= rver ATTRIBUTE_UNUSED, goto cleanup; nparams =3D args->nparams; =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetBlockIoTune(dom, args->disk ? *args->disk : NULL, @@ -4104,15 +4027,12 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr s= erver ATTRIBUTE_UNUSED, virNodeDevicePtr dev =3D NULL; const char *parent =3D NULL; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetNodeDevConn(client); =20 - if (!priv->nodedevConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dev =3D virNodeDeviceLookupByName(priv->nodedevConn, args->name)= )) + if (!(dev =3D virNodeDeviceLookupByName(conn, args->name))) goto cleanup; =20 parent =3D virNodeDeviceGetParent(dev); @@ -4144,15 +4064,14 @@ remoteDispatchConnectRegisterCloseCallback(virNetSe= rverPtr server ATTRIBUTE_UNUS int rv =3D -1; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (virConnectRegisterCloseCallback(priv->conn, + if (virConnectRegisterCloseCallback(conn, remoteRelayConnectionClosedEvent, client, NULL) < 0) goto cleanup; @@ -4176,15 +4095,14 @@ remoteDispatchConnectUnregisterCloseCallback(virNet= ServerPtr server ATTRIBUTE_UN int rv =3D -1; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (virConnectUnregisterCloseCallback(priv->conn, + if (virConnectUnregisterCloseCallback(conn, remoteRelayConnectionClosedEvent= ) < 0) goto cleanup; =20 @@ -4211,13 +4129,12 @@ remoteDispatchConnectDomainEventRegister(virNetServ= erPtr server ATTRIBUTE_UNUSED daemonClientEventCallbackPtr ref; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 /* If we call register first, we could append a complete callback * to our array, but on OOM append failure, we'd have to then hope @@ -4239,7 +4156,7 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server ATTRIBUTE_UNUSED callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectDomainEventRegisterAny(priv->conn, + if ((callbackID =3D virConnectDomainEventRegisterAny(conn, NULL, VIR_DOMAIN_EVENT_ID= _LIFECYCLE, VIR_DOMAIN_EVENT_CA= LLBACK(remoteRelayDomainEventLifecycle), @@ -4275,13 +4192,12 @@ remoteDispatchConnectDomainEventDeregister(virNetSe= rverPtr server ATTRIBUTE_UNUS size_t i; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 for (i =3D 0; i < priv->ndomainEventCallbacks; i++) { if (priv->domainEventCallbacks[i]->eventID =3D=3D VIR_DOMAIN_EVENT= _ID_LIFECYCLE) { @@ -4297,7 +4213,7 @@ remoteDispatchConnectDomainEventDeregister(virNetServ= erPtr server ATTRIBUTE_UNUS goto cleanup; } =20 - if (virConnectDomainEventDeregisterAny(priv->conn, callbackID) < 0) + if (virConnectDomainEventDeregisterAny(conn, callbackID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->domainEventCallbacks, i, @@ -4361,15 +4277,12 @@ remoteDispatchSecretGetValue(virNetServerPtr server= ATTRIBUTE_UNUSED, size_t value_size; unsigned char *value; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetSecretConn(client); =20 - if (!priv->secretConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(secret =3D get_nonnull_secret(priv->secretConn, args->secret))) + if (!(secret =3D get_nonnull_secret(conn, args->secret))) goto cleanup; =20 if (!(value =3D virSecretGetValue(secret, &value_size, args->flags))) @@ -4397,15 +4310,12 @@ remoteDispatchDomainGetState(virNetServerPtr server= ATTRIBUTE_UNUSED, { virDomainPtr dom =3D NULL; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetState(dom, &ret->state, &ret->reason, args->flags) < 0) @@ -4439,13 +4349,12 @@ remoteDispatchConnectDomainEventRegisterAny(virNetS= erverPtr server ATTRIBUTE_UNU daemonClientEventCallbackPtr ref; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 /* We intentionally do not use VIR_DOMAIN_EVENT_ID_LAST here; any * new domain events added after this point should only use the @@ -4475,7 +4384,7 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectDomainEventRegisterAny(priv->conn, + if ((callbackID =3D virConnectDomainEventRegisterAny(conn, NULL, args->eventID, domainEventCallback= s[args->eventID], @@ -4515,16 +4424,15 @@ remoteDispatchConnectDomainEventCallbackRegisterAny= (virNetServerPtr server ATTRI struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virDomainPtr dom =3D NULL; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->dom && - !(dom =3D get_nonnull_domain(priv->conn, *args->dom))) + !(dom =3D get_nonnull_domain(conn, *args->dom))) goto cleanup; =20 if (args->eventID >=3D VIR_DOMAIN_EVENT_ID_LAST || args->eventID < 0) { @@ -4550,7 +4458,7 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server ATTRI callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectDomainEventRegisterAny(priv->conn, + if ((callbackID =3D virConnectDomainEventRegisterAny(conn, dom, args->eventID, domainEventCallback= s[args->eventID], @@ -4589,13 +4497,12 @@ remoteDispatchConnectDomainEventDeregisterAny(virNe= tServerPtr server ATTRIBUTE_U size_t i; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 /* We intentionally do not use VIR_DOMAIN_EVENT_ID_LAST here; any * new domain events added after this point should only use the @@ -4619,7 +4526,7 @@ remoteDispatchConnectDomainEventDeregisterAny(virNetS= erverPtr server ATTRIBUTE_U goto cleanup; } =20 - if (virConnectDomainEventDeregisterAny(priv->conn, callbackID) < 0) + if (virConnectDomainEventDeregisterAny(conn, callbackID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->domainEventCallbacks, i, @@ -4646,13 +4553,12 @@ remoteDispatchConnectDomainEventCallbackDeregisterA= ny(virNetServerPtr server ATT size_t i; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 for (i =3D 0; i < priv->ndomainEventCallbacks; i++) { if (priv->domainEventCallbacks[i]->callbackID =3D=3D args->callbac= kID) @@ -4665,7 +4571,7 @@ remoteDispatchConnectDomainEventCallbackDeregisterAny= (virNetServerPtr server ATT goto cleanup; } =20 - if (virConnectDomainEventDeregisterAny(priv->conn, args->callbackID) <= 0) + if (virConnectDomainEventDeregisterAny(conn, args->callbackID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->domainEventCallbacks, i, @@ -4691,15 +4597,12 @@ qemuDispatchDomainMonitorCommand(virNetServerPtr se= rver ATTRIBUTE_UNUSED, { virDomainPtr dom =3D NULL; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainQemuMonitorCommand(dom, args->cmd, &ret->result, @@ -4731,15 +4634,12 @@ remoteDispatchDomainMigrateBegin3(virNetServerPtr s= erver ATTRIBUTE_UNUSED, char *cookieout =3D NULL; int cookieoutlen =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 xmlin =3D args->xmlin =3D=3D NULL ? NULL : *args->xmlin; @@ -4781,13 +4681,10 @@ remoteDispatchDomainMigratePrepare3(virNetServerPtr= server ATTRIBUTE_UNUSED, char **uri_out; char *dname; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 uri_in =3D args->uri_in =3D=3D NULL ? NULL : *args->uri_in; dname =3D args->dname =3D=3D NULL ? NULL : *args->dname; @@ -4796,7 +4693,7 @@ remoteDispatchDomainMigratePrepare3(virNetServerPtr s= erver ATTRIBUTE_UNUSED, if (VIR_ALLOC(uri_out) < 0) goto cleanup; =20 - if (virDomainMigratePrepare3(priv->conn, + if (virDomainMigratePrepare3(conn, args->cookie_in.cookie_in_val, args->cookie_in.cookie_in_len, &cookieout, &cookieoutlen, @@ -4839,15 +4736,12 @@ remoteDispatchDomainMigratePerform3(virNetServerPtr= server ATTRIBUTE_UNUSED, char *cookieout =3D NULL; int cookieoutlen =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 xmlin =3D args->xmlin =3D=3D NULL ? NULL : *args->xmlin; @@ -4892,18 +4786,15 @@ remoteDispatchDomainMigrateFinish3(virNetServerPtr = server ATTRIBUTE_UNUSED, char *uri; char *dconnuri; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 uri =3D args->uri =3D=3D NULL ? NULL : *args->uri; dconnuri =3D args->dconnuri =3D=3D NULL ? NULL : *args->dconnuri; =20 - if (!(dom =3D virDomainMigrateFinish3(priv->conn, args->dname, + if (!(dom =3D virDomainMigrateFinish3(conn, args->dname, args->cookie_in.cookie_in_val, args->cookie_in.cookie_in_len, &cookieout, &cookieoutlen, @@ -4941,15 +4832,12 @@ remoteDispatchDomainMigrateConfirm3(virNetServerPtr= server ATTRIBUTE_UNUSED, { virDomainPtr dom =3D NULL; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainMigrateConfirm3(dom, @@ -4977,8 +4865,7 @@ static int remoteDispatchConnectSupportsFeature(virNe= tServerPtr server ATTRIBUTE { int rv =3D -1; int supported =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D NULL; =20 /* This feature is checked before opening the connection, thus we must * check it first. @@ -4990,10 +4877,10 @@ static int remoteDispatchConnectSupportsFeature(vir= NetServerPtr server ATTRIBUTE goto done; } =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + conn =3D remoteGetHypervisorConn(client); + + if (!conn) goto cleanup; - } =20 switch ((virDrvFeature) args->feature) { case VIR_DRV_FEATURE_FD_PASSING: @@ -5013,7 +4900,7 @@ static int remoteDispatchConnectSupportsFeature(virNe= tServerPtr server ATTRIBUTE case VIR_DRV_FEATURE_MIGRATION_OFFLINE: case VIR_DRV_FEATURE_MIGRATION_PARAMS: default: - if ((supported =3D virConnectSupportsFeature(priv->conn, args->fea= ture)) < 0) + if ((supported =3D virConnectSupportsFeature(conn, args->feature))= < 0) goto cleanup; break; case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: @@ -5042,15 +4929,12 @@ remoteDispatchDomainOpenGraphics(virNetServerPtr se= rver ATTRIBUTE_UNUSED, virDomainPtr dom =3D NULL; int rv =3D -1; int fd =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if ((fd =3D virNetMessageDupFD(msg, 0)) < 0) @@ -5083,15 +4967,12 @@ remoteDispatchDomainOpenGraphicsFd(virNetServerPtr = server ATTRIBUTE_UNUSED, virDomainPtr dom =3D NULL; int rv =3D -1; int fd =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if ((fd =3D virDomainOpenGraphicsFD(dom, @@ -5130,13 +5011,10 @@ remoteDispatchDomainGetInterfaceParameters(virNetSe= rverPtr server ATTRIBUTE_UNUS int nparams =3D 0; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 flags =3D args->flags; =20 @@ -5148,7 +5026,7 @@ remoteDispatchDomainGetInterfaceParameters(virNetServ= erPtr server ATTRIBUTE_UNUS goto cleanup; nparams =3D args->nparams; =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetInterfaceParameters(dom, device, params, &nparams, fla= gs) < 0) @@ -5188,16 +5066,13 @@ remoteDispatchDomainGetCPUStats(virNetServerPtr ser= ver ATTRIBUTE_UNUSED, remote_domain_get_cpu_stats_ret *ret) { virDomainPtr dom =3D NULL; - struct daemonClientPrivate *priv; virTypedParameterPtr params =3D NULL; int rv =3D -1; int percpu_len =3D 0; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - priv =3D virNetServerClientGetPrivateData(client); - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->nparams > REMOTE_NODE_CPU_STATS_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"= )); @@ -5212,7 +5087,7 @@ remoteDispatchDomainGetCPUStats(virNetServerPtr serve= r ATTRIBUTE_UNUSED, VIR_ALLOC_N(params, args->ncpus * args->nparams) < 0) goto cleanup; =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 percpu_len =3D virDomainGetCPUStats(dom, params, args->nparams, @@ -5262,15 +5137,12 @@ remoteDispatchDomainGetDiskErrors(virNetServerPtr s= erver ATTRIBUTE_UNUSED, virDomainPtr dom =3D NULL; virDomainDiskErrorPtr errors =3D NULL; int len =3D 0; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (args->maxerrors > REMOTE_DOMAIN_DISK_ERRORS_MAX) { @@ -5322,15 +5194,12 @@ remoteDispatchNodeGetSevInfo(virNetServerPtr server= ATTRIBUTE_UNUSED, virTypedParameterPtr params =3D NULL; int nparams =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (virNodeGetSEVInfo(priv->conn, ¶ms, &nparams, args->flags) < 0) + if (virNodeGetSEVInfo(conn, ¶ms, &nparams, args->flags) < 0) goto cleanup; =20 if (nparams > REMOTE_NODE_SEV_INFO_MAX) { @@ -5367,13 +5236,10 @@ remoteDispatchNodeGetMemoryParameters(virNetServerP= tr server ATTRIBUTE_UNUSED, int nparams =3D 0; unsigned int flags; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 flags =3D args->flags; =20 @@ -5385,7 +5251,7 @@ remoteDispatchNodeGetMemoryParameters(virNetServerPtr= server ATTRIBUTE_UNUSED, goto cleanup; nparams =3D args->nparams; =20 - if (virNodeGetMemoryParameters(priv->conn, params, &nparams, flags) < = 0) + if (virNodeGetMemoryParameters(conn, params, &nparams, flags) < 0) goto cleanup; =20 /* In this case, we need to send back the number of parameters @@ -5425,17 +5291,14 @@ remoteDispatchNodeGetCPUMap(virNetServerPtr server = ATTRIBUTE_UNUSED, unsigned int flags; int cpunum; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 flags =3D args->flags; =20 - cpunum =3D virNodeGetCPUMap(priv->conn, args->need_map ? &cpumap : NUL= L, + cpunum =3D virNodeGetCPUMap(conn, args->need_map ? &cpumap : NULL, args->need_online ? &online : NULL, flags); if (cpunum < 0) goto cleanup; @@ -5467,19 +5330,16 @@ lxcDispatchDomainOpenNamespace(virNetServerPtr serv= er ATTRIBUTE_UNUSED, lxc_domain_open_namespace_args *args) { int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); int *fdlist =3D NULL; int ret; virDomainPtr dom =3D NULL; size_t i; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 ret =3D virDomainLxcOpenNamespace(dom, @@ -5521,15 +5381,12 @@ remoteDispatchDomainGetJobStats(virNetServerPtr ser= ver ATTRIBUTE_UNUSED, virTypedParameterPtr params =3D NULL; int nparams =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetJobStats(dom, &ret->type, ¶ms, @@ -5574,13 +5431,10 @@ remoteDispatchDomainMigrateBegin3Params(virNetServe= rPtr server ATTRIBUTE_UNUSED, char *cookieout =3D NULL; int cookieoutlen =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) { virReportError(VIR_ERR_RPC, @@ -5589,7 +5443,7 @@ remoteDispatchDomainMigrateBegin3Params(virNetServerP= tr server ATTRIBUTE_UNUSED, goto cleanup; } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->param= s.params_val, @@ -5630,13 +5484,10 @@ remoteDispatchDomainMigratePrepare3Params(virNetSer= verPtr server ATTRIBUTE_UNUSE int cookieoutlen =3D 0; char **uri_out; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) { virReportError(VIR_ERR_RPC, @@ -5654,7 +5505,7 @@ remoteDispatchDomainMigratePrepare3Params(virNetServe= rPtr server ATTRIBUTE_UNUSE if (VIR_ALLOC(uri_out) < 0) goto cleanup; =20 - if (virDomainMigratePrepare3Params(priv->conn, params, nparams, + if (virDomainMigratePrepare3Params(conn, params, nparams, args->cookie_in.cookie_in_val, args->cookie_in.cookie_in_len, &cookieout, &cookieoutlen, @@ -5689,15 +5540,12 @@ remoteDispatchDomainMigratePrepareTunnel3Params(vir= NetServerPtr server ATTRIBUTE char *cookieout =3D NULL; int cookieoutlen =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); virStreamPtr st =3D NULL; daemonClientStreamPtr stream =3D NULL; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) { virReportError(VIR_ERR_RPC, @@ -5711,12 +5559,12 @@ remoteDispatchDomainMigratePrepareTunnel3Params(vir= NetServerPtr server ATTRIBUTE 0, ¶ms, &nparams) < 0) goto cleanup; =20 - if (!(st =3D virStreamNew(priv->conn, VIR_STREAM_NONBLOCK)) || + if (!(st =3D virStreamNew(conn, VIR_STREAM_NONBLOCK)) || !(stream =3D daemonCreateClientStream(client, st, remoteProgram, &msg->header, false))) goto cleanup; =20 - if (virDomainMigratePrepareTunnel3Params(priv->conn, st, params, npara= ms, + if (virDomainMigratePrepareTunnel3Params(conn, st, params, nparams, args->cookie_in.cookie_in_val, args->cookie_in.cookie_in_len, &cookieout, &cookieoutlen, @@ -5761,13 +5609,10 @@ remoteDispatchDomainMigratePerform3Params(virNetSer= verPtr server ATTRIBUTE_UNUSE int cookieoutlen =3D 0; char *dconnuri; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) { virReportError(VIR_ERR_RPC, @@ -5776,7 +5621,7 @@ remoteDispatchDomainMigratePerform3Params(virNetServe= rPtr server ATTRIBUTE_UNUSE goto cleanup; } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->param= s.params_val, @@ -5821,13 +5666,10 @@ remoteDispatchDomainMigrateFinish3Params(virNetServ= erPtr server ATTRIBUTE_UNUSED char *cookieout =3D NULL; int cookieoutlen =3D 0; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) { virReportError(VIR_ERR_RPC, @@ -5841,7 +5683,7 @@ remoteDispatchDomainMigrateFinish3Params(virNetServer= Ptr server ATTRIBUTE_UNUSED 0, ¶ms, &nparams) < 0) goto cleanup; =20 - dom =3D virDomainMigrateFinish3Params(priv->conn, params, nparams, + dom =3D virDomainMigrateFinish3Params(conn, params, nparams, args->cookie_in.cookie_in_val, args->cookie_in.cookie_in_len, &cookieout, &cookieoutlen, @@ -5879,13 +5721,10 @@ remoteDispatchDomainMigrateConfirm3Params(virNetSer= verPtr server ATTRIBUTE_UNUSE int nparams =3D 0; virDomainPtr dom =3D NULL; int rv =3D -1; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) { virReportError(VIR_ERR_RPC, @@ -5894,7 +5733,7 @@ remoteDispatchDomainMigrateConfirm3Params(virNetServe= rPtr server ATTRIBUTE_UNUSE goto cleanup; } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->param= s.params_val, @@ -5929,15 +5768,12 @@ remoteDispatchConnectGetCPUModelNames(virNetServerP= tr server ATTRIBUTE_UNUSED, { int len, rv =3D -1; char **models =3D NULL; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - len =3D virConnectGetCPUModelNames(priv->conn, args->arch, + len =3D virConnectGetCPUModelNames(conn, args->arch, args->need_results ? &models : NULL, args->flags); if (len < 0) @@ -5981,16 +5817,13 @@ remoteDispatchDomainCreateXMLWithFiles(virNetServer= Ptr server ATTRIBUTE_UNUSED, { int rv =3D -1; virDomainPtr dom =3D NULL; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); int *files =3D NULL; unsigned int nfiles =3D 0; size_t i; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (VIR_ALLOC_N(files, msg->nfds) < 0) goto cleanup; @@ -6000,7 +5833,7 @@ remoteDispatchDomainCreateXMLWithFiles(virNetServerPt= r server ATTRIBUTE_UNUSED, nfiles++; } =20 - if ((dom =3D virDomainCreateXMLWithFiles(priv->conn, args->xml_desc, + if ((dom =3D virDomainCreateXMLWithFiles(conn, args->xml_desc, nfiles, files, args->flags)) =3D=3D NULL) goto cleanup; @@ -6030,16 +5863,13 @@ static int remoteDispatchDomainCreateWithFiles(virN= etServerPtr server ATTRIBUTE_ { int rv =3D -1; virDomainPtr dom =3D NULL; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); int *files =3D NULL; unsigned int nfiles =3D 0; size_t i; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (VIR_ALLOC_N(files, msg->nfds) < 0) goto cleanup; @@ -6049,7 +5879,7 @@ static int remoteDispatchDomainCreateWithFiles(virNet= ServerPtr server ATTRIBUTE_ nfiles++; } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainCreateWithFiles(dom, @@ -6085,19 +5915,18 @@ remoteDispatchConnectNetworkEventRegisterAny(virNet= ServerPtr server ATTRIBUTE_UN int rv =3D -1; daemonClientEventCallbackPtr callback =3D NULL; daemonClientEventCallbackPtr ref; + virNetworkPtr net =3D NULL; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); - virNetworkPtr net =3D NULL; + virConnectPtr conn =3D remoteGetNetworkConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->networkConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->net && - !(net =3D get_nonnull_network(priv->networkConn, *args->net))) + !(net =3D get_nonnull_network(conn, *args->net))) goto cleanup; =20 if (args->eventID >=3D VIR_NETWORK_EVENT_ID_LAST || args->eventID < 0)= { @@ -6123,7 +5952,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server ATTRIBUTE_UN callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectNetworkEventRegisterAny(priv->networkCon= n, + if ((callbackID =3D virConnectNetworkEventRegisterAny(conn, net, args->eventID, networkEventCallba= cks[args->eventID], @@ -6161,13 +5990,12 @@ remoteDispatchConnectNetworkEventDeregisterAny(virN= etServerPtr server ATTRIBUTE_ size_t i; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetNetworkConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->networkConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 for (i =3D 0; i < priv->nnetworkEventCallbacks; i++) { if (priv->networkEventCallbacks[i]->callbackID =3D=3D args->callba= ckID) @@ -6180,7 +6008,7 @@ remoteDispatchConnectNetworkEventDeregisterAny(virNet= ServerPtr server ATTRIBUTE_ goto cleanup; } =20 - if (virConnectNetworkEventDeregisterAny(priv->networkConn, args->callb= ackID) < 0) + if (virConnectNetworkEventDeregisterAny(conn, args->callbackID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->networkEventCallbacks, i, @@ -6210,16 +6038,15 @@ remoteDispatchConnectStoragePoolEventRegisterAny(vi= rNetServerPtr server ATTRIBUT struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virStoragePoolPtr pool =3D NULL; + virConnectPtr conn =3D remoteGetStorageConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->storageConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->pool && - !(pool =3D get_nonnull_storage_pool(priv->storageConn, *args->pool= ))) + !(pool =3D get_nonnull_storage_pool(conn, *args->pool))) goto cleanup; =20 if (args->eventID >=3D VIR_STORAGE_POOL_EVENT_ID_LAST || args->eventID= < 0) { @@ -6245,7 +6072,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server ATTRIBUT callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectStoragePoolEventRegisterAny(priv->storag= eConn, + if ((callbackID =3D virConnectStoragePoolEventRegisterAny(conn, pool, args->eventID, storageEventCa= llbacks[args->eventID], @@ -6282,13 +6109,12 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(= virNetServerPtr server ATTRIB size_t i; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetStorageConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->storageConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 for (i =3D 0; i < priv->nstorageEventCallbacks; i++) { if (priv->storageEventCallbacks[i]->callbackID =3D=3D args->callba= ckID) @@ -6301,7 +6127,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(vi= rNetServerPtr server ATTRIB goto cleanup; } =20 - if (virConnectStoragePoolEventDeregisterAny(priv->storageConn, args->c= allbackID) < 0) + if (virConnectStoragePoolEventDeregisterAny(conn, args->callbackID) < = 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->storageEventCallbacks, i, @@ -6331,16 +6157,15 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(vir= NetServerPtr server ATTRIBUTE struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virNodeDevicePtr dev =3D NULL; + virConnectPtr conn =3D remoteGetNodeDevConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->nodedevConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->dev && - !(dev =3D get_nonnull_node_device(priv->nodedevConn, *args->dev))) + !(dev =3D get_nonnull_node_device(conn, *args->dev))) goto cleanup; =20 if (args->eventID >=3D VIR_NODE_DEVICE_EVENT_ID_LAST || args->eventID = < 0) { @@ -6366,7 +6191,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server ATTRIBUTE callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectNodeDeviceEventRegisterAny(priv->nodedev= Conn, + if ((callbackID =3D virConnectNodeDeviceEventRegisterAny(conn, dev, args->eventID, nodeDeviceEvent= Callbacks[args->eventID], @@ -6403,13 +6228,12 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(v= irNetServerPtr server ATTRIBU size_t i; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetNodeDevConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->nodedevConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 for (i =3D 0; i < priv->nnodeDeviceEventCallbacks; i++) { if (priv->nodeDeviceEventCallbacks[i]->callbackID =3D=3D args->cal= lbackID) @@ -6422,7 +6246,7 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(vir= NetServerPtr server ATTRIBU goto cleanup; } =20 - if (virConnectNodeDeviceEventDeregisterAny(priv->nodedevConn, args->ca= llbackID) < 0) + if (virConnectNodeDeviceEventDeregisterAny(conn, args->callbackID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->nodeDeviceEventCallbacks, i, @@ -6452,16 +6276,15 @@ remoteDispatchConnectSecretEventRegisterAny(virNetS= erverPtr server ATTRIBUTE_UNU struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virSecretPtr secret =3D NULL; + virConnectPtr conn =3D remoteGetSecretConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->secretConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->secret && - !(secret =3D get_nonnull_secret(priv->secretConn, *args->secret))) + !(secret =3D get_nonnull_secret(conn, *args->secret))) goto cleanup; =20 if (args->eventID >=3D VIR_SECRET_EVENT_ID_LAST || args->eventID < 0) { @@ -6487,7 +6310,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectSecretEventRegisterAny(priv->secretConn, + if ((callbackID =3D virConnectSecretEventRegisterAny(conn, secret, args->eventID, secretEventCallback= s[args->eventID], @@ -6524,13 +6347,12 @@ remoteDispatchConnectSecretEventDeregisterAny(virNe= tServerPtr server ATTRIBUTE_U size_t i; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetSecretConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->secretConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 for (i =3D 0; i < priv->nsecretEventCallbacks; i++) { if (priv->secretEventCallbacks[i]->callbackID =3D=3D args->callbac= kID) @@ -6543,7 +6365,7 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetS= erverPtr server ATTRIBUTE_U goto cleanup; } =20 - if (virConnectSecretEventDeregisterAny(priv->secretConn, args->callbac= kID) < 0) + if (virConnectSecretEventDeregisterAny(conn, args->callbackID) < 0) goto cleanup; =20 VIR_DELETE_ELEMENT(priv->secretEventCallbacks, i, @@ -6574,16 +6396,15 @@ qemuDispatchConnectDomainMonitorEventRegister(virNe= tServerPtr server ATTRIBUTE_U virNetServerClientGetPrivateData(client); virDomainPtr dom =3D NULL; const char *event =3D args->event ? *args->event : NULL; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->dom && - !(dom =3D get_nonnull_domain(priv->conn, *args->dom))) + !(dom =3D get_nonnull_domain(conn, *args->dom))) goto cleanup; =20 /* If we call register first, we could append a complete callback @@ -6603,7 +6424,7 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server ATTRIBUTE_U callback) < 0) goto cleanup; =20 - if ((callbackID =3D virConnectDomainQemuMonitorEventRegister(priv->con= n, + if ((callbackID =3D virConnectDomainQemuMonitorEventRegister(conn, dom, event, remoteRelay= DomainQemuMonitorEvent, @@ -6642,13 +6463,12 @@ qemuDispatchConnectDomainMonitorEventDeregister(vir= NetServerPtr server ATTRIBUTE size_t i; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 virMutexLock(&priv->lock); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 for (i =3D 0; i < priv->nqemuEventCallbacks; i++) { if (priv->qemuEventCallbacks[i]->callbackID =3D=3D args->callbackI= D) @@ -6661,7 +6481,7 @@ qemuDispatchConnectDomainMonitorEventDeregister(virNe= tServerPtr server ATTRIBUTE goto cleanup; } =20 - if (virConnectDomainQemuMonitorEventDeregister(priv->conn, + if (virConnectDomainQemuMonitorEventDeregister(conn, args->callbackID) < 0) goto cleanup; =20 @@ -6689,15 +6509,12 @@ remoteDispatchDomainGetTime(virNetServerPtr server = ATTRIBUTE_UNUSED, virDomainPtr dom =3D NULL; long long seconds; unsigned int nseconds; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if (virDomainGetTime(dom, &seconds, &nseconds, args->flags) < 0) @@ -6725,13 +6542,10 @@ remoteDispatchNodeGetFreePages(virNetServerPtr serv= er ATTRIBUTE_UNUSED, { int rv =3D -1; int len; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->pages.pages_len * args->cellCount > REMOTE_NODE_MAX_CELLS) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -6744,7 +6558,7 @@ remoteDispatchNodeGetFreePages(virNetServerPtr server= ATTRIBUTE_UNUSED, args->pages.pages_len * args->cellCount) < 0) goto cleanup; =20 - if ((len =3D virNodeGetFreePages(priv->conn, + if ((len =3D virNodeGetFreePages(conn, args->pages.pages_len, args->pages.pages_val, args->startCell, @@ -6838,17 +6652,15 @@ remoteDispatchNetworkGetDHCPLeases(virNetServerPtr = server ATTRIBUTE_UNUSED, { int rv =3D -1; size_t i; - struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(= client); virNetworkDHCPLeasePtr *leases =3D NULL; virNetworkPtr net =3D NULL; int nleases =3D 0; + virConnectPtr conn =3D remoteGetNetworkConn(client); =20 - if (!priv->networkConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(net =3D get_nonnull_network(priv->networkConn, args->net))) + if (!(net =3D get_nonnull_network(conn, args->net))) goto cleanup; =20 if ((nleases =3D virNetworkGetDHCPLeases(net, @@ -6906,22 +6718,20 @@ remoteDispatchConnectGetAllDomainStats(virNetServer= Ptr server ATTRIBUTE_UNUSED, { int rv =3D -1; size_t i; - struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(= client); virDomainStatsRecordPtr *retStats =3D NULL; int nrecords =3D 0; virDomainPtr *doms =3D NULL; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 if (args->doms.doms_len) { if (VIR_ALLOC_N(doms, args->doms.doms_len + 1) < 0) goto cleanup; =20 for (i =3D 0; i < args->doms.doms_len; i++) { - if (!(doms[i] =3D get_nonnull_domain(priv->conn, args->doms.do= ms_val[i]))) + if (!(doms[i] =3D get_nonnull_domain(conn, args->doms.doms_val= [i]))) goto cleanup; } =20 @@ -6931,7 +6741,7 @@ remoteDispatchConnectGetAllDomainStats(virNetServerPt= r server ATTRIBUTE_UNUSED, args->flags)) < 0) goto cleanup; } else { - if ((nrecords =3D virConnectGetAllDomainStats(priv->conn, + if ((nrecords =3D virConnectGetAllDomainStats(conn, args->stats, &retStats, args->flags)) < 0) @@ -6993,15 +6803,12 @@ remoteDispatchNodeAllocPages(virNetServerPtr server= ATTRIBUTE_UNUSED, { int rv =3D -1; int len; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if ((len =3D virNodeAllocPages(priv->conn, + if ((len =3D virNodeAllocPages(conn, args->pageSizes.pageSizes_len, args->pageSizes.pageSizes_val, (unsigned long long *) args->pageCounts.p= ageCounts_val, @@ -7030,19 +6837,17 @@ remoteDispatchDomainGetFSInfo(virNetServerPtr serve= r ATTRIBUTE_UNUSED, { int rv =3D -1; size_t i, j; - struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(= client); virDomainFSInfoPtr *info =3D NULL; virDomainPtr dom =3D NULL; remote_domain_fsinfo *dst; int ninfo =3D 0; size_t ndisk; + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if ((ninfo =3D virDomainGetFSInfo(dom, &info, args->flags)) < 0) @@ -7227,15 +7032,12 @@ remoteDispatchDomainInterfaceAddresses(virNetServer= Ptr server ATTRIBUTE_UNUSED, virDomainPtr dom =3D NULL; virDomainInterfacePtr *ifaces =3D NULL; int ifaces_count =3D 0; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetHypervisorConn(client); =20 - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + if (!(dom =3D get_nonnull_domain(conn, args->dom))) goto cleanup; =20 if ((ifaces_count =3D virDomainInterfaceAddresses(dom, &ifaces, args->= source, args->flags)) < 0) @@ -7273,15 +7075,12 @@ remoteDispatchStorageVolGetInfoFlags(virNetServerPt= r server ATTRIBUTE_UNUSED, int rv =3D -1; virStorageVolPtr vol =3D NULL; virStorageVolInfo tmp; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetStorageConn(client); =20 - if (!priv->storageConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(vol =3D get_nonnull_storage_vol(priv->storageConn, args->vol))) + if (!(vol =3D get_nonnull_storage_vol(conn, args->vol))) goto cleanup; =20 if (virStorageVolGetInfoFlags(vol, &tmp, args->flags) < 0) @@ -7312,15 +7111,12 @@ remoteDispatchNetworkPortGetParameters(virNetServer= Ptr server ATTRIBUTE_UNUSED, virNetworkPortPtr port =3D NULL; virTypedParameterPtr params =3D NULL; int nparams =3D 0; - struct daemonClientPrivate *priv =3D - virNetServerClientGetPrivateData(client); + virConnectPtr conn =3D remoteGetNetworkConn(client); =20 - if (!priv->networkConn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + if (!conn) goto cleanup; - } =20 - if (!(port =3D get_nonnull_network_port(priv->networkConn, args->port)= )) + if (!(port =3D get_nonnull_network_port(conn, args->port))) goto cleanup; =20 if (virNetworkPortGetParameters(port, ¶ms, &nparams, args->flags) = < 0) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list