Removing a File Share

You can remove a file share using the vSphere Client. Navigate to the vSAN cluster and then click Configure > vSAN > File Service Shares. Select the file share that you want to remove and then click DELETE.

Here is an example of how to remove a file share 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.

# Remove a file share
   print("Removing file share: %s" % fileShareName)
   fileShareQuerySpec = vim.vsan.FileShareQuerySpec()
   fileShareQuerySpec.domainName = domainName
   fileShareQuerySpec.names = [fileShareName]
   QueryResult = vcfs.QueryFileShares(fileShareQuerySpec, cluster)
   result = QueryResult.fileShares
   vsanTask = vcfs.RemoveFileShare(result[0].uuid, cluster)
   vcTask = vsanapiutils.ConvertVsanTaskToVcTask(vsanTask, si._stub)
   vsanapiutils.WaitForTasks([vcTask], si)
   if vcTask.info.state != 'success':
      print("Failed to remove a file share with error: %s"
            % vcTask.info.error)
      return -1
   print("Removed file share %s successfully"
         % result[0].config.name)