Scripting Object - VcDatastore

Scripting-object corresponding to
Datastore
Attribute of
DatastoreBackingPoolMapping, DatastorePair, DatastoreSet, PolicyAssociation, RecoveredDevice, RecoveredTargetGroupMemberInfo, TargetGroupMemberInfo, VcBaseConfigInfoBackingInfo, VcBaseConfigInfoDiskFileBackingInfo, VcBaseConfigInfoFileBackingInfo, VcBaseConfigInfoRawDiskMappingBackingInfo, VcBatchResult, VcCheckResultDiskInfo, VcClusterComputeResource, VcClusterComputeResourceFtCompatibleDatastoresResult, VcClusterDasConfigInfo, VcComputeResource, VcDasHeartbeatDatastoreInfo, VcDatacenter, VcDatastoreEventArgument, VcDatastoreMountPathDatastorePair, VcDatastoreNotWritableOnHost, VcDatastoreSummary, VcDeltaDiskFormatNotSupported, VcDrsCorrelationPair, VcDrsDatastoreCorrelation, VcDrsHostIormStatus, VcDrsInjectorWorkload, VcDrsWorkloadCharacterization, VcFaultToleranceDiskSpec, VcFaultToleranceMetaSpec, VcFaultToleranceVMConfigSpec, VcHbrDiskMigrationAction, VcHostCacheConfigurationInfo, VcHostCacheConfigurationSpec, VcHostConfigInfo, VcHostConfigSummary, VcHostDatastoreBrowser, VcHostDatastoreBrowserSearchResults, VcHostDatastoreSystem, VcHostDatastoreSystemDatastoreResult, VcHostEsxAgentHostManagerConfigInfo, VcHostResignatureRescanResult, VcHostSystem, VcInaccessibleDatastore, VcInaccessibleFTMetadataDatastore, VcInvalidDatastore, VcInvalidDatastorePath, VcIORMNotSupportedHostOnDatastore, VcLargeRDMNotSupportedOnDatastore, VcMemoryFileFormatNotSupportedByDatastore, VcMemorySizeNotSupportedByDatastore, VcNodeDeploymentSpec, VcObjectInfo, VcOvfResourceMap, VcPassiveNodeDeploymentSpec, VcPlacementSpec, VcQuiesceDatastoreIOForHAFailed, VcRDMNotSupportedOnDatastore, VcStorageMigrationAction, VcStoragePlacementAction, VcStorageRequirement, VcStorageVmotionIncompatible, VcSwapDatastoreNotWritableOnHost, VcUnsupportedDatastore, VcUnSupportedDatastoreForVFlash, VcVAppCloneSpec, VcVAppCloneSpecResourceMap, VcVirtualApp, VcVirtualCdromIsoBackingInfo, VcVirtualDeviceFileBackingInfo, VcVirtualDiskFlatVer1BackingInfo, VcVirtualDiskFlatVer2BackingInfo, VcVirtualDiskRawDiskMappingVer1BackingInfo, VcVirtualDiskSeSparseBackingInfo, VcVirtualDiskSparseVer1BackingInfo, VcVirtualDiskSparseVer2BackingInfo, VcVirtualFloppyImageBackingInfo, VcVirtualMachine, VcVirtualMachineInstantCloneSpec, VcVirtualMachineRelocateSpec, VcVirtualMachineRelocateSpecDiskLocator, VcVirtualMachineUsageOnDatastore, VcVirtualNVDIMMBackingInfo, VcVirtualParallelPortFileBackingInfo, VcVirtualSerialPortFileBackingInfo, VcVslmCreateSpecBackingSpec, VcVslmCreateSpecDiskFileBackingSpec, VcVslmCreateSpecRawDiskMappingBackingSpec
Parameter to
attachDisk_Task, clearMetadata, cloneVStorageObject_Task, configureDatastoreIORM_Task, configureDatastoreIORMOnHost, createDirectory, createImportSpec, deleteVStorageObject_Task, drsQueryCorrelationResult, expandVmfsDatastore, extendDisk_Task, extendVmfsDatastore, getProvisionedSpace, getStorageIORMDeviceModel, hostCloneVStorageObject_Task, hostDeleteVStorageObject_Task, hostExtendDisk_Task, hostInflateDisk_Task, hostListVStorageObject, hostReconcileDatastoreInventory_Task, hostRelocateVStorageObject_Task, hostRenameVStorageObject, hostRetrieveVStorageObject, hostRetrieveVStorageObjectState, hostScheduleReconcileDatastoreInventory, hostUpdateVStorageObjectPolicy_Task, importOvf, importOvfAtUrl_Task, inflateDisk_Task, listVStorageObject, nfcFileManagement, notifyDatastore, queryAvailableDisksForVmfs, queryDatastoreBackingPoolMapping, queryDatastoreCapability, queryDatastorePerformanceSummary, queryDrsMigrationCapability, queryDrsMigrationCapabilityForPerformance, queryDrsMigrationCapabilityForPerformance, queryDrsMigrationCapabilityForPerformanceEx, queryVmfsDatastoreExpandOptions, queryVmfsDatastoreExtendOptions, reconcileDatastoreInventory_Task, relocateVStorageObject_Task, removeDatastore, removeDatastoreEx_Task, removeVVolDatastore_Task, renameVStorageObject, retrieveAllMetadata, retrieveVStorageObject, retrieveVStorageObjectState, scheduleReconcileDatastoreInventory, updateLocalSwapDatastore, updateVStorageObjectPolicy_Task, uploadFileToDatastore
Returned by
createLocalDatastore, createNasDatastore, createVmfsDatastore, createVvolDatastore, createVvolDatastoreInternal, drsQueryCorrelationResult, expandVmfsDatastore, extendVmfsDatastore, getAllDatastores, getAllDatastores, queryNfsDatastoreAssociatedWithFileSystem, queryVmfsDatastoreAssociatedWithLun

