Datastore utility functions
-
class DcInfo
Bases: tuple
DcInfo(ref, name, vmFolder)
-
name
Alias for field number 1
-
ref
Alias for field number 0
-
vmFolder
Alias for field number 2
-
dc_cache_reset()
-
disk_copy(session, dc_ref, src_file, dst_file)
Copies the source virtual disk to the destination.
-
disk_delete(session, dc_ref, file_path)
Deletes a virtual disk.
-
disk_move(session, dc_ref, src_file, dst_file)
Moves the source virtual disk to the destination.
The list of possible faults that the server can return on error
include:
- CannotAccessFile: Thrown if the source file or folder cannot be
moved because of insufficient permissions.
- FileAlreadyExists: Thrown if a file with the given name already
exists at the destination.
- FileFault: Thrown if there is a generic file error
- FileLocked: Thrown if the source file or folder is currently
locked or in use.
- FileNotFound: Thrown if the file or folder specified by sourceName
is not found.
- InvalidDatastore: Thrown if the operation cannot be performed on
the source or destination datastores.
- NoDiskSpace: Thrown if there is not enough space available on the
destination datastore.
- RuntimeFault: Thrown if any type of runtime fault is thrown that
is not covered by the other faults; for example,
a communication error.
-
file_copy(session, src_file, src_dc_ref, dst_file, dst_dc_ref)
-
file_delete(session, ds_path, dc_ref)
-
file_exists(session, ds_browser, ds_path, file_name)
Check if the file exists on the datastore.
-
file_move(session, dc_ref, src_file, dst_file)
Moves the source file or folder to the destination.
The list of possible faults that the server can return on error
include:
- CannotAccessFile: Thrown if the source file or folder cannot be
moved because of insufficient permissions.
- FileAlreadyExists: Thrown if a file with the given name already
exists at the destination.
- FileFault: Thrown if there is a generic file error
- FileLocked: Thrown if the source file or folder is currently
locked or in use.
- FileNotFound: Thrown if the file or folder specified by sourceName
is not found.
- InvalidDatastore: Thrown if the operation cannot be performed on
the source or destination datastores.
- NoDiskSpace: Thrown if there is not enough space available on the
destination datastore.
- RuntimeFault: Thrown if any type of runtime fault is thrown that
is not covered by the other faults; for example,
a communication error.
-
file_size(session, ds_browser, ds_path, file_name)
Returns the size of the specified file.
-
get_allowed_datastore_types(disk_type)
-
get_available_datastores(session, cluster=None, datastore_regex=None)
Get the datastore list and choose the first local storage.
-
get_datastore(session, cluster, datastore_regex=None, storage_policy=None, allowed_ds_types=frozenset(['VMFS', 'NFS', 'vsan', 'NFS41']))
Get the datastore list and choose the most preferable one.
-
get_dc_info(session, ds_ref)
Get the datacenter name and the reference.
-
get_sub_folders(session, ds_browser, ds_path)
Return a set of subfolders for a path on a datastore.
If the path does not exist then an empty set is returned.
-
mkdir(session, ds_path, dc_ref)
Creates a directory at the path specified. If it is just “NAME”,
then a directory with this name is created at the topmost level of the
DataStore.
-
search_datastore_spec(client_factory, file_name)
Builds the datastore search spec.