From nobody Sun Feb 8 16:49:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505829166739554.4533525994796; Tue, 19 Sep 2017 06:52:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11E597EAA0; Tue, 19 Sep 2017 13:52:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94BC65D6A8; Tue, 19 Sep 2017 13:52: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 5457E410B5; Tue, 19 Sep 2017 13:52:44 +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 v8JDQ7VZ012699 for ; Tue, 19 Sep 2017 09:26:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9020A5C6DE; Tue, 19 Sep 2017 13:26:07 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-150.phx2.redhat.com [10.3.116.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52ABA197F3 for ; Tue, 19 Sep 2017 13:26:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 11E597EAA0 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: John Ferlan To: libvir-list@redhat.com Date: Tue, 19 Sep 2017 09:25:11 -0400 Message-Id: <20170919132518.28151-13-jferlan@redhat.com> In-Reply-To: <20170919132518.28151-1-jferlan@redhat.com> References: <20170919132518.28151-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/19] storage: Use virStoragePoolObjGetDef accessor for iSCSI backend 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.28]); Tue, 19 Sep 2017 13:52:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In preparation for privatizing the object, use the accessor. Signed-off-by: John Ferlan --- src/storage/storage_backend_iscsi.c | 41 +++++++++++++++++++++------------= ---- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_back= end_iscsi.c index 14f3e09a8..b0c5096ad 100644 --- a/src/storage/storage_backend_iscsi.c +++ b/src/storage/storage_backend_iscsi.c @@ -83,7 +83,8 @@ static char * virStorageBackendISCSISession(virStoragePoolObjPtr pool, bool probe) { - return virISCSIGetSession(pool->def->source.devices[0].path, probe); + virStoragePoolDefPtr def =3D virStoragePoolObjGetDef(pool); + return virISCSIGetSession(def->source.devices[0].path, probe); } =20 =20 @@ -235,25 +236,26 @@ static int virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool, bool *isActive) { + virStoragePoolDefPtr def =3D virStoragePoolObjGetDef(pool); char *session =3D NULL; int ret =3D -1; =20 *isActive =3D false; =20 - if (pool->def->source.nhost !=3D 1) { + if (def->source.nhost !=3D 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Expected exactly 1 host for the storage pool")); return -1; } =20 - if (pool->def->source.hosts[0].name =3D=3D NULL) { + if (def->source.hosts[0].name =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing source host")); return -1; } =20 - if (pool->def->source.ndevice !=3D 1 || - pool->def->source.devices[0].path =3D=3D NULL) { + if (def->source.ndevice !=3D 1 || + def->source.devices[0].path =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing source device")); return -1; @@ -327,44 +329,45 @@ static int virStorageBackendISCSIStartPool(virConnectPtr conn, virStoragePoolObjPtr pool) { + virStoragePoolDefPtr def =3D virStoragePoolObjGetDef(pool); char *portal =3D NULL; char *session =3D NULL; int ret =3D -1; =20 - if (pool->def->source.nhost !=3D 1) { + if (def->source.nhost !=3D 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Expected exactly 1 host for the storage pool")); return -1; } =20 - if (pool->def->source.hosts[0].name =3D=3D NULL) { + if (def->source.hosts[0].name =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing source host")); return -1; } =20 - if (pool->def->source.ndevice !=3D 1 || - pool->def->source.devices[0].path =3D=3D NULL) { + if (def->source.ndevice !=3D 1 || + def->source.devices[0].path =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing source device")); return -1; } =20 if ((session =3D virStorageBackendISCSISession(pool, true)) =3D=3D NUL= L) { - if ((portal =3D virStorageBackendISCSIPortal(&pool->def->source)) = =3D=3D NULL) + if ((portal =3D virStorageBackendISCSIPortal(&def->source)) =3D=3D= NULL) goto cleanup; =20 /* Create a static node record for the IQN target. Must be done * in order for login to the target */ - if (virISCSINodeNew(portal, pool->def->source.devices[0].path) < 0) + if (virISCSINodeNew(portal, def->source.devices[0].path) < 0) goto cleanup; =20 - if (virStorageBackendISCSISetAuth(portal, conn, &pool->def->source= ) < 0) + if (virStorageBackendISCSISetAuth(portal, conn, &def->source) < 0) goto cleanup; =20 if (virISCSIConnectionLogin(portal, - pool->def->source.initiator.iqn, - pool->def->source.devices[0].path) < 0) + def->source.initiator.iqn, + def->source.devices[0].path) < 0) goto cleanup; } ret =3D 0; @@ -379,9 +382,10 @@ static int virStorageBackendISCSIRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, virStoragePoolObjPtr pool) { + virStoragePoolDefPtr def =3D virStoragePoolObjGetDef(pool); char *session =3D NULL; =20 - pool->def->allocation =3D pool->def->capacity =3D pool->def->available= =3D 0; + def->allocation =3D def->capacity =3D def->available =3D 0; =20 if ((session =3D virStorageBackendISCSISession(pool, false)) =3D=3D NU= LL) goto cleanup; @@ -403,6 +407,7 @@ static int virStorageBackendISCSIStopPool(virConnectPtr conn ATTRIBUTE_UNUSED, virStoragePoolObjPtr pool) { + virStoragePoolDefPtr def =3D virStoragePoolObjGetDef(pool); char *portal; char *session; int ret =3D -1; @@ -411,12 +416,12 @@ virStorageBackendISCSIStopPool(virConnectPtr conn ATT= RIBUTE_UNUSED, return 0; VIR_FREE(session); =20 - if ((portal =3D virStorageBackendISCSIPortal(&pool->def->source)) =3D= =3D NULL) + if ((portal =3D virStorageBackendISCSIPortal(&def->source)) =3D=3D NUL= L) return -1; =20 if (virISCSIConnectionLogout(portal, - pool->def->source.initiator.iqn, - pool->def->source.devices[0].path) < 0) + def->source.initiator.iqn, + def->source.devices[0].path) < 0) goto cleanup; ret =3D 0; =20 --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list