Files
deb-python-pyvmomi/docs/vim/vm/guest/FileManager.rst
Shawn Hartsock 15f7be9a52 pyVmomi reStructured Text Documentation
This external documentation for pyVmomi was generated using Googly Docs
(aka Google Standard Documentation) which renders very cleanly in
GitHub. Internal documentation for a class should be done in Sphinx
format because tools like pyCharm and Eclipse can use that documentation
as a hint for code completion.

Note: External docs as Googly Docs, internal docs as Sphinx.

Closes bug#15
2014-06-17 14:07:42 -04:00

26 KiB

vim.vm.guest.FileManager

FileManager is the managed object that provides APIs to manipulate the guest operating system files.

since

vSphere API 5.0

Attributes

Methods

MakeDirectoryInGuest(vm, auth, directoryPath, createParentDirectories):

Creates a directory in the guest OS

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

directoryPath (str):

The complete path to the directory to be created.

createParentDirectories (bool):

Whether any parent directories are to be created.

Returns:

None

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the directory cannot be created because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.FileAlreadyExists:

if the specified object already exists.

vim.fault.GuestComponentsOutOfDate:

if the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

if the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

if the operation is not enabled due to guest agent configuration.

DeleteFileInGuest(vm, auth, filePath):

Deletes a file in the guest OS

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

filePath (str):

The complete path to the file or symbolic link to be deleted.

Returns:

None

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.NotAFile:

if the specified object is not a file.

vim.fault.GuestComponentsOutOfDate:

if the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

if the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

if the operation is not enabled due to guest agent configuration.

DeleteDirectoryInGuest(vm, auth, directoryPath, recursive):

Deletes a directory in the guest OS.

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

directoryPath (str):

The complete path to the directory to be deleted.

recursive (bool):

If true, all subdirectories are also deleted. If false, the directory must be empty for the operation to succeed.

Returns:

None

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.NotADirectory:

if the specified object is not a directory.

vim.fault.GuestComponentsOutOfDate:

if the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

if the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

if the operation is not enabled due to guest agent configuration.

MoveDirectoryInGuest(vm, auth, srcDirectoryPath, dstDirectoryPath):

Moves or renames a directory in the guest.

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

srcDirectoryPath (str):

The complete path to the directory to be moved.

dstDirectoryPath (str):

The complete path to the where the directory is moved or its new name. It cannot be a path to an existing directory or an existing file.

Returns:

None

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.GuestComponentsOutOfDate:

if the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

if the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

if the operation is not enabled due to guest agent configuration.

MoveFileInGuest(vm, auth, srcFilePath, dstFilePath, overwrite):

Renames a file in the guest.

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

srcFilePath (str):

The complete path to the original file or symbolic link to be moved.

dstFilePath (str):

The complete path to the where the file is renamed. It cannot be a path to an existing diectory.

overwrite (bool):

If set, the destination file is clobbered.

Returns:

None

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.GuestComponentsOutOfDate:

if the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

if the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

if the operation is not enabled due to guest agent configuration.

CreateTemporaryFileInGuest(vm, auth, prefix, suffix, directoryPath):

Creates a temporary file.Creates a new unique temporary file for the user to use as needed. The user is responsible for removing it when it is no longer needed.

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

prefix (str):

The prefix to be given to the new temporary file.

suffix (str):

The suffix to be given to the new temporary file.

directoryPath (str, optional):

The complete path to the directory in which to create the file. If unset, or an empty string, a guest-specific location will be used.

Returns:
str:

The absolute path of the temporary file that is created.

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.GuestComponentsOutOfDate:

if the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

if the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

if the operation is not enabled due to guest agent configuration.

CreateTemporaryDirectoryInGuest(vm, auth, prefix, suffix, directoryPath):

Creates a temporary directory.Creates a new unique temporary directory for the user to use as needed. The user is responsible for removing it when it is no longer needed.

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

prefix (str):

The prefix to be given to the new temporary directory.

suffix (str):

The suffix to be given to the new temporary directory.

directoryPath (str, optional):

The complete path to the directory in which to create the new directory. If unset or an empty string, a guest-specific location will be used.

Returns:
str:

The absolute path of the temporary directory that is created.

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.GuestComponentsOutOfDate:

if the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

if the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

if the operation is not enabled due to guest agent configuration.

ListFilesInGuest(vm, auth, filePath, index, maxResults, matchPattern):

Returns information about files or directories in the guest.The results could be extermely large, so to minimize the size of the return value for cases where a UI only needs to show the first N results, the answer is batched. Files are returned in OS-specific (inode) order. If the directory is modified between queries, missing or duplicate results can occur.

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

filePath (str):

The complete path to the directory or file to query.

index (int, optional):

Which result to start the list with. The default is 0.

maxResults (int, optional):

The maximum number of results to return. The default is 50.

matchPattern (str, optional):

A filter for the return values. Match patterns are specified using perl-compatible regular expressions. If matchPattern is unset, then the pattern '.*' is used.

Returns:
vim.vm.guest.FileManager.ListFileInfo:

