Creating a File Share

You can create a file share using the vSphere Client. Navigate to the vSAN cluster and then click Configure > vSAN > File Service Shares > Add.

vSAN File Service does not support using these file shares as NFS datastores on ESXi.

Here is an example of how to create file shares using the vSAN Management API. This example is based on the code in the vsanfssamples.py sample file located under the Python sample code directory.

# Create a file share
   fileShareConfig = getFileShareConfig(si._stub, context, domainName)
   if not fileShareConfig:
      print("Failed to get file share config")
      return -1

   fileShareName = fileShareConfig.name
   print("Creating a file share: %s" % fileShareName)
   vsanTask = vcfs.CreateFileShare(fileShareConfig, cluster)
   vcTask = vsanapiutils.ConvertVsanTaskToVcTask(vsanTask, si._stub)
   vsanapiutils.WaitForTasks([vcTask], si)
   if vcTask.info.state != 'success':
      print("Failed to create a file share with error: %s"
            % vcTask.info.error)
      return -1
   print("Created file share %s successfully" % fileShareName)