Scripting Object Description

Represents a storage location for virtual machine files. A storage location can be a VMFS volume, a directory on Network Attached Storage, or a local file system path.

A datastore is platform-independent and host-independent. Therefore, datastores do not change when the virtual machines they contain are moved between hosts. The scope of a datastore is a datacenter; the datastore is uniquely named within the datacenter.

Any reference to a virtual machine or file accessed by any host within the datacenter must use a datastore path. A datastore path has the form "[<datastore>] <path>", where <datastore> is the datastore name, and <path> is a slash-delimited path from the root of the datastore. An example datastore path is "[storage] path/to/config.vmx".

You may use the following characters in a path, but not in a datastore name: slash (/), backslash (\), and percent (%).

All references to files in the VIM API are implicitly done using datastore paths.

When a client creates a virtual machine, it may specify the name of the datastore, omitting the path; the system, meaning VirtualCenter or the host, automatically assigns filenames and creates directories on the given datastore. For example, specifying My_Datastore as a location for a virtual machine called MyVm results in a datastore location of My_Datastore\MyVm\MyVm.vmx.

Datastores are configured per host. As part of host configuration, a HostSystem can be configured to mount a set of network drives. Multiple hosts may be configured to point to the same storage location. There exists only one Datastore object per Datacenter, for each such shared location. Each Datastore object keeps a reference to the set of hosts that have mounted the datastore. A Datastore object can be removed only if no hosts currently have the datastore mounted.

Thus, managing datastores is done both at the host level and the datacenter level. Each host is configured explicitly with the set of datastores it can access. At the datacenter, a view of the datastores across the datacenter is shown.

Attributes

Name Type Description
accessibleBoolean

@since Unknown
alarmActionsEnabledBoolean

@since vSphere API 4.0
availableFieldVcCustomFieldDef []

@since VI API 2.5
browserVcHostDatastoreBrowser

@since VI API 2.5
capabilityVcDatastoreCapability

@since VI API 2.5
capacityNumber

@since Unknown
configIssueVcEvent []

@since VI API 2.5
configStatusVcManagedEntityStatus

@since VI API 2.5
customValueVcCustomFieldValue []

@since VI API 2.5
datastoreNativeCloneCapableBoolean

Check if native clone can be used to create a child disk on this datastore.

@since vSphere API 5.0

declaredAlarmStateVcAlarmState []

@since VI API 2.5
disabledMethodString []

@since VI API 2.5
effectiveRoleNumber []

@since VI API 2.5
freeSpaceNumber

@since Unknown
hostVcDatastoreHostMount []

@since VI API 2.5
idString

@since Unknown
infoVcDatastoreInfo

@since VI API 2.5
iormConfigurationVcStorageIORMInfo

@since vSphere API 4.1
morefVcManagedObjectReference

returns the ManagedObjectReference of this ManagedObject @since Unknown
nameString

@since VI API 2.5
overallStatusVcManagedEntityStatus

