From nobody Sun Feb 8 18:48:55 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=1573821685; cv=none; d=zoho.com; s=zohoarc; b=iMPcf31b1u0HCHWbMAGLcT/E+nemCeKayRkmvniALaub/4nJo0/fJQgbx/hQB7DOKbM0FwIdCC4Qi8CJJ0Bpr9cAWsQ0lPnByDOfCxAWP9dbelBM3SNW6YZsBuaOsXLNnMPuppKXHOXmi9V4b75r/yGPSDtEVJgrsr8glkkibe8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573821685; 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=mhbp7twquJIyQ+w+PuyvFmf0CjZXu+ZfpeanGdyvXlM=; b=MO9xwY88rZjKmEYhdl3NNumCd9Ct4uopcizu7thGLRyRy5GZYLuSVQaI2i9B8C3JkWMQ3dTcr8R6HcMJ+a2A2oeIKQ1U+EpHYlI2pMaKnNGDtgWISidMwrSmLIk2n4m6YFcqwWHqZnd9a+3ckcUZiE7BgKtxLeQBS2vzh5RXqSQ= 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 1573821685691530.7544271098097; Fri, 15 Nov 2019 04:41:25 -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-115-j35wfe3uOtCj2gRI8Vaq0w-1; Fri, 15 Nov 2019 07:41:21 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id AE4F481A334; Fri, 15 Nov 2019 12:41:15 +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 8924875E45; Fri, 15 Nov 2019 12:41: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 48DEB18089D6; Fri, 15 Nov 2019 12:41:15 +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 xAFCexhJ026953 for ; Fri, 15 Nov 2019 07:40:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9984B5DC1B; Fri, 15 Nov 2019 12:40:59 +0000 (UTC) Received: from lindworm.usersys.redhat.com (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 242475E262 for ; Fri, 15 Nov 2019 12:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573821684; 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=mhbp7twquJIyQ+w+PuyvFmf0CjZXu+ZfpeanGdyvXlM=; b=MvRD/8i2bE7NNtfoEjbx871aBP9/VOVOtZwjaB/7bvT03wb2gNSYmyaTNCIqrJTuZfvpf3 qv3rRpa8QqmOubhgXyvlPTUUu/PXTzj5RZnKJqYACD28fzWFJBOfSIcpi/hczcSskhfVxD eIeGeE7hlOivMrhH8WKfDryZhLyubPQ= From: Pino Toscano To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 13:40:40 +0100 Message-Id: <20191115124051.989-2-ptoscano@redhat.com> In-Reply-To: <20191115124051.989-1-ptoscano@redhat.com> References: <20191115124051.989-1-ptoscano@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 01/12] esx: split datastoreToStoragePoolPtr 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.16 X-MC-Unique: j35wfe3uOtCj2gRI8Vaq0w-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_ObjectContent object of a datastore out of esxStoragePoolLookupByName in an own helper. This way it can be used also in other functions. Signed-off-by: Pino Toscano Reviewed-by: J=C3=A1n Tomko --- src/esx/esx_storage_backend_vmfs.c | 45 ++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backe= nd_vmfs.c index 5f25f80072..78fe2b598d 100644 --- a/src/esx/esx_storage_backend_vmfs.c +++ b/src/esx/esx_storage_backend_vmfs.c @@ -195,26 +195,16 @@ esxConnectListStoragePools(virConnectPtr conn, char *= *const names, =20 =20 static virStoragePoolPtr -esxStoragePoolLookupByName(virConnectPtr conn, - const char *name) +datastoreToStoragePoolPtr(virConnectPtr conn, + const char *name, + esxVI_ObjectContent *datastore) { esxPrivate *priv =3D conn->privateData; - esxVI_ObjectContent *datastore =3D NULL; esxVI_DatastoreHostMount *hostMount =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 - if (esxVI_LookupDatastoreByName(priv->primary, name, NULL, &datastore, - esxVI_Occurrence_OptionalItem) < 0) { - goto cleanup; - } - - if (!datastore) { - /* Not found, let the base storage driver handle error reporting */ - goto cleanup; - } - /* * Datastores don't have a UUID, but we can use the 'host.mountInfo.pa= th' * property as source for a UUID. The mount path is unique per host and @@ -239,7 +229,6 @@ esxStoragePoolLookupByName(virConnectPtr conn, pool =3D virGetStoragePool(conn, name, md5, &esxStorageBackendVMFS, NU= LL); =20 cleanup: - esxVI_ObjectContent_Free(&datastore); esxVI_DatastoreHostMount_Free(&hostMount); =20 return pool; @@ -247,6 +236,34 @@ esxStoragePoolLookupByName(virConnectPtr conn, =20 =20 =20 +static virStoragePoolPtr +esxStoragePoolLookupByName(virConnectPtr conn, + const char *name) +{ + esxPrivate *priv =3D conn->privateData; + esxVI_ObjectContent *datastore =3D NULL; + virStoragePoolPtr pool =3D NULL; + + if (esxVI_LookupDatastoreByName(priv->primary, name, NULL, &datastore, + esxVI_Occurrence_OptionalItem) < 0) { + goto cleanup; + } + + if (!datastore) { + /* Not found, let the base storage driver handle error reporting */ + goto cleanup; + } + + pool =3D datastoreToStoragePoolPtr(conn, name, datastore); + + cleanup: + esxVI_ObjectContent_Free(&datastore); + + return pool; +} + + + static virStoragePoolPtr esxStoragePoolLookupByUUID(virConnectPtr conn, const unsigned char *uuid) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list