Enabling File Service

You can enable vSAN File Service using the vSphere Client. Navigate to the vSAN cluster and click Configure > vSAN > Services. On the File Service row, click Enable.

Here is an example of how to enable vSAN File Service 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.

# Enable file service
   print("Enabling the file service")
   network = cluster.host[0].network[0]
   fileServiceConfig = vim.vsan.FileServiceConfig(
         enabled=True,
         network=network,
         domains=[],
   )
   clusterSpec = vim.vsan.ReconfigSpec(fileServiceConfig=fileServiceConfig)
   vsanTask = vccs.ReconfigureEx(cluster, clusterSpec)
   vcTask = vsanapiutils.ConvertVsanTaskToVcTask(vsanTask, si._stub)
   vsanapiutils.WaitForTasks([vcTask], si)
   if vcTask.info.state != 'success':
      print("Failed to enable file service with error: %s"
            % vcTask.info.error)
      return -1
   print("Enabled file service successfully")