A GuestListFileInfo object containing information for all the matching files in the filePath and the number of files left to be returned.

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

vim.fault.FileFault

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vmodl.fault.InvalidArgument:

If the matchPattern is an invalid regular expression.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.GuestComponentsOutOfDate:

if the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

if the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

if the operation is not enabled due to guest agent configuration.

ChangeFileAttributesInGuest(vm, auth, guestFilePath, fileAttributes):

Changes the file attributes of a specified file inside the guest.

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

guestFilePath (str):

The complete path to the file to be copied in the guest. If the file points to an symbolic link, then the attributes of the target file are changed.

fileAttributes (vim.vm.guest.FileManager.FileAttributes):

Specifies the different file attributes of the guest file to be changed. See GuestFileAttributes . If any property is not specified, then the specific attribute of the file will be unchanged.

Returns:

None

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.GuestComponentsOutOfDate:

if the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

if the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

if the operation is not enabled due to guest agent configuration.

InitiateFileTransferFromGuest(vm, auth, guestFilePath):

Initiates an operation to transfer a file from the guest.Obtains a reference to FileTransferInformation object for the file transfer operation. The information object contains a URL to the file inside the guest to be transferred to the client.See FileTransferInformation for information on how to use the information object. If the power state of the Virtual Machine is changed when the file transfer is in progress, or the Virtual Machine is migrated, then the transfer operation is aborted.In order to ensure a secure connection to the host when transferring a file using HTTPS, the X.509 certificate for the host must be used to authenticate the remote end of the connection. The certificate of the host that the virtual machine is running on can be retrieved using the following fields: vm ( VirtualMachine ) -runtime ( VirtualMachineRuntimeInfo ) -host ( HostSystem ) -config ( HostConfigInfo ) -certificate.

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data.

guestFilePath (str):

The complete path to the file inside the guest that has to be transferred to the client. It cannot be a path to a directory or a symbolic link.

Returns:
vim.vm.guest.FileManager.FileTransferInformation:

A reference to FileTransferInformation .

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.GuestComponentsOutOfDate:

If the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

If the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

If the operation is not enabled due to guest agent configuration.

InitiateFileTransferToGuest(vm, auth, guestFilePath, fileAttributes, fileSize, overwrite):

Initiates an operation to transfer a file to the guest.Obtains a URL to the file inside the guest to be transferred from the client. The user should send a HTTP PUT request specifying the file content in the body of the request. Multiple PUT request cannot be sent to the URL simultaneously. URL will be invalidated after a successful PUT request is sent. If the power state of the Virtual Machine is changed when the file transfer is in progress, or the Virtual Machine is migrated, then the transfer operation is aborted.In order to ensure a secure connection to the host when transferring a file using HTTPS, the X.509 certificate for the host must be used to authenticate the remote end of the connection. The certificate of the host that the virtual machine is running on can be retrieved using the following fields: vm ( VirtualMachine ) -runtime ( VirtualMachineRuntimeInfo ) -host ( HostSystem ) -config ( HostConfigInfo ) -certificate.

Privilege:

Args:
vm (vim.VirtualMachine):

Virtual Machine to perform the operation on.

auth (vim.vm.guest.GuestAuthentication):

The guest authentication data. See GuestAuthentication .

guestFilePath (str):

The complete destination path in the guest to transfer the file from the client. It cannot be a path to a directory or a symbolic link.

fileAttributes (vim.vm.guest.FileManager.FileAttributes):

File attributes of the file that has to be created in the guest. See GuestFileAttributes . If any file attribute is not specified, then the default value of that property will be set for the file.

fileSize (long):

Size of the file to transfer to the guest in bytes.

overwrite (bool):

If set, the destination file is clobbered.

Returns:
str:

A URL to which the user has to send a PUT request. The host part of the URL is returned as '*' if the hostname to be used is the name of the server to which the call was made. For example, if the call is made to esx-svr-1.domain1.com, and the file can be uploaded to http://esx-svr-1.domain1.com/guestFile?id=1=1234, the URL returned may be http:///guestFile?id=1=1234. The client replaces the asterisk with the server name on which it invoked the call.

Raises:

vim.fault.GuestOperationsFault:

if there is an error processing a guest operation.

vim.fault.InvalidState:

if the operation cannot be performed because of the virtual machine's current state.

vim.fault.TaskInProgress:

if the virtual machine is busy.

vim.fault.FileFault:

if there is a file error in the guest operating system.

vim.fault.GuestOperationsUnavailable:

if the VM agent for guest operations is not running.

vim.fault.InvalidPowerState:

if the VM is not powered on.

vim.fault.GuestPermissionDenied:

if the operation fails because the guest authentication will not allow the operation.

vim.fault.InvalidGuestLogin:

if the the guest authentication information was not accepted.

vim.fault.GuestComponentsOutOfDate:

If the guest agent is too old to support the operation.

vim.fault.OperationNotSupportedByGuest:

If the operation is not supported by the guest OS.

vim.fault.OperationDisabledByGuest:

If the operation is not enabled due to guest agent configuration.