3 Replies Latest reply on Aug 28, 2019 10:24 PM by IRIX201110141

    API for vSAN data store name

    PavanHCL Lurker

      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. 

        • 1. Re: API for vSAN data store name
          IRIX201110141 Master

          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

          • 2. Re: API for vSAN data store name
            PavanHCL Lurker

            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

            • 3. Re: API for vSAN data store name
              IRIX201110141 Master

              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