@since VI API 2.5
parentVcManagedEntity

@since VI API 2.5
permissionVcPermission []

@since VI API 2.5
provisionedSpaceNumber

@since Unknown
recentTaskVcTask []

@since VI API 2.5
sdkConnectionVcSdkConnection

@since Unknown
sdkIdString

@since Unknown
summaryVcDatastoreSummary

@since VI API 2.5
tagVcTag []

@since vSphere API 4.0
triggeredAlarmStateVcAlarmState []

@since VI API 2.5
typeStringDeprecated.

Returns the name for the this managed object's vim type @since Unknown
urlString

@since Unknown
valueVcCustomFieldValue []

@since VI API 2.5
vimHostVcSdkConnection

@since Unknown
vimIdString

@since Unknown
vimTypeString

@since Unknown
vmVcVirtualMachine []

@since VI API 2.5

Methods

Methods defined in this Scripting Object
_getRef, addTag, createTrigger, datastoreCleanupLocks_Task, datastoreEnterMaintenanceMode, datastoreExitMaintenanceMode_Task, destroy_Task, destroyDatastore, refreshDatastore, refreshDatastoreStorageInfo, reload, removeTag, rename_Task, renameDatastore, replaceEmbeddedFilePaths_Task, retrieveCustomValues, setCustomValue, updateVirtualMachineFiles_Task, updateVVolVirtualMachineFiles_Task

removeTag

Removes a set of tags from this object. @since vSphere API 4.0

Parameters

NameTypeDescription
arg0VcTag []


Return Value

Type Description
None

replaceEmbeddedFilePaths_Task

