From nobody Mon Feb 9 08:27:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1573649198; cv=none; d=zoho.com; s=zohoarc; b=KbCJl0t6VDSGH8BbF1XHO27As+evWAd/M92vesh7C9DZukBXr8qmOEBlY9avtL2OUqMGs7oplNFi1jcD/J0u3LkhGSrqtFolNWewlCRbXNMHdJDLWBbzAgnLWKy3cF7d5xq2NnuM6L85JvcxrCNbsZghSAewKSmAtGI0l1hZ6sg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573649198; 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=qWyCvZo30Tz14M0OHWt1raon5MG5mHY+TKrSNXjCUj0=; b=dXJ/nho1YYOcDyCPbGlx6BE8Q/mcayxwGXmQD9gStom7S8temYaiDSWyR/e0Lhjk4SL7v6c3OdC+86vRn0bxXP0YLFx73OmOhDBKwAXB7hIFrASjpVtTamQAWkMkhh52HnvJoHiEGo3Q5wNidxf2JtAuKBymRTq0wmM3vvrgQEs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 157364919822259.2538816199949; Wed, 13 Nov 2019 04:46:38 -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-158-wJBH47KPM-SiCwZlf0c9jw-1; Wed, 13 Nov 2019 07:46:35 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2E68100551D; Wed, 13 Nov 2019 12:46:29 +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 8A8D92D078; Wed, 13 Nov 2019 12:46:29 +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 505904E56C; Wed, 13 Nov 2019 12:46:29 +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 xADCkICp004695 for ; Wed, 13 Nov 2019 07:46:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 911C14DA0D; Wed, 13 Nov 2019 12:46:18 +0000 (UTC) Received: from lindworm.usersys.redhat.com (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C11C4DA0A for ; Wed, 13 Nov 2019 12:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573649196; 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=qWyCvZo30Tz14M0OHWt1raon5MG5mHY+TKrSNXjCUj0=; b=FVnASic452gSuf9TJZqpI3eIHQY5Gwi7erBfhjV3SCpchplM+L0YG7sZ7ImEfpHK6TBGZ9 kdVpebqn795Omhdfb1XAcRBrEVihZ9khPA38dGwfvGBEYqwhuZM0mUvXrtQLEdzmYQeFvX jjY21aI6iESfDD4vR8MRtU5h2FdfKF8= From: Pino Toscano To: libvir-list@redhat.com Date: Wed, 13 Nov 2019 13:46:08 +0100 Message-Id: <20191113124611.12076-3-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 2/5] esx: split datastorePoolType 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.15 X-MC-Unique: wJBH47KPM-SiCwZlf0c9jw-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 detection of the type of a vmfs pool out of esxLookupVMFSStoragePoolType in an own helper. This way it can be used also in other functions. Signed-off-by: Pino Toscano --- src/esx/esx_storage_backend_vmfs.c | 49 ++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backe= nd_vmfs.c index 78fe2b598d..b890825a40 100644 --- a/src/esx/esx_storage_backend_vmfs.c +++ b/src/esx/esx_storage_backend_vmfs.c @@ -54,26 +54,12 @@ verify(VIR_CRYPTO_HASH_SIZE_MD5 =3D=3D VIR_UUID_BUFLEN); =20 =20 static int -esxLookupVMFSStoragePoolType(esxVI_Context *ctx, const char *poolName, - int *poolType) +datastorePoolType(esxVI_ObjectContent *datastore, int *poolType) { int result =3D -1; - esxVI_String *propertyNameList =3D NULL; - esxVI_ObjectContent *datastore =3D NULL; esxVI_DynamicProperty *dynamicProperty =3D NULL; esxVI_DatastoreInfo *datastoreInfo =3D NULL; =20 - if (esxVI_String_AppendValueToList(&propertyNameList, "info") < 0 || - esxVI_LookupDatastoreByName(ctx, poolName, propertyNameList, &data= store, - esxVI_Occurrence_OptionalItem) < 0) { - goto cleanup; - } - - if (!datastore) { - /* Not found, let the base storage driver handle error reporting */ - goto cleanup; - } - for (dynamicProperty =3D datastore->propSet; dynamicProperty; dynamicProperty =3D dynamicProperty->_next) { if (STREQ(dynamicProperty->name, "info")) { @@ -100,10 +86,41 @@ esxLookupVMFSStoragePoolType(esxVI_Context *ctx, const= char *poolName, =20 result =3D 0; =20 + cleanup: + esxVI_DatastoreInfo_Free(&datastoreInfo); + + return result; +} + + + +static int +esxLookupVMFSStoragePoolType(esxVI_Context *ctx, const char *poolName, + int *poolType) +{ + int result =3D -1; + esxVI_String *propertyNameList =3D NULL; + esxVI_ObjectContent *datastore =3D NULL; + + if (esxVI_String_AppendValueToList(&propertyNameList, "info") < 0 || + esxVI_LookupDatastoreByName(ctx, poolName, propertyNameList, &data= store, + esxVI_Occurrence_OptionalItem) < 0) { + goto cleanup; + } + + if (!datastore) { + /* Not found, let the base storage driver handle error reporting */ + goto cleanup; + } + + if (datastorePoolType(datastore, poolType) < 0) + goto cleanup; + + result =3D 0; + cleanup: esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&datastore); - esxVI_DatastoreInfo_Free(&datastoreInfo); =20 return result; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list