Creating and Managing Datastores
Each datastore is a logical container, analogous to a file system on a logical volume, where the host places virtual disk files and other virtual machine files. Datastores hide specifics of the physical storage device and provide a uniform model for storing virtual machine files.
The HostDatastoreSystem managed object provides methods for creating and managing datastores. All HostDatastoreSystem methods require a managed object reference to HostDatastoreSystem, and return a reference to the Datastore object after it is created.
HostDatastoreSystem allows you to create and expand, query, and remove or update datastores. HostDatastoreSystem also allows you to configure a datastore principal for a host by calling ConfigureDatastorePrincipal. All virtual machine-related file I/O is performed under this user.
VMFS provisioning tasks are often performed as follows:
- Call QueryAvailableDisksForVmfs to get the subset of disks that are well suited for holding VMFS datastores.
QueryAvailableDisksForVmfs obtains a list of disks that can be used to contain VMFS datastore extents. You can provide a datastore name to obtain the list of disks that can contain extents for the specified VMFS datastore. The operation does not return disks currently used by the VMFS datastore, nor does it return management LUNs and disks that are referenced by RDMs. RDM disks are not usable for VMFS datastores.
- Get information about provisioning options by calling one of the following methods, passing in the selected disk:
- QueryVmfsDatastoreCreateOptions – Obtains information about options for creating a new VMFS datastore on a disk. The method returns an array of VmfsDatastoreOption data objects.
- QueryVmfsDatastoreExpandOptions – Obtains information about options for expanding the extents of an existing VMFS datastore.
- QueryVmfsDatastoreExtendOptions – Obtains information about options for extending an existing VMFS datastore for a disk.
- If required, change the layout by calling HostStorageSystem.ComputeDiskPartitionInfo and then HostStorageSystem.UpdateDiskPartition to resize the partition.
- Call CreateVmfsDatastore, ExtendVmfsDatastore, or ExpandVmfsDatastore to complete the VMFS provisioning operation.