Internal version of {@link #updateVirtualMachineFiles updateVirtualMachineFiles} method. This method gets a direct mapping from old mount paths to new mount paths as an input, and does not validate these mount paths, unlike {@link #updateVirtualMachineFiles updateVirtualMachineFiles} method. This is an internal method that should be used exclusively between vCenter server and host agent. @since vSphere API 4.1

Parameters

NameTypeDescription
arg0VcKeyValue []


Return Value

Type Description
VcTask

destroy_Task

Destroys this object, deleting its contents and removing it from its parent folder (if any).

NOTE: The appropriate privilege must be held on the parent of the destroyed entity as well as the entity itself.

This method can throw one of several exceptions. The exact set of exceptions depends on the kind of entity that is being removed. See comments for each entity for more information on destroy behavior. @since VI API 2.5

Parameters

NameTypeDescription
None

Return Value

Type Description
VcTask

refreshDatastoreStorageInfo

Refreshes all storage related information including free-space, capacity, and detailed usage of virtual machines. Updated values are available in {@link #summary} and {@link #info}. @since vSphere API 4.0

Parameters

NameTypeDescription
None

Return Value

Type Description
None

createTrigger

@since Unknown

Parameters

NameTypeDescription
timeoutNumber

filterString

conditionString

filterToSyncString


Return Value

Type Description
Trigger

updateVVolVirtualMachineFiles_Task

Scan a VVol storage container to update file paths and objectID pointers embedded in virtual machine files on a given storage container. @since vSphere API 6.5

Parameters

NameTypeDescription
arg0VcDatastoreVVolContainerFailoverPair []


Return Value

Type Description
VcTask

destroyDatastore

Removes a datastore. A datastore can be removed only if it is not currently used by any host or virtual machine. @since VI API 2.5

Parameters

NameTypeDescription
None

Return Value

Type Description
None

_getRef

@since Unknown

Parameters

NameTypeDescription
None

Return Value

Type Description
VcManagedObjectReference

datastoreEnterMaintenanceMode

Puts the datastore in maintenance mode. While this task is running and when the datastore is in maintenance mode, no virtual machines can be powered on and no provisioning operations can be performed on the datastore. Once the call completes, it is safe to remove datastore without disrupting any virtual machines.

The task completes once there are no virtual machines on the datastore and no provisioning operations in progress on the datastore. The operation does not directly initiate any operations to evacuate or power-down powered-on virtual machines. However, if the datastore is part of a storage pod with VMware Storage DRS enabled, Storage DRS provides migration recommendations to evacuate the virtual machines. If Storage DRS is in fully-automatic mode, these are automatically scheduled. The task is cancellable. This method returns a {@link vim.storageDrs.StoragePlacementResult} object, which includes a {@link vim.Task} object with which to monitor the operation, and a list of recommendations and faults generated by Storage DRS when it tries to evacuate the virtual machines on the datastore. The recommendations and faults fields are set only if the datastore is a part of a storage pod with Storage DRS enabled. @since vSphere API 5.0

Parameters

NameTypeDescription
None

Return Value

Type Description
VcStoragePlacementResult

renameDatastore

Renames a datastore. @since VI API 2.5

Parameters

NameTypeDescription
arg0String


Return Value

Type Description
None

datastoreCleanupLocks_Task

Cleanup file locks in this datastore or in a subdiretory of this datastore. If subdirectory is not provided, all file locks in this datastore will be removed. Also no virtual machines should be registered with this datastore when CleanupLocks is called. If the subdirectory given does not exsit in the datastore, operation returns successfully.

Note: The method is currently implemented only for NFS volumes, VMFS and other (new)volume types has a no-op for this method.

Warning: This API leads to an ESX host unilaterally removing file locks. The ESX host CANNOT guarantee that no other hosts are using the same datastore. It is caller's responsibility to ensure that at time of this call, no hosts and virtual machines are using those file locks. Otherwise, file operation behavior may not be defined, or worse file corruption may occur.

@since vSphere API 6.0

Parameters

NameTypeDescription
arg0String


Return Value

Type Description
VcTask

setCustomValue

Assigns a value to a custom field. The setCustomValue method requires whichever updatePrivilege is defined as one of the {@link CustomFieldsManager.FieldDef#fieldInstancePrivileges} for the CustomFieldDef whose value is being changed. @since VI API 2.5

Parameters

NameTypeDescription
arg0String

arg1String


Return Value

Type Description
None

refreshDatastore

Explicitly refreshes free-space and capacity values in {@link #summary} and {@link #info}. @since VI API 2.5

Parameters

NameTypeDescription
None

Return Value

Type Description
None

updateVirtualMachineFiles_Task

Update file paths embedded in virtual machine files on the datastore. This can be called after the file system corresponding to the datastore has been resignatured or remounted. Any MountPathDatastorePairs where the new path is the same as the original file path will be ignored.

This method is only supported by vCenter server. Also, this method requires that the datastore is {@link vim.host.MountInfo#accessible accessible} from at least one host (ESX version 4.1 or above) in vCenter server.

While this operation is in progress, it is important that users do not initiate any operations that might read or write to any files on the datastore, such as registering a virtual machine with files residing on the datastore, or performing any virtual disk operations on any files in the datastore. These operations can potentially cause spurious file update failures, while at the same time they can prevent virtual machine files from being updated correctly.

If users intend to update multiple datastores using this method, it is strongly advised that the users do not initiate any operations that might read or write to files on any of the datastores, until all of them have been updated. The files of a single virtual machine can reside on multiple datastores, and thus all the involved datastores should be updated, before the virtual machine is considered updated completely. @since vSphere API 4.1

Parameters

NameTypeDescription
arg0VcDatastoreMountPathDatastorePair []


Return Value

Type Description
VcTask

reload

Reload the entity state. Clients only need to call this method if they changed some external state that affects the service without using the Web service interface to perform the change. For example, hand-editing a virtual machine configuration file affects the configuration of the associated virtual machine but the service managing the virtual machine might not monitor the file for changes. In this case, after such an edit, a client would call "reload" on the associated virtual machine to ensure the service and its clients have current data for the virtual machine. @since VI API 2.5

Parameters

NameTypeDescription
None

Return Value

Type Description
None

retrieveCustomValues

Retrieve Custom field values based on specified custom field keys. If there is no key specified, all custom values associated to this ManagedEntity will be returned. @since vSphere API 6.5

Parameters

NameTypeDescription
arg0Number []


Return Value

Type Description
VcCustomFieldValue []

datastoreExitMaintenanceMode_Task

Takes the datastore out of maintenance mode.

The task is cancellable.

@since vSphere API 5.0

Parameters

NameTypeDescription
None

Return Value

Type Description
VcTask

addTag

Add a set of tags to this object that can be queried later. The tag must be of the form "system/" or "global/ Parameters

NameTypeDescription
arg0VcTag []


Return Value

Type Description
None

rename_Task

Renames this managed entity.

Any % (percent) character used in this name parameter must be escaped, unless it is used to start an escape sequence. Clients may also escape any other characters in this name parameter.

@since VI API 2.5

Parameters

NameTypeDescription
arg0String


Return Value

Type Description
VcTask