Removing File Service Domain

You can remove the file service domain using the vSphere Client by removing all the file shares and then disabling the vSAN File Service.

Here is an example of how to remove a file service domain 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 file service domain
   fsDomainQuerySpec = vim.vsan.FileServiceDomainQuerySpec()
   result = vcfs.QueryFileServiceDomains(fsDomainQuerySpec, cluster)
   print("Removing file service domain: %s" % result[0].config.name)
   vsanTask = vcfs.RemoveFileServiceDomain(result[0].uuid, cluster)
   vcTask = vsanapiutils.ConvertVsanTaskToVcTask(vsanTask, si._stub)
   vsanapiutils.WaitForTasks([vcTask], si)
   if vcTask.info.state != 'success':
      print("Failed to remove file service domain with error: %s"
            % vcTask.info.error)
      return -1
   print("Removed file service domain %s successfully"
         % result[0].config.name)