From nobody Fri Apr 26 22:00:38 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 1520511695333573.1227333817267; Thu, 8 Mar 2018 04:21:35 -0800 (PST) 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 BABDC3683B; Thu, 8 Mar 2018 12:21:33 +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 4B4BD17F4D; Thu, 8 Mar 2018 12:21:33 +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 A5BC0180BAEE; Thu, 8 Mar 2018 12:21:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLItO017019 for ; Thu, 8 Mar 2018 07:21:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id DDE865C57B; Thu, 8 Mar 2018 12:21:18 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D10CB5C25F for ; Thu, 8 Mar 2018 12:21:17 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C31BD3683B for ; Thu, 8 Mar 2018 12:21:16 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL84k041677 for ; Thu, 8 Mar 2018 07:21:16 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk495t52e-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:15 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:20:50 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:47 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKk0u56819712 for ; Thu, 8 Mar 2018 12:20:46 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73946A4055 for ; Thu, 8 Mar 2018 12:13:42 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 52CA5A4051 for ; Thu, 8 Mar 2018 12:13:42 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:42 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:24 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0016-0000-0000-0000052E5E16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0017-0000-0000-0000286B7DB0 Message-Id: <20180308122043.15608-2-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Mar 2018 12:21:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Mar 2018 12:21:16 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/20] driver: Add typedef for the anonymous enum used for driver features 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: , MIME-Version: 1.0 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.30]); Thu, 08 Mar 2018 12:21:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add typedef for the anonymous enum used for the driver features. This allows the usage of the type in a switch statement and taking advantage of the compilers feature to detect uncovered cases. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/esx/esx_driver.c | 18 ++++++++++++++++-- src/libvirt_internal.h | 4 ++-- src/libxl/libxl_driver.c | 13 ++++++++++++- src/lxc/lxc_driver.c | 24 +++++++++++++++++++----- src/openvz/openvz_driver.c | 15 ++++++++++++++- src/qemu/qemu_driver.c | 8 +++++++- src/remote/remote_daemon_dispatch.c | 19 ++++++++++++++++--- src/vz/vz_driver.c | 15 ++++++++++++++- src/xen/xen_driver.c | 15 ++++++++++++++- 9 files changed, 114 insertions(+), 17 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index b065cdc51323..927267f1cc98 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -1122,7 +1122,7 @@ esxConnectSupportsFeature(virConnectPtr conn, int fea= ture) esxPrivate *priv =3D conn->privateData; esxVI_Boolean supportsVMotion =3D esxVI_Boolean_Undefined; =20 - switch (feature) { + switch ((virDrvFeature) feature) { case VIR_DRV_FEATURE_MIGRATION_V1: supportsVMotion =3D esxSupportsVMotion(priv); =20 @@ -1133,7 +1133,21 @@ esxConnectSupportsFeature(virConnectPtr conn, int fe= ature) return priv->vCenter && supportsVMotion =3D=3D esxVI_Boolean_True ? 1 : 0; =20 - default: + case VIR_DRV_FEATURE_FD_PASSING: + case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: + case VIR_DRV_FEATURE_MIGRATION_DIRECT: + case VIR_DRV_FEATURE_MIGRATION_OFFLINE: + case VIR_DRV_FEATURE_MIGRATION_P2P: + case VIR_DRV_FEATURE_MIGRATION_PARAMS: + case VIR_DRV_FEATURE_MIGRATION_V2: + case VIR_DRV_FEATURE_MIGRATION_V3: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_XML_MIGRATABLE: + default: return 0; } } diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h index 62f490a7dfd5..0e008a65518d 100644 --- a/src/libvirt_internal.h +++ b/src/libvirt_internal.h @@ -45,7 +45,7 @@ int virStateStop(void); * feature. Queries for VIR_DRV_FEATURE_PROGRAM* features are answered * directly by the RPC layer and not by the real driver. */ -enum { +typedef enum { /* Driver supports V1-style virDomainMigrate, ie. domainMigratePrepare/ * domainMigratePerform/domainMigrateFinish. */ @@ -123,7 +123,7 @@ enum { * Support for driver close callback rpc */ VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK =3D 15, -}; +} virDrvFeature; =20 =20 int virConnectSupportsFeature(virConnectPtr conn, int feature); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index c3616a86d7f4..562966cc2062 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -5684,12 +5684,23 @@ libxlConnectSupportsFeature(virConnectPtr conn, int= feature) if (virConnectSupportsFeatureEnsureACL(conn) < 0) return -1; =20 - switch (feature) { + switch ((virDrvFeature) feature) { case VIR_DRV_FEATURE_MIGRATION_V3: case VIR_DRV_FEATURE_TYPED_PARAM_STRING: case VIR_DRV_FEATURE_MIGRATION_PARAMS: case VIR_DRV_FEATURE_MIGRATION_P2P: return 1; + case VIR_DRV_FEATURE_FD_PASSING: + case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: + case VIR_DRV_FEATURE_MIGRATION_DIRECT: + case VIR_DRV_FEATURE_MIGRATION_OFFLINE: + case VIR_DRV_FEATURE_MIGRATION_V1: + case VIR_DRV_FEATURE_MIGRATION_V2: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_XML_MIGRATABLE: default: return 0; } diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index fa6fc4643ee2..4f6b93bdbd30 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1793,11 +1793,25 @@ lxcConnectSupportsFeature(virConnectPtr conn, int f= eature) if (virConnectSupportsFeatureEnsureACL(conn) < 0) return -1; =20 - switch (feature) { - case VIR_DRV_FEATURE_TYPED_PARAM_STRING: - return 1; - default: - return 0; + switch ((virDrvFeature) feature) { + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + return 1; + case VIR_DRV_FEATURE_FD_PASSING: + case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: + case VIR_DRV_FEATURE_MIGRATION_DIRECT: + case VIR_DRV_FEATURE_MIGRATION_OFFLINE: + case VIR_DRV_FEATURE_MIGRATION_P2P: + case VIR_DRV_FEATURE_MIGRATION_PARAMS: + case VIR_DRV_FEATURE_MIGRATION_V1: + case VIR_DRV_FEATURE_MIGRATION_V2: + case VIR_DRV_FEATURE_MIGRATION_V3: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_XML_MIGRATABLE: + default: + return 0; } } =20 diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 9bd73d85c49f..312cac35a3c3 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -2204,10 +2204,23 @@ openvzNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UN= USED, static int openvzConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int feat= ure) { - switch (feature) { + switch ((virDrvFeature) feature) { case VIR_DRV_FEATURE_MIGRATION_PARAMS: case VIR_DRV_FEATURE_MIGRATION_V3: return 1; + case VIR_DRV_FEATURE_FD_PASSING: + case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: + case VIR_DRV_FEATURE_MIGRATION_DIRECT: + case VIR_DRV_FEATURE_MIGRATION_OFFLINE: + case VIR_DRV_FEATURE_MIGRATION_P2P: + case VIR_DRV_FEATURE_MIGRATION_V1: + case VIR_DRV_FEATURE_MIGRATION_V2: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_XML_MIGRATABLE: default: return 0; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9e715e7a00d4..874cb46981a3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1206,7 +1206,7 @@ qemuConnectSupportsFeature(virConnectPtr conn, int fe= ature) if (virConnectSupportsFeatureEnsureACL(conn) < 0) return -1; =20 - switch (feature) { + switch ((virDrvFeature) feature) { case VIR_DRV_FEATURE_MIGRATION_V2: case VIR_DRV_FEATURE_MIGRATION_V3: case VIR_DRV_FEATURE_MIGRATION_P2P: @@ -1217,6 +1217,12 @@ qemuConnectSupportsFeature(virConnectPtr conn, int f= eature) case VIR_DRV_FEATURE_MIGRATION_OFFLINE: case VIR_DRV_FEATURE_MIGRATION_PARAMS: return 1; + case VIR_DRV_FEATURE_MIGRATION_DIRECT: + case VIR_DRV_FEATURE_MIGRATION_V1: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: default: return 0; } diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index ea67cb7bc018..82f6400ca49d 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -4645,7 +4645,7 @@ static int remoteDispatchConnectSupportsFeature(virNe= tServerPtr server ATTRIBUTE remote_connect_supports_fe= ature_ret *ret) { int rv =3D -1; - int supported; + int supported =3D -1; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 @@ -4664,17 +4664,30 @@ static int remoteDispatchConnectSupportsFeature(vir= NetServerPtr server ATTRIBUTE goto cleanup; } =20 - switch (args->feature) { + switch ((virDrvFeature) args->feature) { case VIR_DRV_FEATURE_FD_PASSING: case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: supported =3D 1; break; - + case VIR_DRV_FEATURE_MIGRATION_V1: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_MIGRATION_V2: + case VIR_DRV_FEATURE_MIGRATION_P2P: + case VIR_DRV_FEATURE_MIGRATION_DIRECT: + case VIR_DRV_FEATURE_MIGRATION_V3: + case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_XML_MIGRATABLE: + case VIR_DRV_FEATURE_MIGRATION_OFFLINE: + case VIR_DRV_FEATURE_MIGRATION_PARAMS: default: if ((supported =3D virConnectSupportsFeature(priv->conn, args->fea= ture)) < 0) goto cleanup; break; + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + /* should not be possible! */ + goto cleanup; } =20 done: diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 6d02ef274fec..a425bc85529d 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -3079,10 +3079,23 @@ vzConnectSupportsFeature(virConnectPtr conn ATTRIBU= TE_UNUSED, int feature) if (virConnectSupportsFeatureEnsureACL(conn) < 0) return -1; =20 - switch (feature) { + switch ((virDrvFeature) feature) { case VIR_DRV_FEATURE_MIGRATION_PARAMS: case VIR_DRV_FEATURE_MIGRATION_P2P: return 1; + case VIR_DRV_FEATURE_FD_PASSING: + case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: + case VIR_DRV_FEATURE_MIGRATION_DIRECT: + case VIR_DRV_FEATURE_MIGRATION_OFFLINE: + case VIR_DRV_FEATURE_MIGRATION_V1: + case VIR_DRV_FEATURE_MIGRATION_V2: + case VIR_DRV_FEATURE_MIGRATION_V3: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_XML_MIGRATABLE: default: return 0; } diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index f521fd1f2c03..85c3424b11ed 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -619,10 +619,23 @@ xenUnifiedConnectSupportsFeature(virConnectPtr conn, = int feature) if (virConnectSupportsFeatureEnsureACL(conn) < 0) return -1; =20 - switch (feature) { + switch ((virDrvFeature) feature) { case VIR_DRV_FEATURE_MIGRATION_V1: case VIR_DRV_FEATURE_MIGRATION_DIRECT: return 1; + case VIR_DRV_FEATURE_MIGRATION_V2: + case VIR_DRV_FEATURE_MIGRATION_V3: + case VIR_DRV_FEATURE_MIGRATION_P2P: + case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: + case VIR_DRV_FEATURE_FD_PASSING: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_XML_MIGRATABLE: + case VIR_DRV_FEATURE_MIGRATION_OFFLINE: + case VIR_DRV_FEATURE_MIGRATION_PARAMS: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: default: return 0; } --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511685544989.9176663355557; Thu, 8 Mar 2018 04:21:25 -0800 (PST) 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 F031633BC3; Thu, 8 Mar 2018 12:21:23 +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 A9BC8BA4F; Thu, 8 Mar 2018 12:21:23 +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 5873C4CA9F; Thu, 8 Mar 2018 12:21:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CL9Om016918 for ; Thu, 8 Mar 2018 07:21:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9962D5D77E; Thu, 8 Mar 2018 12:21:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90EE25D6B7 for ; Thu, 8 Mar 2018 12:21:09 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A2A81C0587C0 for ; Thu, 8 Mar 2018 12:21:08 +0000 (UTC) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL522094601 for ; Thu, 8 Mar 2018 07:21:08 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk3prknrc-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:07 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:20:50 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:48 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKmQ358523730 for ; Thu, 8 Mar 2018 12:20:48 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A589DA4057 for ; Thu, 8 Mar 2018 12:13:43 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7FA08A4051 for ; Thu, 8 Mar 2018 12:13:43 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:43 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:25 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0040-0000-0000-0000043C5DBB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0041-0000-0000-000020DF7D58 Message-Id: <20180308122043.15608-3-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Mar 2018 12:21:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Mar 2018 12:21:08 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/20] remote: Don't hard code the feature VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK as available 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: , MIME-Version: 1.0 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.38]); Thu, 08 Mar 2018 12:21:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Don't assume that the feature VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK is available for every driver used for the connection. Signed-off-by: Marc Hartmayer Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/remote/remote_daemon_dispatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 82f6400ca49d..bf6c00348a5e 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -4667,7 +4667,6 @@ static int remoteDispatchConnectSupportsFeature(virNe= tServerPtr server ATTRIBUTE switch ((virDrvFeature) args->feature) { case VIR_DRV_FEATURE_FD_PASSING: case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: - case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: supported =3D 1; break; case VIR_DRV_FEATURE_MIGRATION_V1: @@ -4681,6 +4680,7 @@ static int remoteDispatchConnectSupportsFeature(virNe= tServerPtr server ATTRIBUTE case VIR_DRV_FEATURE_XML_MIGRATABLE: case VIR_DRV_FEATURE_MIGRATION_OFFLINE: case VIR_DRV_FEATURE_MIGRATION_PARAMS: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: default: if ((supported =3D virConnectSupportsFeature(priv->conn, args->fea= ture)) < 0) goto cleanup; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511700971857.7008299858423; Thu, 8 Mar 2018 04:21:40 -0800 (PST) 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 9083E369BD; Thu, 8 Mar 2018 12:21:39 +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 4C63E9F7F; Thu, 8 Mar 2018 12:21:39 +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 DCECF4CAB1; Thu, 8 Mar 2018 12:21:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLPk0017051 for ; Thu, 8 Mar 2018 07:21:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id E2A6F17DEE; Thu, 8 Mar 2018 12:21:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DBE3117D71 for ; Thu, 8 Mar 2018 12:21:24 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 25ECE81DF6 for ; Thu, 8 Mar 2018 12:21:24 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CLC06042906 for ; Thu, 8 Mar 2018 07:21:23 -0500 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gk51g852q-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:16 -0500 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:20:52 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:49 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKniM64487598 for ; Thu, 8 Mar 2018 12:20:49 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4BA0A404D for ; Thu, 8 Mar 2018 12:13:44 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1D5FA4057 for ; Thu, 8 Mar 2018 12:13:44 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:44 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:26 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0012-0000-0000-000005BA5C67 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0013-0000-0000-000019367C64 Message-Id: <20180308122043.15608-4-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 12:21:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 12:21:24 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/20] virConnect(Un)RegisterCloseCallback: Throw an error in case the API is not supported 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: , MIME-Version: 1.0 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, 08 Mar 2018 12:21:40 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Report an error in case the driver does not support connect(Un)registerCloseCallback. The commit 'close callback: move it to driver' (88f09b75eb99) moved the responsibility for the close callback to the driver. But if the driver doesn't support the connectRegisterCloseCallback API this function does nothing, even no unsupported error report. The only case where an error is reported is when the API is supported but the call fails. The same behavior applies to virConnectUnregisterCloseCallback. This behavior is not intended as there are many use cases of this API where the state of for example allocations depends on the result of these functions. To keep the behavior of virsh as before it must silently ignore unsupported error for virConnectRegisterCloseCallback. For the remote driver this change wouldn't be needed, but for the byhve driver, for example. Otherwise the user would see the error message that virsh was unable to register a disconnect callback. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/libvirt-host.c | 24 ++++++++++++++---------- tools/virsh.c | 11 +++++++++-- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 7ff7407a0874..bfa104b39918 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -1221,12 +1221,14 @@ virConnectRegisterCloseCallback(virConnectPtr conn, virCheckConnectReturn(conn, -1); virCheckNonNullArgGoto(cb, error); =20 - if (conn->driver->connectRegisterCloseCallback && - conn->driver->connectRegisterCloseCallback(conn, cb, opaque, freec= b) < 0) - goto error; - - return 0; + if (conn->driver->connectRegisterCloseCallback) { + int ret =3D conn->driver->connectRegisterCloseCallback(conn, cb, o= paque, freecb); + if (ret < 0) + goto error; + return ret; + } =20 + virReportUnsupportedError(); error: virDispatchError(conn); return -1; @@ -1256,12 +1258,14 @@ virConnectUnregisterCloseCallback(virConnectPtr con= n, virCheckConnectReturn(conn, -1); virCheckNonNullArgGoto(cb, error); =20 - if (conn->driver->connectUnregisterCloseCallback && - conn->driver->connectUnregisterCloseCallback(conn, cb) < 0) - goto error; - - return 0; + if (conn->driver->connectUnregisterCloseCallback) { + int ret =3D conn->driver->connectUnregisterCloseCallback(conn, cb); + if (ret < 0) + goto error; + return ret; + } =20 + virReportUnsupportedError(); error: virDispatchError(conn); return -1; diff --git a/tools/virsh.c b/tools/virsh.c index 5f8352e861d3..2df1197252b3 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -256,8 +256,15 @@ virshReconnect(vshControl *ctl, const char *name, bool= readonly, bool force) priv->readonly =3D readonly; =20 if (virConnectRegisterCloseCallback(priv->conn, virshCatchDisconne= ct, - ctl, NULL) < 0) - vshError(ctl, "%s", _("Unable to register disconnect callback"= )); + ctl, NULL) < 0) { + virErrorPtr error =3D virGetLastError(); + if (error && error->code =3D=3D VIR_ERR_NO_SUPPORT) { + /* silently ignore the unsupported error */ + virResetLastError(); + } else { + vshError(ctl, "%s", _("Unable to register disconnect callb= ack")); + } + } if (connected && !force) vshError(ctl, "%s", _("Reconnected to the hypervisor")); } --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511677796412.6574796068759; Thu, 8 Mar 2018 04:21:17 -0800 (PST) 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 19D1AC04AC50; Thu, 8 Mar 2018 12:21:16 +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 D6B865D9C8; Thu, 8 Mar 2018 12:21:15 +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 7B0F54CA9F; Thu, 8 Mar 2018 12:21:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CL52G016877 for ; Thu, 8 Mar 2018 07:21:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id CFA60437F; Thu, 8 Mar 2018 12:21:05 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C13114384 for ; Thu, 8 Mar 2018 12:21:03 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8993680463 for ; Thu, 8 Mar 2018 12:21:01 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CKwbf088354 for ; Thu, 8 Mar 2018 07:21:01 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk2qr65fn-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:00 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:20:53 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:50 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKoN953805224 for ; Thu, 8 Mar 2018 12:20:50 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02E70A4053 for ; Thu, 8 Mar 2018 12:13:46 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA8DCA4040 for ; Thu, 8 Mar 2018 12:13:45 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:45 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:27 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0008-0000-0000-000004D95AF6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0009-0000-0000-00001E6C7ABF Message-Id: <20180308122043.15608-5-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Mar 2018 12:21:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Mar 2018 12:21:01 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/20] test: Implement virConnectSupportsFeature 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: , MIME-Version: 1.0 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.31]); Thu, 08 Mar 2018 12:21:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Implement virConnectSupportsFeature for the test driver as this API is used by various API functions (the functions usually use the macro VIR_DRV_SUPPORTS_FEATURE for calling virConnectSupportsFeature). Signed-off-by: Marc Hartmayer Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 043caa976274..203358c7017f 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -6829,6 +6829,32 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snap= shot, } =20 =20 +static int +testConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, + int feature) +{ + switch ((virDrvFeature) feature) { + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + return 1; + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_FD_PASSING: + case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: + case VIR_DRV_FEATURE_MIGRATION_DIRECT: + case VIR_DRV_FEATURE_MIGRATION_OFFLINE: + case VIR_DRV_FEATURE_MIGRATION_P2P: + case VIR_DRV_FEATURE_MIGRATION_PARAMS: + case VIR_DRV_FEATURE_MIGRATION_V1: + case VIR_DRV_FEATURE_MIGRATION_V2: + case VIR_DRV_FEATURE_MIGRATION_V3: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_XML_MIGRATABLE: + default: + return 0; + } +} + =20 static virHypervisorDriver testHypervisorDriver =3D { .name =3D "Test", @@ -6837,6 +6863,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .connectGetVersion =3D testConnectGetVersion, /* 0.1.1 */ .connectGetHostname =3D testConnectGetHostname, /* 0.6.3 */ .connectGetMaxVcpus =3D testConnectGetMaxVcpus, /* 0.3.2 */ + .connectSupportsFeature =3D testConnectSupportsFeature, /* 4.2.0 */ .nodeGetInfo =3D testNodeGetInfo, /* 0.1.1 */ .nodeGetCPUStats =3D testNodeGetCPUStats, /* 2.3.0 */ .nodeGetFreeMemory =3D testNodeGetFreeMemory, /* 2.3.0 */ --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511674063664.7534617372248; Thu, 8 Mar 2018 04:21:14 -0800 (PST) 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 7F4B58046E; Thu, 8 Mar 2018 12:21:12 +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 4E8F560175; Thu, 8 Mar 2018 12:21: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 EEDC2181B9FD; Thu, 8 Mar 2018 12:21:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CL9FM016913 for ; Thu, 8 Mar 2018 07:21:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 68298BA46; Thu, 8 Mar 2018 12:21:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61A0760F90 for ; Thu, 8 Mar 2018 12:21:04 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A59D581DE6 for ; Thu, 8 Mar 2018 12:21:03 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL0oq025973 for ; Thu, 8 Mar 2018 07:21:03 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk3btck9t-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:02 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:20:53 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:52 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKp1B56295612 for ; Thu, 8 Mar 2018 12:20:51 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D283A4053 for ; Thu, 8 Mar 2018 12:13:47 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F21DA4040 for ; Thu, 8 Mar 2018 12:13:47 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:46 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:28 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0008-0000-0000-000004D95AF7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0009-0000-0000-00001E6C7AC0 Message-Id: <20180308122043.15608-6-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 12:21:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 12:21:03 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/20] test: Implement virConnect(Un)RegisterCloseCallback 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: , MIME-Version: 1.0 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, 08 Mar 2018 12:21:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Implement the hypervisor APIs virConnectRegisterCloseCallback and virConnectUnregisterCloseCallbacks and mark this feature as supported in testConnectSupportsFeature. This increases test test coverage of the test suite as then the testConnectRegisterCloseCallback and testConnectUnregisterCloseCallback (which are almost identical to the implementations of the remote and vz driver) will be called by the virsh tests. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- src/test/test_driver.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 203358c7017f..2773f5c758c8 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -121,6 +121,7 @@ struct _testDriver { virDomainObjListPtr domains; virNetworkObjListPtr networks; virObjectEventStatePtr eventState; + virConnectCloseCallbackDataPtr closeCallback; }; typedef struct _testDriver testDriver; typedef testDriver *testDriverPtr; @@ -157,6 +158,7 @@ testDriverFree(testDriverPtr driver) virObjectUnref(driver->ifaces); virObjectUnref(driver->pools); virObjectUnref(driver->eventState); + virObjectUnref(driver->closeCallback); virMutexUnlock(&driver->lock); virMutexDestroy(&driver->lock); =20 @@ -404,6 +406,7 @@ testDriverNew(void) .free =3D testDomainDefNamespaceFree, }; testDriverPtr ret; + virConnectCloseCallbackDataPtr closeCallback; =20 if (VIR_ALLOC(ret) < 0) return NULL; @@ -423,6 +426,12 @@ testDriverNew(void) !(ret->pools =3D virStoragePoolObjListNew())) goto error; =20 + closeCallback =3D virNewConnectCloseCallbackData(); + if (!closeCallback) + goto error; + + ret->closeCallback =3D closeCallback; + virAtomicIntSet(&ret->nextDomID, 1); =20 return ret; @@ -6834,9 +6843,9 @@ testConnectSupportsFeature(virConnectPtr conn ATTRIBU= TE_UNUSED, int feature) { switch ((virDrvFeature) feature) { + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: return 1; - case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: case VIR_DRV_FEATURE_FD_PASSING: case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: case VIR_DRV_FEATURE_MIGRATION_DIRECT: @@ -6855,6 +6864,56 @@ testConnectSupportsFeature(virConnectPtr conn ATTRIB= UTE_UNUSED, } } =20 +static int +testConnectRegisterCloseCallback(virConnectPtr conn, + virConnectCloseFunc cb, + void *opaque, + virFreeCallback freecb) +{ + testDriverPtr priv =3D conn->privateData; + int ret =3D -1; + + testDriverLock(priv); + + if (virConnectCloseCallbackDataGetCallback(priv->closeCallback) !=3D N= ULL) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("A close callback is already registered")); + goto cleanup; + } + + virConnectCloseCallbackDataRegister(priv->closeCallback, conn, cb, + opaque, freecb); + ret =3D 0; + + cleanup: + testDriverUnlock(priv); + return ret; +} + + +static int +testConnectUnregisterCloseCallback(virConnectPtr conn, + virConnectCloseFunc cb) +{ + testDriverPtr priv =3D conn->privateData; + int ret =3D -1; + + testDriverLock(priv); + + if (virConnectCloseCallbackDataGetCallback(priv->closeCallback) !=3D c= b) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("A different callback was requested")); + goto cleanup; + } + + virConnectCloseCallbackDataUnregister(priv->closeCallback, cb); + ret =3D 0; + + cleanup: + testDriverUnlock(priv); + return ret; +} + =20 static virHypervisorDriver testHypervisorDriver =3D { .name =3D "Test", @@ -6863,7 +6922,9 @@ static virHypervisorDriver testHypervisorDriver =3D { .connectGetVersion =3D testConnectGetVersion, /* 0.1.1 */ .connectGetHostname =3D testConnectGetHostname, /* 0.6.3 */ .connectGetMaxVcpus =3D testConnectGetMaxVcpus, /* 0.3.2 */ + .connectRegisterCloseCallback =3D testConnectRegisterCloseCallback, /*= 4.2.0 */ .connectSupportsFeature =3D testConnectSupportsFeature, /* 4.2.0 */ + .connectUnregisterCloseCallback =3D testConnectUnregisterCloseCallback= , /* 4.2.0 */ .nodeGetInfo =3D testNodeGetInfo, /* 0.1.1 */ .nodeGetCPUStats =3D testNodeGetCPUStats, /* 2.3.0 */ .nodeGetFreeMemory =3D testNodeGetFreeMemory, /* 2.3.0 */ --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511665078197.5800961074375; Thu, 8 Mar 2018 04:21:05 -0800 (PST) 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 8A08481DED; Thu, 8 Mar 2018 12:21:03 +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 52FA860F90; Thu, 8 Mar 2018 12:21:03 +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 124574CA9B; Thu, 8 Mar 2018 12:21:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CL1JY016862 for ; Thu, 8 Mar 2018 07:21:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9F8A35D753; Thu, 8 Mar 2018 12:21:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 993AE5D6B7 for ; Thu, 8 Mar 2018 12:20:58 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54FE481F0C for ; Thu, 8 Mar 2018 12:20:58 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CCTev045345 for ; Thu, 8 Mar 2018 07:20:57 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gk1xf0d48-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:20:57 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:20:55 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:53 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKqtD51839230 for ; Thu, 8 Mar 2018 12:20:52 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5FACDA4040 for ; Thu, 8 Mar 2018 12:13:48 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 395C8A4051 for ; Thu, 8 Mar 2018 12:13:48 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:48 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:29 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0008-0000-0000-000004D95AF8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0009-0000-0000-00001E6C7AC1 Message-Id: <20180308122043.15608-7-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080144 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 12:20:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 12:20:58 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/20] test: testOpenDefault: introduce cleanup path 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: , MIME-Version: 1.0 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.25]); Thu, 08 Mar 2018 12:21:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The two code paths have some cleanup in common so lets refactor it. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2773f5c758c8..e7307fddad4a 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1306,6 +1306,7 @@ testOpenFromFile(virConnectPtr conn, const char *file) static int testOpenDefault(virConnectPtr conn) { + int ret; testDriverPtr privconn =3D NULL; xmlDocPtr doc =3D NULL; xmlXPathContextPtr ctxt =3D NULL; @@ -1354,21 +1355,19 @@ testOpenDefault(virConnectPtr conn) goto error; =20 defaultConn =3D privconn; - + ret =3D VIR_DRV_OPEN_SUCCESS; + cleanup: + virMutexUnlock(&defaultLock); xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); - virMutexUnlock(&defaultLock); - - return VIR_DRV_OPEN_SUCCESS; + return ret; =20 error: testDriverFree(privconn); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(doc); conn->privateData =3D NULL; defaultConnections--; - virMutexUnlock(&defaultLock); - return VIR_DRV_OPEN_ERROR; + ret =3D VIR_DRV_OPEN_ERROR; + goto cleanup; } =20 static int --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511696441522.9164699765131; Thu, 8 Mar 2018 04:21:36 -0800 (PST) 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 D4F0FC04BE04; Thu, 8 Mar 2018 12:21:34 +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 787C36134B; Thu, 8 Mar 2018 12:21:34 +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 026F34CAAC; Thu, 8 Mar 2018 12:21:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLD4D016967 for ; Thu, 8 Mar 2018 07:21:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 58E964384; Thu, 8 Mar 2018 12:21:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D7B0437F for ; Thu, 8 Mar 2018 12:21:13 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D77520262 for ; Thu, 8 Mar 2018 12:21:12 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL7mg042391 for ; Thu, 8 Mar 2018 07:21:11 -0500 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gk51g854a-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:09 -0500 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:20:56 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:54 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKsaO43909242 for ; Thu, 8 Mar 2018 12:20:54 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 92426A4051 for ; Thu, 8 Mar 2018 12:13:49 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C709A4040 for ; Thu, 8 Mar 2018 12:13:49 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:49 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:30 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0012-0000-0000-000005BA5C69 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0013-0000-0000-000019367C66 Message-Id: <20180308122043.15608-8-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 08 Mar 2018 12:21:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 08 Mar 2018 12:21:12 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/20] test: testOpenFromFile: return VIR_DRV_OPEN_SUCCESS in case of success 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: , MIME-Version: 1.0 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, 08 Mar 2018 12:21:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index e7307fddad4a..388407d4371f 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1290,7 +1290,7 @@ testOpenFromFile(virConnectPtr conn, const char *file) xmlFreeDoc(doc); testDriverUnlock(privconn); =20 - return 0; + return VIR_DRV_OPEN_SUCCESS; =20 error: xmlXPathFreeContext(ctxt); --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511680108487.63121736408766; Thu, 8 Mar 2018 04:21:20 -0800 (PST) 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 32EAB80C32; Thu, 8 Mar 2018 12:21:18 +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 0932B6134A; Thu, 8 Mar 2018 12:21:18 +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 C49ED4CA9D; Thu, 8 Mar 2018 12:21:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLBfW016939 for ; Thu, 8 Mar 2018 07:21:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id CD98C6134A; Thu, 8 Mar 2018 12:21:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6E849CD1 for ; Thu, 8 Mar 2018 12:21:08 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2070D4E90C for ; Thu, 8 Mar 2018 12:21:03 +0000 (UTC) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CKvXo013843 for ; Thu, 8 Mar 2018 07:21:02 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gk1jf9ax7-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:20:58 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:20:57 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:55 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKtH065470524 for ; Thu, 8 Mar 2018 12:20:55 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4D44A4051 for ; Thu, 8 Mar 2018 12:13:50 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E6A2A4055 for ; Thu, 8 Mar 2018 12:13:50 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:50 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:31 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0020-0000-0000-0000040044BA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0021-0000-0000-0000429489F2 Message-Id: <20180308122043.15608-9-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 08 Mar 2018 12:21:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 08 Mar 2018 12:21:03 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/20] test: testConnectAuthenticate: Take the lock when accessing mutable values 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: , MIME-Version: 1.0 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.26]); Thu, 08 Mar 2018 12:21:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 388407d4371f..b0ce7d0eea0a 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1379,8 +1379,11 @@ testConnectAuthenticate(virConnectPtr conn, ssize_t i; char *username =3D NULL, *password =3D NULL; =20 - if (privconn->numAuths =3D=3D 0) + testDriverLock(privconn); + if (privconn->numAuths =3D=3D 0) { + testDriverUnlock(privconn); return 0; + } =20 /* Authentication is required because the test XML contains a * non-empty section. First we must ask for a username. @@ -1420,6 +1423,7 @@ testConnectAuthenticate(virConnectPtr conn, =20 ret =3D 0; cleanup: + testDriverUnlock(privconn); VIR_FREE(username); VIR_FREE(password); return ret; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511689500800.382820581978; Thu, 8 Mar 2018 04:21:29 -0800 (PST) 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 3004E2BBDE2; Thu, 8 Mar 2018 12:21:28 +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 03032BA4C; Thu, 8 Mar 2018 12:21:28 +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 8E763180BAE5; Thu, 8 Mar 2018 12:21:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLI4W017006 for ; Thu, 8 Mar 2018 07:21:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 01EAD17D2D; Thu, 8 Mar 2018 12:21:18 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF4A55DD81 for ; Thu, 8 Mar 2018 12:21:14 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C7DE80463 for ; Thu, 8 Mar 2018 12:21:14 +0000 (UTC) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL3h1094515 for ; Thu, 8 Mar 2018 07:21:13 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk3prknwd-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:11 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:20:59 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:56 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKuOs55050374 for ; Thu, 8 Mar 2018 12:20:56 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EDBA6A4051 for ; Thu, 8 Mar 2018 12:13:51 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D12C0A404D for ; Thu, 8 Mar 2018 12:13:51 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:51 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:32 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0020-0000-0000-0000040044BD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0021-0000-0000-0000429489F3 Message-Id: <20180308122043.15608-10-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Mar 2018 12:21:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Mar 2018 12:21:14 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/20] test: testConnectClose: Set privateData to NULL in all cases 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: , MIME-Version: 1.0 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.39]); Thu, 08 Mar 2018 12:21:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Set privateData to NULL also for a connection that uses @defaultConn as privateData regardless of whether @defaultConn was freed or not. @defaultConn is shared between multiple connections and it's ensured that there will be no memory leak by counting references. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index b0ce7d0eea0a..5561d0c2ae70 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1482,6 +1482,7 @@ static int testConnectClose(virConnectPtr conn) dflt =3D true; virMutexLock(&defaultLock); if (--defaultConnections) { + conn->privateData =3D NULL; virMutexUnlock(&defaultLock); return 0; } --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511706131891.800115152616; Thu, 8 Mar 2018 04:21:46 -0800 (PST) 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 C090964DB9; Thu, 8 Mar 2018 12:21:44 +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 848D65C578; Thu, 8 Mar 2018 12:21:44 +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 B7A37180BAF1; Thu, 8 Mar 2018 12:21:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLbYJ017135 for ; Thu, 8 Mar 2018 07:21:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7F4565DD81; Thu, 8 Mar 2018 12:21:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7748F17D0F for ; Thu, 8 Mar 2018 12:21:34 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 583B780468 for ; Thu, 8 Mar 2018 12:21:33 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CLRmR102624 for ; Thu, 8 Mar 2018 07:21:32 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk4apt2ax-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:31 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:00 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:58 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKv9P53674144 for ; Thu, 8 Mar 2018 12:20:57 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C438A4051 for ; Thu, 8 Mar 2018 12:13:53 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F9C4A404D for ; Thu, 8 Mar 2018 12:13:53 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:52 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:33 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0008-0000-0000-000004D95AFA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0009-0000-0000-00001E6C7AC3 Message-Id: <20180308122043.15608-11-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Mar 2018 12:21:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Mar 2018 12:21:33 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/20] test: rename defaultConn to defaultPrivconn 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: , MIME-Version: 1.0 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, 08 Mar 2018 12:21:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Rename the variable @defaultConn to @defaultPrivconn as it doesn't point to a default connection but to the private data used for the shared default connection of the test driver. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 5561d0c2ae70..d450be21704e 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -126,7 +126,7 @@ struct _testDriver { typedef struct _testDriver testDriver; typedef testDriver *testDriverPtr; =20 -static testDriverPtr defaultConn; +static testDriverPtr defaultPrivconn; static int defaultConnections; static virMutex defaultLock =3D VIR_MUTEX_INITIALIZER; =20 @@ -1314,7 +1314,7 @@ testOpenDefault(virConnectPtr conn) =20 virMutexLock(&defaultLock); if (defaultConnections++) { - conn->privateData =3D defaultConn; + conn->privateData =3D defaultPrivconn; virMutexUnlock(&defaultLock); return VIR_DRV_OPEN_SUCCESS; } @@ -1354,7 +1354,7 @@ testOpenDefault(virConnectPtr conn) if (testOpenParse(privconn, NULL, ctxt) < 0) goto error; =20 - defaultConn =3D privconn; + defaultPrivconn =3D privconn; ret =3D VIR_DRV_OPEN_SUCCESS; cleanup: virMutexUnlock(&defaultLock); @@ -1478,7 +1478,7 @@ static int testConnectClose(virConnectPtr conn) testDriverPtr privconn =3D conn->privateData; bool dflt =3D false; =20 - if (privconn =3D=3D defaultConn) { + if (privconn =3D=3D defaultPrivconn) { dflt =3D true; virMutexLock(&defaultLock); if (--defaultConnections) { @@ -1492,7 +1492,7 @@ static int testConnectClose(virConnectPtr conn) testDriverFree(privconn); =20 if (dflt) { - defaultConn =3D NULL; + defaultPrivconn =3D NULL; virMutexUnlock(&defaultLock); } =20 --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511689840351.7429796046034; Thu, 8 Mar 2018 04:21:29 -0800 (PST) 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 6870280469; Thu, 8 Mar 2018 12:21:28 +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 2AC959CCA; Thu, 8 Mar 2018 12:21:28 +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 CC710180BAE7; Thu, 8 Mar 2018 12:21:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLDJQ016962 for ; Thu, 8 Mar 2018 07:21:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2BE485C262; Thu, 8 Mar 2018 12:21:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 252865C25A for ; Thu, 8 Mar 2018 12:21:08 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 501A7356E6 for ; Thu, 8 Mar 2018 12:21:07 +0000 (UTC) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL5qq011828 for ; Thu, 8 Mar 2018 07:21:06 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk1x7068m-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:06 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:00 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:20:59 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CKwSn852338 for ; Thu, 8 Mar 2018 12:20:58 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54FD4A4051 for ; Thu, 8 Mar 2018 12:13:54 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 38632A4040 for ; Thu, 8 Mar 2018 12:13:54 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:54 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:34 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0016-0000-0000-0000052E5E1A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0017-0000-0000-0000286B7DB4 Message-Id: <20180308122043.15608-12-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Mar 2018 12:21:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Mar 2018 12:21:07 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/20] test: introduce testDriverCloseInternal 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: , MIME-Version: 1.0 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, 08 Mar 2018 12:21:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Refactor testConnectClose as it's then obvious that conn->privateData is set to NULL in all cases. In addition, 'testConnectCloseInternal' can be better reused. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 61 +++++++++++++++++++++++++++++-----------------= ---- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index d450be21704e..fca607f57d51 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1429,10 +1429,36 @@ testConnectAuthenticate(virConnectPtr conn, return ret; } =20 -static virDrvOpenStatus testConnectOpen(virConnectPtr conn, - virConnectAuthPtr auth, - virConfPtr conf ATTRIBUTE_UNUSED, - unsigned int flags) + +static void +testDriverCloseInternal(testDriverPtr driver) +{ + bool dflt =3D false; + + if (driver =3D=3D defaultPrivconn) { + dflt =3D true; + virMutexLock(&defaultLock); + if (--defaultConnections) { + virMutexUnlock(&defaultLock); + return; + } + } + + testDriverLock(driver); + testDriverFree(driver); + + if (dflt) { + defaultPrivconn =3D NULL; + virMutexUnlock(&defaultLock); + } +} + + +static virDrvOpenStatus +testConnectOpen(virConnectPtr conn, + virConnectAuthPtr auth, + virConfPtr conf ATTRIBUTE_UNUSED, + unsigned int flags) { int ret; =20 @@ -1473,33 +1499,16 @@ static virDrvOpenStatus testConnectOpen(virConnectP= tr conn, return VIR_DRV_OPEN_SUCCESS; } =20 -static int testConnectClose(virConnectPtr conn) + +static int +testConnectClose(virConnectPtr conn) { - testDriverPtr privconn =3D conn->privateData; - bool dflt =3D false; - - if (privconn =3D=3D defaultPrivconn) { - dflt =3D true; - virMutexLock(&defaultLock); - if (--defaultConnections) { - conn->privateData =3D NULL; - virMutexUnlock(&defaultLock); - return 0; - } - } - - testDriverLock(privconn); - testDriverFree(privconn); - - if (dflt) { - defaultPrivconn =3D NULL; - virMutexUnlock(&defaultLock); - } - + testDriverCloseInternal(conn->privateData); conn->privateData =3D NULL; return 0; } =20 + static int testConnectGetVersion(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned long *hvVer) { --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511681325992.4044289318024; Thu, 8 Mar 2018 04:21:21 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C159861D1C; Thu, 8 Mar 2018 12:21:19 +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 94CB25D753; Thu, 8 Mar 2018 12:21:19 +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 4FCF6180BAD6; Thu, 8 Mar 2018 12:21:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CL8ik016893 for ; Thu, 8 Mar 2018 07:21:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2DC795D77E; Thu, 8 Mar 2018 12:21:08 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 26F962C7A3 for ; Thu, 8 Mar 2018 12:21:08 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD18C80C1E for ; Thu, 8 Mar 2018 12:21:06 +0000 (UTC) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL4N2011758 for ; Thu, 8 Mar 2018 07:21:06 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk1x7068r-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:05 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:01 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:21:00 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CL0Bn65929406 for ; Thu, 8 Mar 2018 12:21:00 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 87372A4053 for ; Thu, 8 Mar 2018 12:13:55 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6122CA4051 for ; Thu, 8 Mar 2018 12:13:55 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:55 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:35 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0040-0000-0000-0000041C61CF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0041-0000-0000-0000261F7C9F Message-Id: <20180308122043.15608-13-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 08 Mar 2018 12:21:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 08 Mar 2018 12:21:06 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/20] test: fix error path in testConnectOpen 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In case of an error do the cleanup of the private data of the connection. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index fca607f57d51..3b55453efe00 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1493,8 +1493,11 @@ testConnectOpen(virConnectPtr conn, return ret; =20 /* Fake authentication. */ - if (testConnectAuthenticate(conn, auth) < 0) + if (testConnectAuthenticate(conn, auth) < 0) { + testDriverCloseInternal(conn->privateData); + conn->privateData =3D NULL; return VIR_DRV_OPEN_ERROR; + } =20 return VIR_DRV_OPEN_SUCCESS; } --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511709733953.6763630261588; Thu, 8 Mar 2018 04:21:49 -0800 (PST) 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 5A806734; Thu, 8 Mar 2018 12:21:48 +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 0DBF918EC2; Thu, 8 Mar 2018 12:21:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7EBE4181B9FD; Thu, 8 Mar 2018 12:21:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLkD8017221 for ; Thu, 8 Mar 2018 07:21:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 20E535C578; Thu, 8 Mar 2018 12:21:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 17C695C259 for ; Thu, 8 Mar 2018 12:21:41 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D741C0587F4 for ; Thu, 8 Mar 2018 12:21:38 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CLTu0102792 for ; Thu, 8 Mar 2018 07:21:38 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk4apt2br-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:33 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:03 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:21:01 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CL1ci53412042 for ; Thu, 8 Mar 2018 12:21:01 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B65A8A4053 for ; Thu, 8 Mar 2018 12:13:56 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93436A4051 for ; Thu, 8 Mar 2018 12:13:56 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:56 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:36 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0040-0000-0000-0000041C61D0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0041-0000-0000-0000261F7CA0 Message-Id: <20180308122043.15608-14-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Mar 2018 12:21:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Mar 2018 12:21:38 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 13/20] test: Convert testDriver to virObjectLockable 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: , MIME-Version: 1.0 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.29]); Thu, 08 Mar 2018 12:21:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The test driver state (@testDriver) uses it's own reference counting and locking implementation. Instead of doing that, convert @testDriver into a virObjectLockable and use the provided functionalities. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 207 ++++++++++++++++++++++-----------------------= ---- 1 file changed, 94 insertions(+), 113 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 3b55453efe00..f1dd11867143 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -94,7 +94,7 @@ typedef struct _testAuth testAuth; typedef struct _testAuth *testAuthPtr; =20 struct _testDriver { - virMutex lock; + virObjectLockable parent; =20 virNodeInfo nodeInfo; virInterfaceObjListPtr ifaces; @@ -127,9 +127,22 @@ typedef struct _testDriver testDriver; typedef testDriver *testDriverPtr; =20 static testDriverPtr defaultPrivconn; -static int defaultConnections; static virMutex defaultLock =3D VIR_MUTEX_INITIALIZER; =20 +static virClassPtr testDriverClass; +static void testDriverDispose(void *obj); +static int testDriverOnceInit(void) +{ + if (!(testDriverClass =3D virClassNew(virClassForObjectLockable(), + "testDriver", + sizeof(testDriver), + testDriverDispose))) + return -1; + + return 0; +} +VIR_ONCE_GLOBAL_INIT(testDriver) + #define TEST_MODEL "i686" #define TEST_EMULATOR "/usr/bin/test-hv" =20 @@ -145,10 +158,9 @@ static const virNodeInfo defaultNodeInfo =3D { }; =20 static void -testDriverFree(testDriverPtr driver) +testDriverDispose(void *obj) { - if (!driver) - return; + testDriverPtr driver =3D obj; =20 virObjectUnref(driver->caps); virObjectUnref(driver->xmlopt); @@ -159,23 +171,9 @@ testDriverFree(testDriverPtr driver) virObjectUnref(driver->pools); virObjectUnref(driver->eventState); virObjectUnref(driver->closeCallback); - virMutexUnlock(&driver->lock); - virMutexDestroy(&driver->lock); - - VIR_FREE(driver); } =20 =20 -static void testDriverLock(testDriverPtr driver) -{ - virMutexLock(&driver->lock); -} - -static void testDriverUnlock(testDriverPtr driver) -{ - virMutexUnlock(&driver->lock); -} - static void testObjectEventQueue(testDriverPtr driver, virObjectEventPtr event) { @@ -408,14 +406,11 @@ testDriverNew(void) testDriverPtr ret; virConnectCloseCallbackDataPtr closeCallback; =20 - if (VIR_ALLOC(ret) < 0) + if (testDriverInitialize() < 0) return NULL; =20 - if (virMutexInit(&ret->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); - goto error; - } + if (!(ret =3D virObjectLockableNew(testDriverClass))) + return NULL; =20 if (!(ret->xmlopt =3D virDomainXMLOptionNew(NULL, NULL, &ns, NULL, NUL= L)) || !(ret->eventState =3D virObjectEventStateNew()) || @@ -437,7 +432,7 @@ testDriverNew(void) return ret; =20 error: - testDriverFree(ret); + virObjectUnref(ret); return NULL; } =20 @@ -1271,7 +1266,7 @@ testOpenFromFile(virConnectPtr conn, const char *file) if (!(privconn =3D testDriverNew())) return VIR_DRV_OPEN_ERROR; =20 - testDriverLock(privconn); + virObjectLock(privconn); conn->privateData =3D privconn; =20 if (!(privconn->caps =3D testBuildCapabilities(conn))) @@ -1288,14 +1283,14 @@ testOpenFromFile(virConnectPtr conn, const char *fi= le) =20 xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return VIR_DRV_OPEN_SUCCESS; =20 error: xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); - testDriverFree(privconn); + virObjectUnref(privconn); conn->privateData =3D NULL; return VIR_DRV_OPEN_ERROR; } @@ -1313,8 +1308,8 @@ testOpenDefault(virConnectPtr conn) size_t i; =20 virMutexLock(&defaultLock); - if (defaultConnections++) { - conn->privateData =3D defaultPrivconn; + if (defaultPrivconn) { + conn->privateData =3D virObjectRef(defaultPrivconn); virMutexUnlock(&defaultLock); return VIR_DRV_OPEN_SUCCESS; } @@ -1363,9 +1358,8 @@ testOpenDefault(virConnectPtr conn) return ret; =20 error: - testDriverFree(privconn); + virObjectUnref(privconn); conn->privateData =3D NULL; - defaultConnections--; ret =3D VIR_DRV_OPEN_ERROR; goto cleanup; } @@ -1379,9 +1373,9 @@ testConnectAuthenticate(virConnectPtr conn, ssize_t i; char *username =3D NULL, *password =3D NULL; =20 - testDriverLock(privconn); + virObjectLock(privconn); if (privconn->numAuths =3D=3D 0) { - testDriverUnlock(privconn); + virObjectUnlock(privconn); return 0; } =20 @@ -1423,7 +1417,7 @@ testConnectAuthenticate(virConnectPtr conn, =20 ret =3D 0; cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); VIR_FREE(username); VIR_FREE(password); return ret; @@ -1433,24 +1427,11 @@ testConnectAuthenticate(virConnectPtr conn, static void testDriverCloseInternal(testDriverPtr driver) { - bool dflt =3D false; - - if (driver =3D=3D defaultPrivconn) { - dflt =3D true; - virMutexLock(&defaultLock); - if (--defaultConnections) { - virMutexUnlock(&defaultLock); - return; - } - } - - testDriverLock(driver); - testDriverFree(driver); - - if (dflt) { + virMutexLock(&defaultLock); + bool disposed =3D !virObjectUnref(driver); + if (disposed && driver =3D=3D defaultPrivconn) defaultPrivconn =3D NULL; - virMutexUnlock(&defaultLock); - } + virMutexUnlock(&defaultLock); } =20 =20 @@ -1581,9 +1562,9 @@ static int testNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) { testDriverPtr privconn =3D conn->privateData; - testDriverLock(privconn); + virObjectLock(privconn); memcpy(info, &privconn->nodeInfo, sizeof(virNodeInfo)); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return 0; } =20 @@ -1591,9 +1572,9 @@ static char *testConnectGetCapabilities(virConnectPtr= conn) { testDriverPtr privconn =3D conn->privateData; char *xml; - testDriverLock(privconn); + virObjectLock(privconn); xml =3D virCapabilitiesFormatXML(privconn->caps); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return xml; } =20 @@ -1628,9 +1609,9 @@ static int testConnectNumOfDomains(virConnectPtr conn) testDriverPtr privconn =3D conn->privateData; int count; =20 - testDriverLock(privconn); + virObjectLock(privconn); count =3D virDomainObjListNumOfDomains(privconn->domains, true, NULL, = NULL); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return count; } @@ -1683,7 +1664,7 @@ testDomainCreateXML(virConnectPtr conn, const char *x= ml, if (flags & VIR_DOMAIN_START_VALIDATE) parse_flags |=3D VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; =20 - testDriverLock(privconn); + virObjectLock(privconn); if ((def =3D virDomainDefParseString(xml, privconn->caps, privconn->xm= lopt, NULL, parse_flags)) =3D=3D NULL) goto cleanup; @@ -1718,7 +1699,7 @@ testDomainCreateXML(virConnectPtr conn, const char *x= ml, virObjectUnlock(dom); testObjectEventQueue(privconn, event); virDomainDefFree(def); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -2887,7 +2868,7 @@ static int testNodeGetCellsFreeMemory(virConnectPtr c= onn, size_t i; int ret =3D -1; =20 - testDriverLock(privconn); + virObjectLock(privconn); if (startCell >=3D privconn->numCells) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Range exceeds available cells")); @@ -2902,7 +2883,7 @@ static int testNodeGetCellsFreeMemory(virConnectPtr c= onn, ret =3D i; =20 cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -2960,12 +2941,12 @@ testNodeGetFreeMemory(virConnectPtr conn) unsigned int freeMem =3D 0; size_t i; =20 - testDriverLock(privconn); + virObjectLock(privconn); =20 for (i =3D 0; i < privconn->numCells; i++) freeMem +=3D privconn->cells[i].freeMem; =20 - testDriverUnlock(privconn); + virObjectUnlock(privconn); return freeMem; } =20 @@ -3002,7 +2983,7 @@ static int testDomainCreateWithFlags(virDomainPtr dom= ain, unsigned int flags) =20 virCheckFlags(0, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); =20 if (!(privdom =3D testDomObjFromDomain(domain))) goto cleanup; @@ -3026,7 +3007,7 @@ static int testDomainCreateWithFlags(virDomainPtr dom= ain, unsigned int flags) cleanup: virDomainObjEndAPI(&privdom); testObjectEventQueue(privconn, event); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -3797,9 +3778,9 @@ testInterfaceObjFindByName(testDriverPtr privconn, { virInterfaceObjPtr obj; =20 - testDriverLock(privconn); + virObjectLock(privconn); obj =3D virInterfaceObjListFindByName(privconn->ifaces, name); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!obj) virReportError(VIR_ERR_NO_INTERFACE, @@ -3816,9 +3797,9 @@ testConnectNumOfInterfaces(virConnectPtr conn) testDriverPtr privconn =3D conn->privateData; int ninterfaces; =20 - testDriverLock(privconn); + virObjectLock(privconn); ninterfaces =3D virInterfaceObjListNumOfInterfaces(privconn->ifaces, t= rue); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ninterfaces; } =20 @@ -3831,10 +3812,10 @@ testConnectListInterfaces(virConnectPtr conn, testDriverPtr privconn =3D conn->privateData; int nnames; =20 - testDriverLock(privconn); + virObjectLock(privconn); nnames =3D virInterfaceObjListGetNames(privconn->ifaces, true, names, maxnames); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return nnames; } @@ -3846,9 +3827,9 @@ testConnectNumOfDefinedInterfaces(virConnectPtr conn) testDriverPtr privconn =3D conn->privateData; int ninterfaces; =20 - testDriverLock(privconn); + virObjectLock(privconn); ninterfaces =3D virInterfaceObjListNumOfInterfaces(privconn->ifaces, f= alse); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ninterfaces; } =20 @@ -3861,10 +3842,10 @@ testConnectListDefinedInterfaces(virConnectPtr conn, testDriverPtr privconn =3D conn->privateData; int nnames; =20 - testDriverLock(privconn); + virObjectLock(privconn); nnames =3D virInterfaceObjListGetNames(privconn->ifaces, false, names, maxnames); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return nnames; } @@ -3899,10 +3880,10 @@ testInterfaceLookupByMACString(virConnectPtr conn, char *ifacenames[] =3D { NULL, NULL }; virInterfacePtr ret =3D NULL; =20 - testDriverLock(privconn); + virObjectLock(privconn); ifacect =3D virInterfaceObjListFindByMACString(privconn->ifaces, mac, ifacenames, 2); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (ifacect =3D=3D 0) { virReportError(VIR_ERR_NO_INTERFACE, @@ -3950,7 +3931,7 @@ testInterfaceChangeBegin(virConnectPtr conn, =20 virCheckFlags(0, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); if (privconn->transaction_running) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("there is another transaction running.")); @@ -3964,7 +3945,7 @@ testInterfaceChangeBegin(virConnectPtr conn, =20 ret =3D 0; cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -3978,7 +3959,7 @@ testInterfaceChangeCommit(virConnectPtr conn, =20 virCheckFlags(0, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); =20 if (!privconn->transaction_running) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -3993,7 +3974,7 @@ testInterfaceChangeCommit(virConnectPtr conn, ret =3D 0; =20 cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return ret; } @@ -4008,7 +3989,7 @@ testInterfaceChangeRollback(virConnectPtr conn, =20 virCheckFlags(0, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); =20 if (!privconn->transaction_running) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -4026,7 +4007,7 @@ testInterfaceChangeRollback(virConnectPtr conn, ret =3D 0; =20 cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -4066,7 +4047,7 @@ testInterfaceDefineXML(virConnectPtr conn, =20 virCheckFlags(0, NULL); =20 - testDriverLock(privconn); + virObjectLock(privconn); if ((def =3D virInterfaceDefParseString(xmlStr)) =3D=3D NULL) goto cleanup; =20 @@ -4080,7 +4061,7 @@ testInterfaceDefineXML(virConnectPtr conn, cleanup: virInterfaceDefFree(def); virInterfaceObjEndAPI(&obj); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -4184,9 +4165,9 @@ testStoragePoolObjFindByName(testDriverPtr privconn, { virStoragePoolObjPtr obj; =20 - testDriverLock(privconn); + virObjectLock(privconn); obj =3D virStoragePoolObjFindByName(privconn->pools, name); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!obj) virReportError(VIR_ERR_NO_STORAGE_POOL, @@ -4244,9 +4225,9 @@ testStoragePoolObjFindByUUID(testDriverPtr privconn, virStoragePoolObjPtr obj; char uuidstr[VIR_UUID_STRING_BUFLEN]; =20 - testDriverLock(privconn); + virObjectLock(privconn); obj =3D virStoragePoolObjFindByUUID(privconn->pools, uuid); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!obj) { virUUIDFormat(uuid, uuidstr); @@ -4312,10 +4293,10 @@ testConnectNumOfStoragePools(virConnectPtr conn) testDriverPtr privconn =3D conn->privateData; int numActive =3D 0; =20 - testDriverLock(privconn); + virObjectLock(privconn); numActive =3D virStoragePoolObjNumOfStoragePools(privconn->pools, conn, true, NULL); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return numActive; } @@ -4329,10 +4310,10 @@ testConnectListStoragePools(virConnectPtr conn, testDriverPtr privconn =3D conn->privateData; int n =3D 0; =20 - testDriverLock(privconn); + virObjectLock(privconn); n =3D virStoragePoolObjGetNames(privconn->pools, conn, true, NULL, names, maxnames); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return n; } @@ -4344,10 +4325,10 @@ testConnectNumOfDefinedStoragePools(virConnectPtr c= onn) testDriverPtr privconn =3D conn->privateData; int numInactive =3D 0; =20 - testDriverLock(privconn); + virObjectLock(privconn); numInactive =3D virStoragePoolObjNumOfStoragePools(privconn->pools, co= nn, false, NULL); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return numInactive; } @@ -4361,10 +4342,10 @@ testConnectListDefinedStoragePools(virConnectPtr co= nn, testDriverPtr privconn =3D conn->privateData; int n =3D 0; =20 - testDriverLock(privconn); + virObjectLock(privconn); n =3D virStoragePoolObjGetNames(privconn->pools, conn, false, NULL, names, maxnames); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return n; } @@ -4380,10 +4361,10 @@ testConnectListAllStoragePools(virConnectPtr conn, =20 virCheckFlags(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ALL, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); ret =3D virStoragePoolObjListExport(conn, privconn->pools, pools, NULL, flags); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return ret; } @@ -4545,7 +4526,7 @@ testStoragePoolCreateXML(virConnectPtr conn, =20 virCheckFlags(0, NULL); =20 - testDriverLock(privconn); + virObjectLock(privconn); if (!(newDef =3D virStoragePoolDefParseString(xml))) goto cleanup; =20 @@ -4596,7 +4577,7 @@ testStoragePoolCreateXML(virConnectPtr conn, virStoragePoolDefFree(newDef); testObjectEventQueue(privconn, event); virStoragePoolObjEndAPI(&obj); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return pool; } =20 @@ -4615,7 +4596,7 @@ testStoragePoolDefineXML(virConnectPtr conn, =20 virCheckFlags(0, NULL); =20 - testDriverLock(privconn); + virObjectLock(privconn); if (!(newDef =3D virStoragePoolDefParseString(xml))) goto cleanup; =20 @@ -4648,7 +4629,7 @@ testStoragePoolDefineXML(virConnectPtr conn, virStoragePoolDefFree(newDef); testObjectEventQueue(privconn, event); virStoragePoolObjEndAPI(&obj); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return pool; } =20 @@ -5050,7 +5031,7 @@ testStorageVolLookupByKey(virConnectPtr conn, .conn =3D conn, .key =3D key, .voldef =3D NULL }; virStorageVolPtr vol =3D NULL; =20 - testDriverLock(privconn); + virObjectLock(privconn); if ((obj =3D virStoragePoolObjListSearch(privconn->pools, testStorageVolLookupByKeyCallba= ck, &data)) && data.voldef) { @@ -5060,7 +5041,7 @@ testStorageVolLookupByKey(virConnectPtr conn, NULL, NULL); virStoragePoolObjEndAPI(&obj); } - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!vol) virReportError(VIR_ERR_NO_STORAGE_VOL, @@ -5094,7 +5075,7 @@ testStorageVolLookupByPath(virConnectPtr conn, .conn =3D conn, .path =3D path, .voldef =3D NULL }; virStorageVolPtr vol =3D NULL; =20 - testDriverLock(privconn); + virObjectLock(privconn); if ((obj =3D virStoragePoolObjListSearch(privconn->pools, testStorageVolLookupByPathCallb= ack, &data)) && data.voldef) { @@ -5104,7 +5085,7 @@ testStorageVolLookupByPath(virConnectPtr conn, NULL, NULL); virStoragePoolObjEndAPI(&obj); } - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!vol) virReportError(VIR_ERR_NO_STORAGE_VOL, @@ -6889,7 +6870,7 @@ testConnectRegisterCloseCallback(virConnectPtr conn, testDriverPtr priv =3D conn->privateData; int ret =3D -1; =20 - testDriverLock(priv); + virObjectLock(priv); =20 if (virConnectCloseCallbackDataGetCallback(priv->closeCallback) !=3D N= ULL) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -6902,7 +6883,7 @@ testConnectRegisterCloseCallback(virConnectPtr conn, ret =3D 0; =20 cleanup: - testDriverUnlock(priv); + virObjectUnlock(priv); return ret; } =20 @@ -6914,7 +6895,7 @@ testConnectUnregisterCloseCallback(virConnectPtr conn, testDriverPtr priv =3D conn->privateData; int ret =3D -1; =20 - testDriverLock(priv); + virObjectLock(priv); =20 if (virConnectCloseCallbackDataGetCallback(priv->closeCallback) !=3D c= b) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -6926,7 +6907,7 @@ testConnectUnregisterCloseCallback(virConnectPtr conn, ret =3D 0; =20 cleanup: - testDriverUnlock(priv); + virObjectUnlock(priv); return ret; } =20 --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511681030840.5550249363955; Thu, 8 Mar 2018 04:21:21 -0800 (PST) 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 8ACD181DF5; Thu, 8 Mar 2018 12:21:19 +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 601E69CD1; Thu, 8 Mar 2018 12:21:19 +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 12E1F180BAD4; Thu, 8 Mar 2018 12:21:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CL944016905 for ; Thu, 8 Mar 2018 07:21:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 402905D753; Thu, 8 Mar 2018 12:21:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 39DEF5D6B7 for ; Thu, 8 Mar 2018 12:21:09 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 528BD61B8F for ; Thu, 8 Mar 2018 12:21:08 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL0SZ088535 for ; Thu, 8 Mar 2018 07:21:08 -0500 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk2qr65s0-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:07 -0500 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:05 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:21:03 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CL2Bl56754196 for ; Thu, 8 Mar 2018 12:21:02 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DF13DA405B for ; Thu, 8 Mar 2018 12:13:57 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C2A52A4053 for ; Thu, 8 Mar 2018 12:13:57 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:57 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:37 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0012-0000-0000-000005BA5C6D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0013-0000-0000-000019367C6A Message-Id: <20180308122043.15608-15-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:08 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 14/20] remote: remove unneeded global variables 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: , MIME-Version: 1.0 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.25]); Thu, 08 Mar 2018 12:21:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Remove unneeded global variables and convert them into local variables where they're needed. Signed-off-by: Marc Hartmayer Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/remote/remote_daemon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index f8082f62f698..078430f91c97 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -72,9 +72,7 @@ VIR_LOG_INIT("daemon.libvirtd"); virNetSASLContextPtr saslCtxt =3D NULL; #endif virNetServerProgramPtr remoteProgram =3D NULL; -virNetServerProgramPtr adminProgram =3D NULL; virNetServerProgramPtr qemuProgram =3D NULL; -virNetServerProgramPtr lxcProgram =3D NULL; =20 volatile bool driversInitialized =3D false; =20 @@ -1062,6 +1060,8 @@ int main(int argc, char **argv) { virNetDaemonPtr dmn =3D NULL; virNetServerPtr srv =3D NULL; virNetServerPtr srvAdm =3D NULL; + virNetServerProgramPtr adminProgram =3D NULL; + virNetServerProgramPtr lxcProgram =3D NULL; char *remote_config_file =3D NULL; int statuswrite =3D -1; int ret =3D 1; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511686513669.5718748887471; Thu, 8 Mar 2018 04:21:26 -0800 (PST) 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 BB65013A4E; Thu, 8 Mar 2018 12:21:24 +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 3450A4384; Thu, 8 Mar 2018 12:21:24 +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 B125C4CAA7; Thu, 8 Mar 2018 12:21:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLBns016932 for ; Thu, 8 Mar 2018 07:21:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 085BB60F90; Thu, 8 Mar 2018 12:21:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0132A53B1A for ; Thu, 8 Mar 2018 12:21:10 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7AB0461D0F for ; Thu, 8 Mar 2018 12:21:08 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CKwi5088418 for ; Thu, 8 Mar 2018 07:21:08 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk2qr65rj-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:07 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:05 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:21:04 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CL37r44630184 for ; Thu, 8 Mar 2018 12:21:03 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1FA1EA404D for ; Thu, 8 Mar 2018 12:13:59 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01081A4040 for ; Thu, 8 Mar 2018 12:13:59 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:13:58 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:38 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0040-0000-0000-0000041C61D1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0041-0000-0000-0000261F7CA1 Message-Id: <20180308122043.15608-16-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:08 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 15/20] stream: Access stream->prog instead of a hard-coded global variable 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: , MIME-Version: 1.0 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.29]); Thu, 08 Mar 2018 12:21:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use stream->prog instead of a hard-coded virNetServerProgram. Especially since these functions are intended as generic helpers for streams. Signed-off-by: Marc Hartmayer Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/remote/remote_daemon_stream.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/remote/remote_daemon_stream.c b/src/remote/remote_daemon_s= tream.c index 4dd3af9e0d59..21f0ecd53844 100644 --- a/src/remote/remote_daemon_stream.c +++ b/src/remote/remote_daemon_stream.c @@ -213,7 +213,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) msg->cb =3D daemonStreamMessageFinished; msg->opaque =3D stream; stream->refs++; - if (virNetServerProgramSendStreamData(remoteProgram, + if (virNetServerProgramSendStreamData(stream->prog, client, msg, stream->procedure, @@ -253,7 +253,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) if (!msg) { ret =3D -1; } else { - ret =3D virNetServerProgramSendStreamError(remoteProgram, + ret =3D virNetServerProgramSendStreamError(stream->prog, client, msg, &rerr, @@ -644,7 +644,7 @@ daemonStreamHandleAbort(virNetServerClientPtr client, if (raise_error) { virNetMessageError rerr; memset(&rerr, 0, sizeof(rerr)); - return virNetServerProgramSendReplyError(remoteProgram, + return virNetServerProgramSendReplyError(stream->prog, client, msg, &rerr, @@ -839,7 +839,7 @@ daemonStreamHandleRead(virNetServerClientPtr client, VIR_DEBUG("rv=3D%d inData=3D%d length=3D%lld", rv, inData, length); =20 if (rv < 0) { - if (virNetServerProgramSendStreamError(remoteProgram, + if (virNetServerProgramSendStreamError(stream->prog, client, msg, &rerr, @@ -856,7 +856,7 @@ daemonStreamHandleRead(virNetServerClientPtr client, msg->cb =3D daemonStreamMessageFinished; msg->opaque =3D stream; stream->refs++; - if (virNetServerProgramSendStreamHole(remoteProgram, + if (virNetServerProgramSendStreamHole(stream->prog, client, msg, stream->procedure, @@ -887,7 +887,7 @@ daemonStreamHandleRead(virNetServerClientPtr client, /* Should never get this, since we're only called when we know * we're readable, but hey things change... */ } else if (rv < 0) { - if (virNetServerProgramSendStreamError(remoteProgram, + if (virNetServerProgramSendStreamError(stream->prog, client, msg, &rerr, @@ -906,7 +906,7 @@ daemonStreamHandleRead(virNetServerClientPtr client, msg->cb =3D daemonStreamMessageFinished; msg->opaque =3D stream; stream->refs++; - if (virNetServerProgramSendStreamData(remoteProgram, + if (virNetServerProgramSendStreamData(stream->prog, client, msg, stream->procedure, --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511682782221.2786582058652; Thu, 8 Mar 2018 04:21:22 -0800 (PST) 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 47B8AC057FA1; Thu, 8 Mar 2018 12:21:21 +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 09FF39CD1; Thu, 8 Mar 2018 12:21:21 +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 C52704CAA4; Thu, 8 Mar 2018 12:21:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLCMX016946 for ; Thu, 8 Mar 2018 07:21:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 23A3E5D753; Thu, 8 Mar 2018 12:21:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DB985D6B7 for ; Thu, 8 Mar 2018 12:21:12 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C4C061D0F for ; Thu, 8 Mar 2018 12:21:11 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL8wV041658 for ; Thu, 8 Mar 2018 07:21:11 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk495t5as-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:10 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:08 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:21:05 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CL4xC66060304 for ; Thu, 8 Mar 2018 12:21:04 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51400A4051 for ; Thu, 8 Mar 2018 12:14:00 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2ABD2A4040 for ; Thu, 8 Mar 2018 12:14:00 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:14:00 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:39 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0020-0000-0000-0000040044C3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0021-0000-0000-0000429489FB Message-Id: <20180308122043.15608-17-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:11 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 16/20] remote: Set eventID explicitly to an invalid value 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Mar 2018 12:21:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Set the eventID for remoteRelayDomainQemuMonitorEvent explicitly to an invalid value. Although the value is not used by remoteRelayDomainQemuMonitorEvent, but it might be less prone to errors for further refactorings. Signed-off-by: Marc Hartmayer Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/remote/remote_daemon_dispatch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index bf6c00348a5e..ff26574c9f6b 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -6215,6 +6215,7 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server ATTRIBUTE_U if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->eventID =3D -1; callback->callbackID =3D -1; ref =3D callback; if (VIR_APPEND_ELEMENT(priv->qemuEventCallbacks, --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 15205117232981012.1099253858558; Thu, 8 Mar 2018 04:22:03 -0800 (PST) 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 DB70D81DF4; Thu, 8 Mar 2018 12:22:01 +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 825F218ED8; Thu, 8 Mar 2018 12:22: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 263421808850; Thu, 8 Mar 2018 12:22:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLwmq017364 for ; Thu, 8 Mar 2018 07:21:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id F416C9CD3; Thu, 8 Mar 2018 12:21:57 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB02FD1CC for ; Thu, 8 Mar 2018 12:21:52 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CA8681255 for ; Thu, 8 Mar 2018 12:21:51 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CLgkb097037 for ; Thu, 8 Mar 2018 07:21:51 -0500 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk21xg34f-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:46 -0500 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:08 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:21:06 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CL6mZ53280926 for ; Thu, 8 Mar 2018 12:21:06 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E2E0A4051 for ; Thu, 8 Mar 2018 12:14:01 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D83EA404D for ; Thu, 8 Mar 2018 12:14:01 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:14:01 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:40 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0012-0000-0000-000005BA5C6E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0013-0000-0000-000019367C6B Message-Id: <20180308122043.15608-18-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 12:21:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 12:21:51 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 17/20] remote: Add the information which program has to be used to daemonClientEventCallback 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: , MIME-Version: 1.0 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.25]); Thu, 08 Mar 2018 12:22:02 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" As a result, you can later determine at the callback which program has to be used. This makes it easier to refactor the code in the future and is less prone to error. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/remote/remote_daemon_dispatch.c | 108 ++++++++++++++++++++------------= ---- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index ff26574c9f6b..9580e854efbe 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -78,6 +78,7 @@ VIR_LOG_INIT("daemon.remote"); =20 struct daemonClientEventCallback { virNetServerClientPtr client; + virNetServerProgramPtr program; int eventID; int callbackID; bool legacy; @@ -127,6 +128,7 @@ remoteEventCallbackFree(void *opaque) daemonClientEventCallbackPtr callback =3D opaque; if (!callback) return; + virObjectUnref(callback->program); virObjectUnref(callback->client); VIR_FREE(callback); } @@ -318,7 +320,7 @@ remoteRelayDomainEventLifecycle(virConnectPtr conn, data.detail =3D detail; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_domain_event_l= ifecycle_msg, &data); @@ -326,7 +328,7 @@ remoteRelayDomainEventLifecycle(virConnectPtr conn, remote_domain_event_callback_lifecycle_msg msg =3D { callback->cal= lbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LI= FECYCLE, (xdrproc_t)xdr_remote_domain_event_c= allback_lifecycle_msg, &msg); @@ -355,14 +357,14 @@ remoteRelayDomainEventReboot(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_REBOOT, (xdrproc_t)xdr_remote_domain_event_r= eboot_msg, &data); } else { remote_domain_event_callback_reboot_msg msg =3D { callback->callba= ckID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RE= BOOT, (xdrproc_t)xdr_remote_domain_event_c= allback_reboot_msg, &msg); } @@ -394,14 +396,14 @@ remoteRelayDomainEventRTCChange(virConnectPtr conn, data.offset =3D offset; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE, (xdrproc_t)xdr_remote_domain_event_r= tc_change_msg, &data); } else { remote_domain_event_callback_rtc_change_msg msg =3D { callback->ca= llbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RT= C_CHANGE, (xdrproc_t)xdr_remote_domain_event_c= allback_rtc_change_msg, &msg); } @@ -432,14 +434,14 @@ remoteRelayDomainEventWatchdog(virConnectPtr conn, data.action =3D action; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_WATCHDOG, (xdrproc_t)xdr_remote_domain_event_w= atchdog_msg, &data); } else { remote_domain_event_callback_watchdog_msg msg =3D { callback->call= backID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WA= TCHDOG, (xdrproc_t)xdr_remote_domain_event_c= allback_watchdog_msg, &msg); } @@ -476,14 +478,14 @@ remoteRelayDomainEventIOError(virConnectPtr conn, data.action =3D action; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_IO_ERROR, (xdrproc_t)xdr_remote_domain_event_i= o_error_msg, &data); } else { remote_domain_event_callback_io_error_msg msg =3D { callback->call= backID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO= _ERROR, (xdrproc_t)xdr_remote_domain_event_c= allback_io_error_msg, &msg); } @@ -527,14 +529,14 @@ remoteRelayDomainEventIOErrorReason(virConnectPtr con= n, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_RE= ASON, (xdrproc_t)xdr_remote_domain_event_i= o_error_reason_msg, &data); } else { remote_domain_event_callback_io_error_reason_msg msg =3D { callbac= k->callbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO= _ERROR_REASON, (xdrproc_t)xdr_remote_domain_event_c= allback_io_error_reason_msg, &msg); } @@ -601,14 +603,14 @@ remoteRelayDomainEventGraphics(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_GRAPHICS, (xdrproc_t)xdr_remote_domain_event_g= raphics_msg, &data); } else { remote_domain_event_callback_graphics_msg msg =3D { callback->call= backID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GR= APHICS, (xdrproc_t)xdr_remote_domain_event_c= allback_graphics_msg, &msg); } @@ -658,14 +660,14 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB, (xdrproc_t)xdr_remote_domain_event_b= lock_job_msg, &data); } else { remote_domain_event_callback_block_job_msg msg =3D { callback->cal= lbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BL= OCK_JOB, (xdrproc_t)xdr_remote_domain_event_c= allback_block_job_msg, &msg); } @@ -694,14 +696,14 @@ remoteRelayDomainEventControlError(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERR= OR, (xdrproc_t)xdr_remote_domain_event_c= ontrol_error_msg, &data); } else { remote_domain_event_callback_control_error_msg msg =3D { callback-= >callbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CO= NTROL_ERROR, (xdrproc_t)xdr_remote_domain_event_c= allback_control_error_msg, &msg); } @@ -752,14 +754,14 @@ remoteRelayDomainEventDiskChange(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE, (xdrproc_t)xdr_remote_domain_event_d= isk_change_msg, &data); } else { remote_domain_event_callback_disk_change_msg msg =3D { callback->c= allbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DI= SK_CHANGE, (xdrproc_t)xdr_remote_domain_event_c= allback_disk_change_msg, &msg); } @@ -800,14 +802,14 @@ remoteRelayDomainEventTrayChange(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE, (xdrproc_t)xdr_remote_domain_event_t= ray_change_msg, &data); } else { remote_domain_event_callback_tray_change_msg msg =3D { callback->c= allbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TR= AY_CHANGE, (xdrproc_t)xdr_remote_domain_event_c= allback_tray_change_msg, &msg); } @@ -836,14 +838,14 @@ remoteRelayDomainEventPMWakeup(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP, (xdrproc_t)xdr_remote_domain_event_p= mwakeup_msg, &data); } else { remote_domain_event_callback_pmwakeup_msg msg =3D { callback->call= backID, reason, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PM= WAKEUP, (xdrproc_t)xdr_remote_domain_event_c= allback_pmwakeup_msg, &msg); } @@ -872,14 +874,14 @@ remoteRelayDomainEventPMSuspend(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND, (xdrproc_t)xdr_remote_domain_event_p= msuspend_msg, &data); } else { remote_domain_event_callback_pmsuspend_msg msg =3D { callback->cal= lbackID, reason, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PM= SUSPEND, (xdrproc_t)xdr_remote_domain_event_c= allback_pmsuspend_msg, &msg); } @@ -909,14 +911,14 @@ remoteRelayDomainEventBalloonChange(virConnectPtr con= n, data.actual =3D actual; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHA= NGE, (xdrproc_t)xdr_remote_domain_event_b= alloon_change_msg, &data); } else { remote_domain_event_callback_balloon_change_msg msg =3D { callback= ->callbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BA= LLOON_CHANGE, (xdrproc_t)xdr_remote_domain_event_c= allback_balloon_change_msg, &msg); } @@ -946,14 +948,14 @@ remoteRelayDomainEventPMSuspendDisk(virConnectPtr con= n, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_D= ISK, (xdrproc_t)xdr_remote_domain_event_p= msuspend_disk_msg, &data); } else { remote_domain_event_callback_pmsuspend_disk_msg msg =3D { callback= ->callbackID, reason, da= ta }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PM= SUSPEND_DISK, (xdrproc_t)xdr_remote_domain_event_c= allback_pmsuspend_disk_msg, &msg); } @@ -986,7 +988,7 @@ remoteRelayDomainEventDeviceRemoved(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMO= VED, (xdrproc_t)xdr_remote_domain_event_d= evice_removed_msg, &data); @@ -994,7 +996,7 @@ remoteRelayDomainEventDeviceRemoved(virConnectPtr conn, remote_domain_event_callback_device_removed_msg msg =3D { callback= ->callbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DE= VICE_REMOVED, (xdrproc_t)xdr_remote_domain_event_c= allback_device_removed_msg, &msg); @@ -1031,7 +1033,7 @@ remoteRelayDomainEventBlockJob2(virConnectPtr conn, data.status =3D status; make_nonnull_domain(&data.dom, dom); =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2, (xdrproc_t)xdr_remote_domain_event_block= _job_2_msg, &data); =20 @@ -1069,7 +1071,7 @@ remoteRelayDomainEventTunable(virConnectPtr conn, return -1; } =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABL= E, (xdrproc_t)xdr_remote_domain_event_callb= ack_tunable_msg, &data); @@ -1104,7 +1106,7 @@ remoteRelayDomainEventAgentLifecycle(virConnectPtr co= nn, data.state =3D state; data.reason =3D reason; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_AGENT_= LIFECYCLE, (xdrproc_t)xdr_remote_domain_event_callb= ack_agent_lifecycle_msg, &data); @@ -1138,7 +1140,7 @@ remoteRelayDomainEventDeviceAdded(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE= _ADDED, (xdrproc_t)xdr_remote_domain_event_callb= ack_device_added_msg, &data); @@ -1171,7 +1173,7 @@ remoteRelayDomainEventMigrationIteration(virConnectPt= r conn, =20 data.iteration =3D iteration; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_MIGRAT= ION_ITERATION, (xdrproc_t)xdr_remote_domain_event_callb= ack_migration_iteration_msg, &data); @@ -1211,7 +1213,7 @@ remoteRelayDomainEventJobCompleted(virConnectPtr conn, return -1; } =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_CO= MPLETED, (xdrproc_t)xdr_remote_domain_event_callb= ack_job_completed_msg, &data); @@ -1244,7 +1246,7 @@ remoteRelayDomainEventDeviceRemovalFailed(virConnectP= tr conn, make_nonnull_domain(&data.dom, dom); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE= _REMOVAL_FAILED, (xdrproc_t)xdr_remote_domain_event_callb= ack_device_removal_failed_msg, &data); @@ -1288,7 +1290,7 @@ remoteRelayDomainEventMetadataChange(virConnectPtr co= nn, make_nonnull_domain(&data.dom, dom); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADA= TA_CHANGE, (xdrproc_t)xdr_remote_domain_event_callb= ack_metadata_change_msg, &data); @@ -1331,7 +1333,7 @@ remoteRelayDomainEventBlockThreshold(virConnectPtr co= nn, data.excess =3D excess; make_nonnull_domain(&data.dom, dom); =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD, (xdrproc_t)xdr_remote_domain_event_block= _threshold_msg, &data); =20 @@ -1396,7 +1398,7 @@ remoteRelayNetworkEventLifecycle(virConnectPtr conn, data.event =3D event; data.detail =3D detail; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_NETWORK_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_network_event_life= cycle_msg, &data); =20 @@ -1433,7 +1435,7 @@ remoteRelayStoragePoolEventLifecycle(virConnectPtr co= nn, data.event =3D event; data.detail =3D detail; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_storage_pool_event= _lifecycle_msg, &data); @@ -1461,7 +1463,7 @@ remoteRelayStoragePoolEventRefresh(virConnectPtr conn, make_nonnull_storage_pool(&data.pool, pool); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH, (xdrproc_t)xdr_remote_storage_pool_event= _refresh_msg, &data); @@ -1500,7 +1502,7 @@ remoteRelayNodeDeviceEventLifecycle(virConnectPtr con= n, data.event =3D event; data.detail =3D detail; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_NODE_DEVICE_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_node_device_event_= lifecycle_msg, &data); @@ -1528,7 +1530,7 @@ remoteRelayNodeDeviceEventUpdate(virConnectPtr conn, make_nonnull_node_device(&data.dev, dev); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE, (xdrproc_t)xdr_remote_node_device_event_= update_msg, &data); @@ -1567,7 +1569,7 @@ remoteRelaySecretEventLifecycle(virConnectPtr conn, data.event =3D event; data.detail =3D detail; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_SECRET_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_secret_event_lifec= ycle_msg, &data); @@ -1595,7 +1597,7 @@ remoteRelaySecretEventValueChanged(virConnectPtr conn, make_nonnull_secret(&data.secret, secret); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED, (xdrproc_t)xdr_remote_secret_event_value= _changed_msg, &data); @@ -1645,7 +1647,7 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr conn, data.details =3D details_p; make_nonnull_domain(&data.dom, dom); =20 - remoteDispatchObjectEventSend(callback->client, qemuProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, QEMU_PROC_DOMAIN_MONITOR_EVENT, (xdrproc_t)xdr_qemu_domain_monitor_event= _msg, &data); @@ -3900,6 +3902,7 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server ATTRIBUTE_UNUSED if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4136,6 +4139,7 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4212,6 +4216,7 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server ATTRI if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5735,6 +5740,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server ATTRIBUTE_UN if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5857,6 +5863,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server ATTRIBUT if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5978,6 +5985,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server ATTRIBUTE if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6099,6 +6107,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6215,6 +6224,7 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server ATTRIBUTE_U if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(qemuProgram); callback->eventID =3D -1; callback->callbackID =3D -1; ref =3D callback; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511707559917.2557852398663; Thu, 8 Mar 2018 04:21:47 -0800 (PST) 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 513F361473; Thu, 8 Mar 2018 12:21:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 050774384; Thu, 8 Mar 2018 12:21:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 88531180596F; Thu, 8 Mar 2018 12:21:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLh9a017189 for ; Thu, 8 Mar 2018 07:21:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id AE6555D78F; Thu, 8 Mar 2018 12:21:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6E535D78E for ; Thu, 8 Mar 2018 12:21:39 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28F945D5E9 for ; Thu, 8 Mar 2018 12:21:38 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CLV4J102972 for ; Thu, 8 Mar 2018 07:21:37 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk4apt2dw-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:35 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:08 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:21:07 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CL76556754214 for ; Thu, 8 Mar 2018 12:21:07 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6F51A4051 for ; Thu, 8 Mar 2018 12:14:02 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A6B4A404D for ; Thu, 8 Mar 2018 12:14:02 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:14:02 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:41 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0008-0000-0000-000004D95AFC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0009-0000-0000-00001E6C7AC5 Message-Id: <20180308122043.15608-19-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:38 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 18/20] remote: Use domainClientEventCallbacks for remoteReplayConnectionClosedEvent 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: , MIME-Version: 1.0 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.39]); Thu, 08 Mar 2018 12:21:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This allows us to get rid of another usage of the global variable remoteProgram. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/remote/remote_daemon_dispatch.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 9580e854efbe..95940ffdeefe 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1661,12 +1661,12 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr con= n, static void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED,= int reason, void *opaque) { - virNetServerClientPtr client =3D opaque; + daemonClientEventCallbackPtr callback =3D opaque; =20 VIR_DEBUG("Relaying connection closed event, reason %d", reason); =20 remote_connect_event_connection_closed_msg msg =3D { reason }; - remoteDispatchObjectEventSend(client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLO= SED, (xdrproc_t)xdr_remote_connect_event_conn= ection_closed_msg, &msg); @@ -3814,6 +3814,7 @@ remoteDispatchConnectRegisterCloseCallback(virNetServ= erPtr server ATTRIBUTE_UNUS virNetMessageErrorPtr rerr) { int rv =3D -1; + daemonClientEventCallbackPtr callback =3D NULL; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 @@ -3824,9 +3825,16 @@ remoteDispatchConnectRegisterCloseCallback(virNetSer= verPtr server ATTRIBUTE_UNUS goto cleanup; } =20 + if (VIR_ALLOC(callback) < 0) + goto cleanup; + callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); + /* eventID, callbackID, and legacy are not used */ + callback->eventID =3D -1; + callback->callbackID =3D -1; if (virConnectRegisterCloseCallback(priv->conn, remoteRelayConnectionClosedEvent, - client, NULL) < 0) + callback, remoteEventCallbackFree)= < 0) goto cleanup; =20 priv->closeRegistered =3D true; @@ -3834,8 +3842,10 @@ remoteDispatchConnectRegisterCloseCallback(virNetSer= verPtr server ATTRIBUTE_UNUS =20 cleanup: virMutexUnlock(&priv->lock); - if (rv < 0) + if (rv < 0) { + remoteEventCallbackFree(callback); virNetMessageSaveError(rerr); + } return rv; } =20 --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511718430136.35787773740765; Thu, 8 Mar 2018 04:21:58 -0800 (PST) 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 2D9047E9C9; Thu, 8 Mar 2018 12:21:57 +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 E78E4620AA; Thu, 8 Mar 2018 12:21:56 +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 86AFF4CAA4; Thu, 8 Mar 2018 12:21:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLspj017326 for ; Thu, 8 Mar 2018 07:21:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id DCE4418ED1; Thu, 8 Mar 2018 12:21:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7B2C18EDF for ; Thu, 8 Mar 2018 12:21:51 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E27C6356E4 for ; Thu, 8 Mar 2018 12:21:48 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CLhwO097123 for ; Thu, 8 Mar 2018 07:21:48 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk21xg35b-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:47 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:10 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:21:08 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CL8L553674168 for ; Thu, 8 Mar 2018 12:21:08 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF366A4040 for ; Thu, 8 Mar 2018 12:14:03 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B2EF7A4053 for ; Thu, 8 Mar 2018 12:14:03 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:14:03 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:42 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0020-0000-0000-0000040044C4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0021-0000-0000-0000429489FC Message-Id: <20180308122043.15608-20-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Mar 2018 12:21:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Mar 2018 12:21:49 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 19/20] rpc: Introduce virNetServerGetProgramLocked helper function 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: , MIME-Version: 1.0 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.26]); Thu, 08 Mar 2018 12:21:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch introduces virNetServerGetProgramLocked. It's a function to determine which program has to be used for a given @msg. This function will be reused in the next patch. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/rpc/virnetserver.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index 204f425264fa..4cd42ad7fd40 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -182,6 +182,29 @@ static void virNetServerHandleJob(void *jobOpaque, voi= d *opaque) VIR_FREE(job); } =20 + +/** + * virNetServerGetProgramLocked: + * @srv: server (must be locked by the caller) + * @msg: message + * + * Searches @srv for the right program for a given message @msg. + * + * Returns a pointer to the server program or NULL if not found. + */ +static virNetServerProgramPtr +virNetServerGetProgramLocked(virNetServerPtr srv, + virNetMessagePtr msg) +{ + size_t i; + for (i =3D 0; i < srv->nprograms; i++) { + if (virNetServerProgramMatches(srv->programs[i], msg)) + return srv->programs[i]; + } + return NULL; +} + + static int virNetServerDispatchNewMessage(virNetServerClientPtr client, virNetMessagePtr msg, void *opaque) @@ -189,19 +212,13 @@ static int virNetServerDispatchNewMessage(virNetServe= rClientPtr client, virNetServerPtr srv =3D opaque; virNetServerProgramPtr prog =3D NULL; unsigned int priority =3D 0; - size_t i; int ret =3D -1; =20 VIR_DEBUG("server=3D%p client=3D%p message=3D%p", srv, client, msg); =20 virObjectLock(srv); - for (i =3D 0; i < srv->nprograms; i++) { - if (virNetServerProgramMatches(srv->programs[i], msg)) { - prog =3D srv->programs[i]; - break; - } - } + prog =3D virNetServerGetProgramLocked(srv, msg); =20 if (srv->workers) { virNetServerJobPtr job; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 22:00:38 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 1520511701011315.5370460017433; Thu, 8 Mar 2018 04:21:41 -0800 (PST) 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 51B4B80F90; Thu, 8 Mar 2018 12:21:39 +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 E1DEE5C57B; Thu, 8 Mar 2018 12:21:38 +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 6EC37180BAED; Thu, 8 Mar 2018 12:21:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28CLI6x017005 for ; Thu, 8 Mar 2018 07:21:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 022EE5DD89; Thu, 8 Mar 2018 12:21:18 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF4585D9C8 for ; Thu, 8 Mar 2018 12:21:16 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B1B961D1C for ; Thu, 8 Mar 2018 12:21:14 +0000 (UTC) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28CL51k011791 for ; Thu, 8 Mar 2018 07:21:14 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gk1x706dv-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 07:21:13 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2018 12:21:11 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Mar 2018 12:21:09 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w28CL9jD59769030 for ; Thu, 8 Mar 2018 12:21:09 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A3A6A4040 for ; Thu, 8 Mar 2018 12:14:05 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DB7CDA404D for ; Thu, 8 Mar 2018 12:14:04 +0000 (GMT) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.51]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 8 Mar 2018 12:14:04 +0000 (GMT) From: Marc Hartmayer To: Date: Thu, 8 Mar 2018 13:20:43 +0100 In-Reply-To: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> References: <20180308122043.15608-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030812-0020-0000-0000-0000040044C6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030812-0021-0000-0000-0000429489FE Message-Id: <20180308122043.15608-21-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803080146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 12:21:14 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 20/20] remote/rpc: Use virNetServerGetProgram() to determine the program 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 08 Mar 2018 12:21:40 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use virNetServerGetProgram() to determine the virNetServerProgram instead of using hard coded global variables. This allows us to remove the global variables @remoteProgram and @qemuProgram as they're now no longer necessary. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- Note: I'm not 100% sure that there is no case where the lock for @client is already held by the thread which is calling virNetServerGetProgram and thus the lock order would be violated (the lock order has to be @server -> @client in the violating case it would be @client -> @server and therefore a deadlock might occur). --- src/libvirt_remote.syms | 1 + src/remote/remote_daemon.c | 4 +-- src/remote/remote_daemon.h | 3 --- src/remote/remote_daemon_dispatch.c | 52 ++++++++++++++++++---------------= ---- src/rpc/gendispatch.pl | 2 ++ src/rpc/virnetserver.c | 23 ++++++++++++++++ src/rpc/virnetserver.h | 2 ++ 7 files changed, 56 insertions(+), 31 deletions(-) diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms index 97e22275b980..c31b16cd5909 100644 --- a/src/libvirt_remote.syms +++ b/src/libvirt_remote.syms @@ -120,6 +120,7 @@ virNetServerGetCurrentUnauthClients; virNetServerGetMaxClients; virNetServerGetMaxUnauthClients; virNetServerGetName; +virNetServerGetProgram; virNetServerGetThreadPoolParameters; virNetServerHasClients; virNetServerNew; diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 078430f91c97..64f67ef2fefb 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -71,8 +71,6 @@ VIR_LOG_INIT("daemon.libvirtd"); #if WITH_SASL virNetSASLContextPtr saslCtxt =3D NULL; #endif -virNetServerProgramPtr remoteProgram =3D NULL; -virNetServerProgramPtr qemuProgram =3D NULL; =20 volatile bool driversInitialized =3D false; =20 @@ -1061,6 +1059,8 @@ int main(int argc, char **argv) { virNetServerPtr srv =3D NULL; virNetServerPtr srvAdm =3D NULL; virNetServerProgramPtr adminProgram =3D NULL; + virNetServerProgramPtr qemuProgram =3D NULL; + virNetServerProgramPtr remoteProgram =3D NULL; virNetServerProgramPtr lxcProgram =3D NULL; char *remote_config_file =3D NULL; int statuswrite =3D -1; diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h index 4467f71da910..93f2e1f531b0 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -82,7 +82,4 @@ struct daemonClientPrivate { # if WITH_SASL extern virNetSASLContextPtr saslCtxt; # endif -extern virNetServerProgramPtr remoteProgram; -extern virNetServerProgramPtr qemuProgram; - #endif /* __REMOTE_DAEMON_H__ */ diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 95940ffdeefe..3dce6195230e 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -3808,9 +3808,9 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr ser= ver ATTRIBUTE_UNUSED, } =20 static int -remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server ATTRIBUT= E_UNUSED, +remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_= UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr) { int rv =3D -1; @@ -3828,7 +3828,7 @@ remoteDispatchConnectRegisterCloseCallback(virNetServ= erPtr server ATTRIBUTE_UNUS if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(virNetServerGetProgram(server, msg)= ); /* eventID, callbackID, and legacy are not used */ callback->eventID =3D -1; callback->callbackID =3D -1; @@ -3912,7 +3912,7 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server ATTRIBUTE_UNUSED if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(virNetServerGetProgram(server, msg)= ); callback->eventID =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4110,9 +4110,9 @@ remoteDispatchDomainGetState(virNetServerPtr server A= TTRIBUTE_UNUSED, * VIR_DRV_SUPPORTS_FEATURE(VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK), * and must not mix the two styles. */ static int -remoteDispatchConnectDomainEventRegisterAny(virNetServerPtr server ATTRIBU= TE_UNUSED, +remoteDispatchConnectDomainEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE= _UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr ATT= RIBUTE_UNUSED, remote_connect_domain_event_re= gister_any_args *args) { @@ -4149,7 +4149,7 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(virNetServerGetProgram(server, msg)= ); callback->eventID =3D args->eventID; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4185,9 +4185,9 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU =20 =20 static int -remoteDispatchConnectDomainEventCallbackRegisterAny(virNetServerPtr server= ATTRIBUTE_UNUSED, +remoteDispatchConnectDomainEventCallbackRegisterAny(virNetServerPtr server, virNetServerClientPtr = client, - virNetMessagePtr msg A= TTRIBUTE_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr = rerr ATTRIBUTE_UNUSED, remote_connect_domain_= event_callback_register_any_args *args, remote_connect_domain_= event_callback_register_any_ret *ret) @@ -4226,7 +4226,7 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server ATTRI if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(virNetServerGetProgram(server, msg)= ); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5352,7 +5352,7 @@ remoteDispatchDomainMigratePrepareTunnel3Params(virNe= tServerPtr server ATTRIBUTE goto cleanup; =20 if (!(st =3D virStreamNew(priv->conn, VIR_STREAM_NONBLOCK)) || - !(stream =3D daemonCreateClientStream(client, st, remoteProgram, + !(stream =3D daemonCreateClientStream(client, st, virNetServerGetP= rogram(server, msg), &msg->header, false))) goto cleanup; =20 @@ -5709,9 +5709,9 @@ static int remoteDispatchDomainCreateWithFiles(virNet= ServerPtr server ATTRIBUTE_ =20 =20 static int -remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server ATTRIB= UTE_UNUSED, +remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUT= E_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr AT= TRIBUTE_UNUSED, remote_connect_network_event_= register_any_args *args, remote_connect_network_event_= register_any_ret *ret) @@ -5750,7 +5750,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server ATTRIBUTE_UN if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(virNetServerGetProgram(server, msg)= ); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5832,9 +5832,9 @@ remoteDispatchConnectNetworkEventDeregisterAny(virNet= ServerPtr server ATTRIBUTE_ } =20 static int -remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server AT= TRIBUTE_UNUSED, +remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server, virNetServerClientPtr cli= ent, - virNetMessagePtr msg ATTR= IBUTE_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rer= r ATTRIBUTE_UNUSED, remote_connect_storage_po= ol_event_register_any_args *args, remote_connect_storage_po= ol_event_register_any_ret *ret) @@ -5873,7 +5873,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server ATTRIBUT if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(virNetServerGetProgram(server, msg)= ); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5954,9 +5954,9 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(vi= rNetServerPtr server ATTRIB } =20 static int -remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATT= RIBUTE_UNUSED, +remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server, virNetServerClientPtr clie= nt, - virNetMessagePtr msg ATTRI= BUTE_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr= ATTRIBUTE_UNUSED, remote_connect_node_device= _event_register_any_args *args, remote_connect_node_device= _event_register_any_ret *ret) @@ -5995,7 +5995,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server ATTRIBUTE if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(virNetServerGetProgram(server, msg)= ); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6076,9 +6076,9 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(vir= NetServerPtr server ATTRIBU } =20 static int -remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server ATTRIBU= TE_UNUSED, +remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE= _UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr ATT= RIBUTE_UNUSED, remote_connect_secret_event_re= gister_any_args *args, remote_connect_secret_event_re= gister_any_ret *ret) @@ -6117,7 +6117,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(virNetServerGetProgram(server, msg)= ); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6198,9 +6198,9 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetS= erverPtr server ATTRIBUTE_U } =20 static int -qemuDispatchConnectDomainMonitorEventRegister(virNetServerPtr server ATTRI= BUTE_UNUSED, +qemuDispatchConnectDomainMonitorEventRegister(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBU= TE_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr A= TTRIBUTE_UNUSED, qemu_connect_domain_monitor_= event_register_args *args, qemu_connect_domain_monitor_= event_register_ret *ret) @@ -6234,7 +6234,7 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server ATTRIBUTE_U if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(qemuProgram); + callback->program =3D virObjectRef(virNetServerGetProgram(server, msg)= ); callback->eventID =3D -1; callback->callbackID =3D -1; ref =3D callback; diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index fb15cc4849bc..725319bf8da4 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -990,6 +990,7 @@ elsif ($mode eq "server") { if ($call->{streamflag} ne "none") { print " virStreamPtr st =3D NULL;\n"; print " daemonClientStreamPtr stream =3D NULL;\n"; + print " virNetServerProgramPtr remoteProgram =3D NULL;\n"; if ($call->{sparseflag} ne "none") { print " const bool sparse =3D args->flags & $call->{spa= rseflag};\n" } else { @@ -1037,6 +1038,7 @@ elsif ($mode eq "server") { print " if (!(st =3D virStreamNew(priv->conn, VIR_STREAM_NO= NBLOCK)))\n"; print " goto cleanup;\n"; print "\n"; + print " remoteProgram =3D virNetServerGetProgram(server, ms= g);\n"; print " if (!(stream =3D daemonCreateClientStream(client, s= t, remoteProgram, &msg->header, sparse)))\n"; print " goto cleanup;\n"; print "\n"; diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index 4cd42ad7fd40..b1ff4a0cd751 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -205,6 +205,29 @@ virNetServerGetProgramLocked(virNetServerPtr srv, } =20 =20 +/** + * virNetServerGetProgram: + * @srv: server (must NOT be locked by the caller) + * @msg: message + * + * Searches @srv for the right program for a given message @msg. + * + * Returns a pointer to the server program or NULL if not found. + */ +virNetServerProgramPtr +virNetServerGetProgram(virNetServerPtr srv, + virNetMessagePtr msg) +{ + virNetServerProgramPtr ret =3D NULL; + + virObjectLock(srv); + ret =3D virNetServerGetProgramLocked(srv, msg); + virObjectUnlock(srv); + + return ret; +} + + static int virNetServerDispatchNewMessage(virNetServerClientPtr client, virNetMessagePtr msg, void *opaque) diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h index a79c39fdb2e7..1867e46664ba 100644 --- a/src/rpc/virnetserver.h +++ b/src/rpc/virnetserver.h @@ -76,6 +76,8 @@ int virNetServerSetTLSContext(virNetServerPtr srv, virNetTLSContextPtr tls); # endif =20 +virNetServerProgramPtr virNetServerGetProgram(virNetServerPtr srv, + virNetMessagePtr msg); =20 int virNetServerAddClient(virNetServerPtr srv, virNetServerClientPtr client); --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list