From nobody Mon Feb 9 00:20:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573649191; cv=none; d=zoho.com; s=zohoarc; b=WMFd6Adx9n49B7CSvtgiGRC4Q3B9uagEEquGhL0O6mALh6faGpg84KVG3tu+IvJi9XlnzlVE2SfrrJlsC5BNs5xvYV6WhIGPV38MpLxjSwT4DRPEzxx8006WfnoknOqotvpg+wROGQC2/KG9oKyeoL9XQZGjXjEqo8SNLw4oRP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573649191; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EL4lpPSNQzg02kjXbrFeq6rWxhQOQomVHXWwxYS1FjQ=; b=jb9okyWIij0AOKNOnMkVOr1FroK2rQscVC/94fjGeVS6ztxQpPBeU3P2pKRgoXAtepCJ0IQGSSZSDsJVt5c5AIGQaCmqAr167uxTUpXJvYgGJYHC8CTuvKphhJk0d/WVPdRNr3OsVRWLb5gZUr1u0eHugler7X/p4Ke2oGMS0Tw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 157364919105985.35784512310602; Wed, 13 Nov 2019 04:46:31 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151--cLYQE3lM5Sh6q1PnBUDMw-1; Wed, 13 Nov 2019 07:46:28 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7F83A801E54; Wed, 13 Nov 2019 12:46:22 +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 500B960CCC; Wed, 13 Nov 2019 12:46:22 +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 119BD4BB78; Wed, 13 Nov 2019 12:46:22 +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 xADCkJdl004702 for ; Wed, 13 Nov 2019 07:46:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5F4484DA0D; Wed, 13 Nov 2019 12:46:19 +0000 (UTC) Received: from lindworm.usersys.redhat.com (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC1674DA0A for ; Wed, 13 Nov 2019 12:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573649189; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EL4lpPSNQzg02kjXbrFeq6rWxhQOQomVHXWwxYS1FjQ=; b=QeQ8jhb+ALCs1fvsj0sA2rwSJrx0Lh2TRIPY+79cDB5j9wniZ6pI2+IkPC6KwyZizOINTD rF/M5bS+RlaO0H8oQfBM9QWRMVCyzB8pEMTBWtSYXBtrUZf5rBozyUQtL91twmbGQNNEx6 wK53h9MLn1BrUgP4WklnlWzLz30PZBY= From: Pino Toscano To: libvir-list@redhat.com Date: Wed, 13 Nov 2019 13:46:09 +0100 Message-Id: <20191113124611.12076-4-ptoscano@redhat.com> In-Reply-To: <20191113124611.12076-1-ptoscano@redhat.com> References: <20191113124611.12076-1-ptoscano@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] esx: split targetToStoragePool helper 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: , 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-MC-Unique: -cLYQE3lM5Sh6q1PnBUDMw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Move the creation of a virStoragePtr object from the esxVI_HostInternetScsiHbaStaticTarget object of a target out of esxStoragePoolLookupByName in an own helper. This way it can be used also in other functions. Signed-off-by: Pino Toscano --- src/esx/esx_storage_backend_iscsi.c | 32 +++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_back= end_iscsi.c index 61354a6938..72ab0d3cb0 100644 --- a/src/esx/esx_storage_backend_iscsi.c +++ b/src/esx/esx_storage_backend_iscsi.c @@ -147,14 +147,32 @@ esxConnectListStoragePools(virConnectPtr conn, char *= *const names, =20 =20 =20 +static virStoragePoolPtr +targetToStoragePool(virConnectPtr conn, + const char *name, + esxVI_HostInternetScsiHbaStaticTarget *target) +{ + /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; + + /* + * HostInternetScsiHbaStaticTarget does not provide a uuid field, + * but iScsiName (or widely known as IQN) is unique across the multiple + * hosts, using it to compute key + */ + if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, target->iScsiName, md5) < 0) + return NULL; + + return virGetStoragePool(conn, name, md5, &esxStorageBackendISCSI, NUL= L); +} + + static virStoragePoolPtr esxStoragePoolLookupByName(virConnectPtr conn, const char *name) { esxPrivate *priv =3D conn->privateData; esxVI_HostInternetScsiHbaStaticTarget *target =3D NULL; - /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ - unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; virStoragePoolPtr pool =3D NULL; =20 /* @@ -172,15 +190,7 @@ esxStoragePoolLookupByName(virConnectPtr conn, goto cleanup; } =20 - /* - * HostInternetScsiHbaStaticTarget does not provide a uuid field, - * but iScsiName (or widely known as IQN) is unique across the multiple - * hosts, using it to compute key - */ - if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, target->iScsiName, md5) < 0) - goto cleanup; - - pool =3D virGetStoragePool(conn, name, md5, &esxStorageBackendISCSI, N= ULL); + pool =3D targetToStoragePool(conn, name, target); =20 cleanup: esxVI_HostInternetScsiHbaStaticTarget_Free(&target); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list