VMware Cloud Community
PavanHCL
Contributor
Contributor

API for vSAN data store name

Hello, 

I need to retrive the vSAN data store name. Please let me know which API I have to use and share sample code snippet for the same. Thanks in advance. 

0 Kudos
3 Replies
IRIX201110141
Champion
Champion

You can use Powershell and connect to your vCenter

PowerCLI C:\> Connect-VIServer

Cmdlet Connect-VIServer an der Befehlspipelineposition 1

Geben Sie Werte für die folgenden Parameter an:

Server[0]: foo.bar.local

Server[1]:

Name                           Port  User

----                           ----  ----

foo.bar.local                443   ad\user

PowerCLI C:\> If($(Get-Cluster | where {$_.VsanEnabled} | Measure).Count -gt 0){

Write-Host "VSAN Enabled Cluster"

Get-Cluster | where {$_.VsanEnabled} | Get-Datastore | where {$_.type -match "vsan"}

}

VSAN Enabled Cluster

Name                               FreeSpaceGB      CapacityGB

----                               -----------      ----------

vsanDatastore-Manage                 1.562,508       3.723,969

vsanDatastore-VDI                    5.334,477      10.730,953

Regards,

Joerg

0 Kudos
PavanHCL
Contributor
Contributor

Hello Joerg!

Thanks for the reply, My requirement is to fetch data store name using vSAN SDK/Java Code using API's. 

Kindly help me in this regard. Thank You

0 Kudos
IRIX201110141
Champion
Champion

Iam pretty sure that in your API also something like "get-datastore" exists and you only have to filter for "type = vsan".

A short search brings up

VMware-vSphere-Automation-SDK-Java where a get-type exists. So you can enumerate each datastore and check the type of.

I preferer only to investigate the way if there is are Clusters with VSAN enabled and than check for the datastores.

Regards,

Joerg

0 Kudos