API Reference

VixHost

class vix.VixHost(service_provider=1, host=None, credentials=None)

Bases: object

Represents a VMware virtualization host.

VIX_SERVICEPROVIDER_DEFAULT = 1
VIX_SERVICEPROVIDER_VMWARE_SERVER = 2
VIX_SERVICEPROVIDER_VMWARE_WORKSTATION = 3
VIX_SERVICEPROVIDER_VMWARE_PLAYER = 4
VIX_SERVICEPROVIDER_VMWARE_VI_SERVER = 10
VIX_SERVICEPROVIDER_VMWARE_WORKSTATION_SHARED = 11
VIX_FIND_RUNNING_VMS = 1
VIX_FIND_REGISTERED_VMS = 4
host_info

property returns the Host’s version.

Returns:Host’s type, api and software version.
Return type:VixHostInfo
Raises:vix.VixError – If failed to get version information.
disconnect()

Disconnects from the host.

register_vm(vmx_path)

Registers a VM to host.

Parameters:vmx_path (str) – Path of VM configuration to register.
Raises:vix.VixError – If failed to register VM.

Note

This method is not supported by all VMware products.

unregister_vm(vmx_path)

Unregisters a VM from host.

Parameters:vmx_path (str) – Path of VM configuration to unregister.
Raises:vix.VixError – If failed to unregister VM.

Note

This method is not supported by all VMware products.

open_vm(vmx_path)

Opens a VM in host.

Parameters:vmx_path (str) – Path to requested VM’s configuration.
Return type:vix.VixVM
Raises:vix.VixError – If failed to open requested VM.
find_items(search_type=1, names_only=False)

Finds VMs on host with requested citeria.

Parameters:
  • search_type (int) – Any of VIX_FIND_*.
  • names_only (bool) – True will return a list of vmx paths, False will return VixVM instances.
Returns:

List of found VMs.

Return type:

list

Raises:

vix.VixError – On failure to find items.

VixVM

class vix.VixVM(handle)

Bases: vix.VixHandle.VixHandle

Represents a guest VM.

VIX_POWERSTATE_POWERING_OFF = 1
VIX_POWERSTATE_POWERED_OFF = 2
VIX_POWERSTATE_POWERING_ON = 4
VIX_POWERSTATE_POWERED_ON = 8
VIX_POWERSTATE_SUSPENDING = 16
VIX_POWERSTATE_SUSPENDED = 32
VIX_POWERSTATE_TOOLS_RUNNING = 64
VIX_POWERSTATE_RESETTING = 128
VIX_POWERSTATE_BLOCKED_ON_MSG = 256
VIX_POWERSTATE_PAUSED = 512
VIX_POWERSTATE_RESUMING = 2048
VIX_TOOLSSTATE_UNKNOWN = 1
VIX_TOOLSSTATE_RUNNING = 2
VIX_TOOLSSTATE_NOT_INSTALLED = 4
VIX_VM_SUPPORT_SHARED_FOLDERS = 1
VIX_VM_SUPPORT_MULTIPLE_SNAPSHOTS = 2
VIX_VM_SUPPORT_TOOLS_INSTALL = 4
VIX_VM_SUPPORT_HARDWARE_UPGRADE = 8
VIX_VM_GUEST_VARIABLE = 1
VIX_VM_CONFIG_RUNTIME_ONLY = 2
VIX_GUEST_ENVIRONMENT_VARIABLE = 3
VIX_VMPOWEROP_NORMAL = 0
VIX_VMPOWEROP_FROM_GUEST = 4
VIX_VMPOWEROP_SUPPRESS_SNAPSHOT_POWERON = 128
VIX_VMPOWEROP_LAUNCH_GUI = 512
VIX_VMPOWEROP_START_VM_PAUSED = 4096
vmx_path

Gets VM’x vmx path.

Returns:Guest’s VMX path.
Return type:str
machine_info

Get the VM’s hardware specs

Returns:a tuple: (num_cpus, memory)
Return type:tuple
is_running

Checks if VM is running

Returns:True if running otherwise False.
Return type:bool
guest_os

The guest’s Operating System

Return type:str
name

Name of the VM.

Return type:str
is_readonly

Checks if the VM is readonly.

Return type:bool
power_state

Gets the VMs power state.

Returns:Any of VixVM.VIX_VM_POWERSTATE_*
Return type:int
tools_state

Get the VMware tools state.

Returns:Any of VixVM.VIX_VM_TOOLSSTATE_*
Return type:int
supported_features

Get features supported by the VM.

Returns:Any of VixVM.VIX_VM_SUPPORT_*.
Return type:int
pause(**kwargs)

Pauses the Virtual machine.

Note

This method is not supported by all VMware products.

power_off(**kwargs)

Powers off a VM.

Parameters:from_guest (bool) – True to initiate from guest, otherwise False.
Raises:vix.VixError – On failure to power off VM.
power_on(**kwargs)

Powers on a VM.

Parameters:launch_gui (bool) – True to launch GUI, otherwise False.
Raises:vix.VixError – On failure to power on VM.
reset(**kwargs)

Resets a virtual machine.

Parameters:from_guest (bool) – True to initiate from guest, otherwise False.
Raises:vix.VixError – On failure to reset VM.
suspend(**kwargs)

Suspends a virtual machine.

Raises:vix.VixError – On failure to suspend VM.
unpause(**kwargs)

Resumes execution of a paused virtual machine.

Raises:vix.VixError – On failure to unpause VM.

Note

This method is not supported by all Vmware products.

clone(dest_vmx, snapshot=None, linked=False)

Clones the VM to a specified location.

Parameters:
  • dest_vms (str) – The clone will be stored here.
  • snapshot (VixSnapshot) – Optional snapshot as the state of the clone.
  • linked (bool) – True for a linked clone, otherwise False for a full clone.
Returns:

Instance of the cloned VM.

Return type:

VixVM

Raises:

vix.VixError – On failure to clone.

Note

This method is not supported by all VMware products.

create_snapshot(name=None, description=None, include_memory=True)

Create a VM snapshot.

Parameters:
  • name (str) – Name of snapshot.
  • description (str) – Snapshot description.
  • include_memory (bool) – True to include RAM, otherwise False.
Returns:

Instance of the created snapshot

Return type:

VixSnapshot

Raises:

vix.VixError – On failure to create snapshot.

Note

This method is not supported by all VMware products.

snapshot_get_current()

Gets the VMs current active snapshot.

Returns:The currently active snapshot
Return type:VixSnapshot
Raises:vix.VixError – On failure to get the current snapshot.

Note

This method is not supported by all VMware products.

snapshot_get_named(name)

Gets a snapshot matching the given name.

Parameters:name (str) – Name of the snapshot to get.
Returns:Instance of requests snapshot.
Return type:VixSnapshot
Raises:vix.VixError – If failed to retreive desired snapshot.

Note

This method is not supported by all VMware products.

snapshots_get_root_count()

Gets the count of root snapshots the VM owns.

Returns:Count of VM’s root snapshots.
Return type:int
Raises:vix.VixError – If failed to retrive root snapshot count.

Note

This method is not supported by all VMware products.

snapshot_get_root(index=0)

Gets the specified VM Snapshot.

Parameters:index (int) – zero based snapshot index.
Returns:Root snapshot at specified index.
Return type:VixSnapshot
Raises:vix.VixError – If failed to get specified too snapshot.

Note

This methoid is not supported in all VMware products.

snapshot_revert(**kwargs)

Revet VM state to specified snapshot.

Parameters:
  • snapshot (VixSnapshot) – The snapshot to revert to.
  • options (int) – Any of VIX_VMPOWEROP_*, VIX_VMPOWEROP_SUPPRESS_SNAPSHOT_POWERON is mutually exclusive.
Raises:

vix.VixError – If failed to revert VM to snapshot.

Note

This method is not supported by all VMware products.

snapshot_remove(**kwargs)

Removed specified snapshot from VM.

Parameters:
  • snapshot (VixSnapshot) – The snapshot to remove.
  • remove_children (bool) – True to remove child snapshots too, otherwise False.
Raises:

vix.VixError – If failed to remove specified snapshot.

Note

This method is not supported by all VMware products.

copy_guest_to_host(**kwargs)

Copies a file or directory from the VM to host.

Parameters:
  • guest_path (str) – Path to copy from on guest.
  • host_path (str) – Path to copy to on host.
Raises:

vix.VixError – If copy failed.

copy_host_to_guest(**kwargs)

Copies a file or directory from host to VM.

Parameters:
  • host_path (str) – Path to copy from on host.
  • guest_path (str) – Path to copy to on VM.
Raises:

vix.VixError – If failed to copy.

create_directory(**kwargs)

Creates a directory in the guest VM.

Parameters:path (str) – Path to create in guest.
Raises:vix.VixError – On failure to create directory.

Note

This method is not supported by all VMware products.

create_temp()

Creates a temporary file in guest.

Returns:Temporary file name.
Return type:str
Raises:vix.VixError – On failure to create temporary file.

Note

This method is not supported by all VMware products.

file_rename(**kwargs)

Renames a file or directory in guest.

Parameters:
  • old_name (str) – Name of file to rename.
  • new_name (str) – The new name to give the file.
Raises:

vix.VixError – On failure to rename.

Note

This method is not supported by all VMware products.

dir_delete(**kwargs)

Deletes a directory in guest VM.

Parameters:path (str) – Path of directory to delete.
Raises:vix.VixError – If failed to delete directory.

Note

This method is not supported by all VMware products.

file_delete(**kwargs)

Deletes a file in guest VM.

Parameters:path (str) – Path of file to delete.
Raises:vix.VixError – If failed to delete directory.

Note

This method is not supported by all VMware products.

dir_exists(path)

Checks if a directory exists in guest VM.

Parameters:path (str) – Path to check if exists.
Returns:True if directory exists, othwerwise False.
Return type:bool
Raises:vix.VixError – If failed to check.

Note

This method is not supported by all VMware products.

file_exists(path)

Checks if a file exists in guest VM.

Parameters:path (str) – File to check.
Returns:True if file exists, otherwise False.
Return type:bool
Raises:vix.VixError – If failed to check file existance.

Note

This method is not supported by all VMware products.

get_file_info(path)

Gets information about specified file in guest.

Parameters:path (str) – File path to get information about.
Returns:DirectoryListEntry instance.
Return type:DirectoryListEntry
Raises:vix.VixError – On failure to get file info.

Note

This method is not supported by all VMware products.

dir_list(path)

Gets directory listing of specified path in guest VM.

Parameters:path (str) – Path to get directory list of.
Returns:List of tuples, each containing: File Name, File Size, is dir, is symlink, mod time.
Raises:vix.VixError – On failure to get file info.

Note

This method is not supported by all VMware products.

proc_kill(**kwargs)

Kills a process in guest VM.

Parameters:pid (int) – PID of process in guest to kill.
Raises:vix.VixError – If failed to kill process.

Note

This method is not supported by all VMware products.

proc_list()

Gets the guest’s process list.

Returns:A list of tuples, each tuple contains: Process Name, PID, owner, cmd line, is debugged, start time.
Return type:list
Raises:vix.VixError – On failure to get file info.

Note

This method is not supported by all VMware products.

login(**kwargs)

Login to the guest to allow further executions.

Parameters:
  • username (str) – Guest Login username.
  • password (str) – Guest login password.
  • require_interactive (bool) – If login requires an interactive session.
Raises:

vix.VixError – On failure to authenticate.

logout(**kwargs)

Logout from guest. Closes any previous login context.

Raises:vix.VixError – If failed to logout.

Note

This method is not supported by all VMware products.

proc_run(**kwargs)

Executes a process in guest VM.

Parameters:
  • program_name (str) – Name of program to execute in guest.
  • command_line (str) – Command line to execute program with.
  • should_block (bool) – If set to True, function will block until process exits in guest.
Raises:

vix.VixError – On failure to execute process.

Note

This method is not supported by all VMware products.

run_script(**kwargs)

Executes a script in guest VM.

Parameters:
  • script_text (str) – The script to execute.
  • interpreter_path (str) – Path of the interpreter for the script.
  • should_block (bool) – If set to False, function will return immediately. True will block untill script returns.
Raises:

vix.VixError – On failure to execute script.

Note

This method is not supported by all VMware products.

add_shared_folder(**kwargs)

Shares a folder with the guest VM.

Parameters:
  • share_name (str) – Name of share in guest VM.
  • host_path (str) – Path to share in host.
  • write_access (bool) – True to allow guest to write to share.
Raises:

vix.VixError – On failure to add share.

Note

This method is not supported by all VMware products.

share_enable(**kwargs)

Enables/Disables shares between Host and guest VM.

Parameters:value (bool) – True to enable, False to disable.
Raises:vix.VixError – If failed to enable/disable shares.

Note

This method is not supported by all VMware products.

get_shared_folder_count()

Gets the count of shared folder of VM with host.

Note

This method is not supported by all VMware products.

get_shared_folder_state(index)

Gets the state of a shared folder.

Parameters:index (int) – Index of share.
Returns:tuple with share state information.
Return type:SharedFolder
Raises:vix.VixError – If failed to get state.

Note

This method is not supported by all VMware products.

share_remove(**kwargs)

Removes a share between host and guest VM.

Parameters:share_name (str) – Name of share to remove.

Note

This method is not supported by all VMware products.

share_set_state(**kwargs)

Sets the state for an existing share.

Parameters:
  • share_name (str) – Name of share to modify.
  • host_path (str) – Path on host to set to share.
  • allow_write (bool) – Sets if the guest will be able to write to share.
Raises:

vix.VixError – If failed to set share state.

Note

This method is not supported by all VMware products.

var_read(name, variable_type=1)

Reads an environment string.

Parameters:
  • name (str) – Name of variable to read.
  • variable_type (int) – Must be one of VIX_VM_GUEST_VARIABLE, VIX_VM_CONFIG_RUNTIME_ONLY or VIX_GUEST_ENVIRONMENT_VARIABLE.
Returns:

The value of the variable.

Return type:

str

Raises:

vix.VixError – On failure to get specified variable.

Note

This method is not supported by all VMware products.

var_write(**kwargs)

Writes a string to the VM’s environment.

Parameters:
  • name (str) – Name of env string to set.
  • value (str) – Value of env string to set.
  • variable_type (int) – Must be one of VIX_VM_GUEST_VARIABLE, VIX_VM_CONFIG_RUNTIME_ONLY or VIX_GUEST_ENVIRONMENT_VARIABLE.
Raises:

vix.VixError – On failure to set environment.

Note

This method is not supported by all VMware products.

upgrade_virtual_hardware(**kwargs)

Upgrades virtual hardware of a virtual machine.

Raises:vix.VixError – If failed to upgrade virtual hardware.

Note

This method is not supported by all VMware products.

vm_delete(**kwargs)

Deletes VM from host.

Parameters:delete_files (bool) – True to delete associated files from disk, otherwise False.
Raises:vix.VixError – If failed to delete VM.
capture_screen_image(filename=None)

Captures a PNG screenshot from VM.

Parameters:filename (str) – A filename to save image to. If this file exists it will be overwritten. None will return the image a string/BLOB.
Returns:A PNG image in binary form if filename is None, otherwise None
Return type:bytes
Raises:vix.VixError – On failure to capture screenshot.

Note

This method is not supported by all VMWare products.

wait_for_tools(**kwargs)

Waits for VMware tools to start in guest.

Parameters:timeout (int) – Timeout in seconds. Zero or negative will block forever, Raises an exception if timeout expired.
Raises:vix.VixError – If timeout passed, Or of VIX fails.
install_tools(**kwargs)

Starts the VMware tools install operation on guest.

Parameters:
  • auto_upgrade (bool) – True for auto upgrade, False will mount installer.
  • blocking (bool) – False will return immediatly, True will wait till operation ends.
Raises:

vix.VixError – On failure to start install.

VixSnapshot

class vix.VixSnapshot(handle)

Bases: vix.VixHandle.VixHandle

Represents a VM’s snapshot

name

Gets the snapshot’s name.

Return type:str
description

Get the snapshot’s description.

Return type:str
power_state

Gets the snapshot’s power state.

Returns:Power state, can be a combination of VixVM.VIX_VM_POWERSTATE_*
Return type:int
get_num_children()

Gets the number of children the current snapshot has.

Raises:vix.VixError – On failure to get child count.
get_child(child_index)

Gets a child snapshot at the designated index

Parameters:child_index (int) – Index of child snapshot.
Returns:Snapshot at specified index.
Return type:VixSnapshot
Raises:vix.VixError – On failure to retrieve snapshot.
get_parent()

Gets the parent of the current snapshot.

Returns:Parent of current snapshot or None if snapshot is a root.
Return type:VixSnapshot
Raises:vix.VixError – On failure to get snapshot.

VixError

exception vix.VixError(error_code)

Bases: Exception

VIX_OK = 0
VIX_E_FAIL = 1
VIX_E_OUT_OF_MEMORY = 2
VIX_E_INVALID_ARG = 3
VIX_E_FILE_NOT_FOUND = 4
VIX_E_OBJECT_IS_BUSY = 5
VIX_E_NOT_SUPPORTED = 6
VIX_E_FILE_ERROR = 7
VIX_E_DISK_FULL = 8
VIX_E_INCORRECT_FILE_TYPE = 9
VIX_E_CANCELLED = 10
VIX_E_FILE_READ_ONLY = 11
VIX_E_FILE_ALREADY_EXISTS = 12
VIX_E_FILE_ACCESS_ERROR = 13
VIX_E_REQUIRES_LARGE_FILES = 14
VIX_E_FILE_ALREADY_LOCKED = 15
VIX_E_VMDB = 16
VIX_E_NOT_SUPPORTED_ON_REMOTE_OBJECT = 20
VIX_E_FILE_TOO_BIG = 21
VIX_E_FILE_NAME_INVALID = 22
VIX_E_ALREADY_EXISTS = 23
VIX_E_BUFFER_TOOSMALL = 24
VIX_E_OBJECT_NOT_FOUND = 25
VIX_E_HOST_NOT_CONNECTED = 26
VIX_E_INVALID_UTF8_STRING = 27
VIX_E_OPERATION_ALREADY_IN_PROGRESS = 31
VIX_E_UNFINISHED_JOB = 29
VIX_E_NEED_KEY = 30
VIX_E_LICENSE = 32
VIX_E_VM_HOST_DISCONNECTED = 34
VIX_E_AUTHENTICATION_FAIL = 35
VIX_E_HOST_CONNECTION_LOST = 36
VIX_E_DUPLICATE_NAME = 41
VIX_E_ARGUMENT_TOO_BIG = 44
VIX_E_INVALID_HANDLE = 1000
VIX_E_NOT_SUPPORTED_ON_HANDLE_TYPE = 1001
VIX_E_TOO_MANY_HANDLES = 1002
VIX_E_NOT_FOUND = 2000
VIX_E_TYPE_MISMATCH = 2001
VIX_E_INVALID_XML = 2002
VIX_E_TIMEOUT_WAITING_FOR_TOOLS = 3000
VIX_E_UNRECOGNIZED_COMMAND = 3001
VIX_E_OP_NOT_SUPPORTED_ON_GUEST = 3003
VIX_E_PROGRAM_NOT_STARTED = 3004
VIX_E_CANNOT_START_READ_ONLY_VM = 3005
VIX_E_VM_NOT_RUNNING = 3006
VIX_E_VM_IS_RUNNING = 3007
VIX_E_CANNOT_CONNECT_TO_VM = 3008
VIX_E_POWEROP_SCRIPTS_NOT_AVAILABLE = 3009
VIX_E_NO_GUEST_OS_INSTALLED = 3010
VIX_E_VM_INSUFFICIENT_HOST_MEMORY = 3011
VIX_E_SUSPEND_ERROR = 3012
VIX_E_VM_NOT_ENOUGH_CPUS = 3013
VIX_E_HOST_USER_PERMISSIONS = 3014
VIX_E_GUEST_USER_PERMISSIONS = 3015
VIX_E_TOOLS_NOT_RUNNING = 3016
VIX_E_GUEST_OPERATIONS_PROHIBITED = 3017
VIX_E_ANON_GUEST_OPERATIONS_PROHIBITED = 3018
VIX_E_ROOT_GUEST_OPERATIONS_PROHIBITED = 3019
VIX_E_MISSING_ANON_GUEST_ACCOUNT = 3023
VIX_E_CANNOT_AUTHENTICATE_WITH_GUEST = 3024
VIX_E_UNRECOGNIZED_COMMAND_IN_GUEST = 3025
VIX_E_CONSOLE_GUEST_OPERATIONS_PROHIBITED = 3026
VIX_E_MUST_BE_CONSOLE_USER = 3027
VIX_E_VMX_MSG_DIALOG_AND_NO_UI = 3028
VIX_E_OPERATION_NOT_ALLOWED_FOR_LOGIN_TYPE = 3031
VIX_E_LOGIN_TYPE_NOT_SUPPORTED = 3032
VIX_E_EMPTY_PASSWORD_NOT_ALLOWED_IN_GUEST = 3033
VIX_E_INTERACTIVE_SESSION_NOT_PRESENT = 3034
VIX_E_INTERACTIVE_SESSION_USER_MISMATCH = 3035
VIX_E_CANNOT_POWER_ON_VM = 3041
VIX_E_NO_DISPLAY_SERVER = 3043
VIX_E_TOO_MANY_LOGONS = 3046
VIX_E_INVALID_AUTHENTICATION_SESSION = 3047
VIX_E_VM_NOT_FOUND = 4000
VIX_E_NOT_SUPPORTED_FOR_VM_VERSION = 4001
VIX_E_CANNOT_READ_VM_CONFIG = 4002
VIX_E_TEMPLATE_VM = 4003
VIX_E_VM_ALREADY_LOADED = 4004
VIX_E_VM_ALREADY_UP_TO_DATE = 4006
VIX_E_VM_UNSUPPORTED_GUEST = 4011
VIX_E_UNRECOGNIZED_PROPERTY = 6000
VIX_E_INVALID_PROPERTY_VALUE = 6001
VIX_E_READ_ONLY_PROPERTY = 6002
VIX_E_MISSING_REQUIRED_PROPERTY = 6003
VIX_E_INVALID_SERIALIZED_DATA = 6004
VIX_E_PROPERTY_TYPE_MISMATCH = 6005
VIX_E_BAD_VM_INDEX = 8000
VIX_E_INVALID_MESSAGE_HEADER = 10000
VIX_E_INVALID_MESSAGE_BODY = 10001
VIX_E_SNAPSHOT_INVAL = 13000
VIX_E_SNAPSHOT_DUMPER = 13001
VIX_E_SNAPSHOT_DISKLIB = 13002
VIX_E_SNAPSHOT_NOTFOUND = 13003
VIX_E_SNAPSHOT_EXISTS = 13004
VIX_E_SNAPSHOT_VERSION = 13005
VIX_E_SNAPSHOT_NOPERM = 13006
VIX_E_SNAPSHOT_CONFIG = 13007
VIX_E_SNAPSHOT_NOCHANGE = 13008
VIX_E_SNAPSHOT_CHECKPOINT = 13009
VIX_E_SNAPSHOT_LOCKED = 13010
VIX_E_SNAPSHOT_INCONSISTENT = 13011
VIX_E_SNAPSHOT_NAMETOOLONG = 13012
VIX_E_SNAPSHOT_VIXFILE = 13013
VIX_E_SNAPSHOT_DISKLOCKED = 13014
VIX_E_SNAPSHOT_DUPLICATEDDISK = 13015
VIX_E_SNAPSHOT_INDEPENDENTDISK = 13016
VIX_E_SNAPSHOT_NONUNIQUE_NAME = 13017
VIX_E_SNAPSHOT_MEMORY_ON_INDEPENDENT_DISK = 13018
VIX_E_SNAPSHOT_MAXSNAPSHOTS = 13019
VIX_E_SNAPSHOT_MIN_FREE_SPACE = 13020
VIX_E_SNAPSHOT_HIERARCHY_TOODEEP = 13021
VIX_E_SNAPSHOT_NOT_REVERTABLE = 13024
VIX_E_HOST_DISK_INVALID_VALUE = 14003
VIX_E_HOST_DISK_SECTORSIZE = 14004
VIX_E_HOST_FILE_ERROR_EOF = 14005
VIX_E_HOST_NETBLKDEV_HANDSHAKE = 14006
VIX_E_HOST_SOCKET_CREATION_ERROR = 14007
VIX_E_HOST_SERVER_NOT_FOUND = 14008
VIX_E_HOST_NETWORK_CONN_REFUSED = 14009
VIX_E_HOST_TCP_SOCKET_ERROR = 14010
VIX_E_HOST_TCP_CONN_LOST = 14011
VIX_E_HOST_NBD_HASHFILE_VOLUME = 14012
VIX_E_HOST_NBD_HASHFILE_INIT = 14013
VIX_E_DISK_INVAL = 16000
VIX_E_DISK_NOINIT = 16001
VIX_E_DISK_NOIO = 16002
VIX_E_DISK_PARTIALCHAIN = 16003
VIX_E_DISK_NEEDSREPAIR = 16006
VIX_E_DISK_OUTOFRANGE = 16007
VIX_E_DISK_CID_MISMATCH = 16008
VIX_E_DISK_CANTSHRINK = 16009
VIX_E_DISK_PARTMISMATCH = 16010
VIX_E_DISK_UNSUPPORTEDDISKVERSION = 16011
VIX_E_DISK_OPENPARENT = 16012
VIX_E_DISK_NOTSUPPORTED = 16013
VIX_E_DISK_NEEDKEY = 16014
VIX_E_DISK_NOKEYOVERRIDE = 16015
VIX_E_DISK_NOTENCRYPTED = 16016
VIX_E_DISK_NOKEY = 16017
VIX_E_DISK_INVALIDPARTITIONTABLE = 16018
VIX_E_DISK_NOTNORMAL = 16019
VIX_E_DISK_NOTENCDESC = 16020
VIX_E_DISK_NEEDVMFS = 16022
VIX_E_DISK_RAWTOOBIG = 16024
VIX_E_DISK_TOOMANYOPENFILES = 16027
VIX_E_DISK_TOOMANYREDO = 16028
VIX_E_DISK_RAWTOOSMALL = 16029
VIX_E_DISK_INVALIDCHAIN = 16030
VIX_E_DISK_KEY_NOTFOUND = 16052
VIX_E_DISK_SUBSYSTEM_INIT_FAIL = 16053
VIX_E_DISK_INVALID_CONNECTION = 16054
VIX_E_DISK_ENCODING = 16061
VIX_E_DISK_CANTREPAIR = 16062
VIX_E_DISK_INVALIDDISK = 16063
VIX_E_DISK_NOLICENSE = 16064
VIX_E_DISK_NODEVICE = 16065
VIX_E_DISK_UNSUPPORTEDDEVICE = 16066
VIX_E_DISK_CAPACITY_MISMATCH = 16067
VIX_E_DISK_PARENT_NOTALLOWED = 16068
VIX_E_CRYPTO_UNKNOWN_ALGORITHM = 17000
VIX_E_CRYPTO_BAD_BUFFER_SIZE = 17001
VIX_E_CRYPTO_INVALID_OPERATION = 17002
VIX_E_CRYPTO_RANDOM_DEVICE = 17003
VIX_E_CRYPTO_NEED_PASSWORD = 17004
VIX_E_CRYPTO_BAD_PASSWORD = 17005
VIX_E_CRYPTO_NOT_IN_DICTIONARY = 17006
VIX_E_CRYPTO_NO_CRYPTO = 17007
VIX_E_CRYPTO_ERROR = 17008
VIX_E_CRYPTO_BAD_FORMAT = 17009
VIX_E_CRYPTO_LOCKED = 17010
VIX_E_CRYPTO_EMPTY = 17011
VIX_E_CRYPTO_KEYSAFE_LOCATOR = 17012
VIX_E_CANNOT_CONNECT_TO_HOST = 18000
VIX_E_NOT_FOR_REMOTE_HOST = 18001
VIX_E_INVALID_HOSTNAME_SPECIFICATION = 18002
VIX_E_SCREEN_CAPTURE_ERROR = 19000
VIX_E_SCREEN_CAPTURE_BAD_FORMAT = 19001
VIX_E_SCREEN_CAPTURE_COMPRESSION_FAIL = 19002
VIX_E_SCREEN_CAPTURE_LARGE_DATA = 19003
VIX_E_GUEST_VOLUMES_NOT_FROZEN = 20000
VIX_E_NOT_A_FILE = 20001
VIX_E_NOT_A_DIRECTORY = 20002
VIX_E_NO_SUCH_PROCESS = 20003
VIX_E_FILE_NAME_TOO_LONG = 20004
VIX_E_OPERATION_DISABLED = 20005
VIX_E_TOOLS_INSTALL_NO_IMAGE = 21000
VIX_E_TOOLS_INSTALL_IMAGE_INACCESIBLE = 21001
VIX_E_TOOLS_INSTALL_NO_DEVICE = 21002
VIX_E_TOOLS_INSTALL_DEVICE_NOT_CONNECTED = 21003
VIX_E_TOOLS_INSTALL_CANCELLED = 21004
VIX_E_TOOLS_INSTALL_INIT_FAILED = 21005
VIX_E_TOOLS_INSTALL_AUTO_NOT_SUPPORTED = 21006
VIX_E_TOOLS_INSTALL_GUEST_NOT_READY = 21007
VIX_E_TOOLS_INSTALL_ERROR = 21009
VIX_E_TOOLS_INSTALL_ALREADY_UP_TO_DATE = 21010
VIX_E_TOOLS_INSTALL_IN_PROGRESS = 21011
VIX_E_TOOLS_INSTALL_IMAGE_COPY_FAILED = 21012
VIX_E_WRAPPER_WORKSTATION_NOT_INSTALLED = 22001
VIX_E_WRAPPER_VERSION_NOT_FOUND = 22002
VIX_E_WRAPPER_SERVICEPROVIDER_NOT_FOUND = 22003
VIX_E_WRAPPER_PLAYER_NOT_INSTALLED = 22004
VIX_E_WRAPPER_RUNTIME_NOT_INSTALLED = 22005
VIX_E_WRAPPER_MULTIPLE_SERVICEPROVIDERS = 22006
VIX_E_MNTAPI_MOUNTPT_NOT_FOUND = 24000
VIX_E_MNTAPI_MOUNTPT_IN_USE = 24001
VIX_E_MNTAPI_DISK_NOT_FOUND = 24002
VIX_E_MNTAPI_DISK_NOT_MOUNTED = 24003
VIX_E_MNTAPI_DISK_IS_MOUNTED = 24004
VIX_E_MNTAPI_DISK_NOT_SAFE = 24005
VIX_E_MNTAPI_DISK_CANT_OPEN = 24006
VIX_E_MNTAPI_CANT_READ_PARTS = 24007
VIX_E_MNTAPI_UMOUNT_APP_NOT_FOUND = 24008
VIX_E_MNTAPI_UMOUNT = 24009
VIX_E_MNTAPI_NO_MOUNTABLE_PARTITONS = 24010
VIX_E_MNTAPI_PARTITION_RANGE = 24011
VIX_E_MNTAPI_PERM = 24012
VIX_E_MNTAPI_DICT = 24013
VIX_E_MNTAPI_DICT_LOCKED = 24014
VIX_E_MNTAPI_OPEN_HANDLES = 24015
VIX_E_MNTAPI_CANT_MAKE_VAR_DIR = 24016
VIX_E_MNTAPI_NO_ROOT = 24017
VIX_E_MNTAPI_LOOP_FAILED = 24018
VIX_E_MNTAPI_DAEMON = 24019
VIX_E_MNTAPI_INTERNAL = 24020
VIX_E_MNTAPI_SYSTEM = 24021
VIX_E_MNTAPI_NO_CONNECTION_DETAILS = 24022
VIX_E_MNTAPI_INCOMPATIBLE_VERSION = 24300
VIX_E_MNTAPI_OS_ERROR = 24301
VIX_E_MNTAPI_DRIVE_LETTER_IN_USE = 24302
VIX_E_MNTAPI_DRIVE_LETTER_ALREADY_ASSIGNED = 24303
VIX_E_MNTAPI_VOLUME_NOT_MOUNTED = 24304
VIX_E_MNTAPI_VOLUME_ALREADY_MOUNTED = 24305
VIX_E_MNTAPI_FORMAT_FAILURE = 24306
VIX_E_MNTAPI_NO_DRIVER = 24307
VIX_E_MNTAPI_ALREADY_OPENED = 24308
VIX_E_MNTAPI_ITEM_NOT_FOUND = 24309
VIX_E_MNTAPI_UNSUPPROTED_BOOT_LOADER = 24310
VIX_E_MNTAPI_UNSUPPROTED_OS = 24311
VIX_E_MNTAPI_CODECONVERSION = 24312
VIX_E_MNTAPI_REGWRITE_ERROR = 24313
VIX_E_MNTAPI_UNSUPPORTED_FT_VOLUME = 24314
VIX_E_MNTAPI_PARTITION_NOT_FOUND = 24315
VIX_E_MNTAPI_PUTFILE_ERROR = 24316
VIX_E_MNTAPI_GETFILE_ERROR = 24317
VIX_E_MNTAPI_REG_NOT_OPENED = 24318
VIX_E_MNTAPI_REGDELKEY_ERROR = 24319
VIX_E_MNTAPI_CREATE_PARTITIONTABLE_ERROR = 24320
VIX_E_MNTAPI_OPEN_FAILURE = 24321
VIX_E_MNTAPI_VOLUME_NOT_WRITABLE = 24322
VIX_ASYNC = 25000
VIX_E_ASYNC_MIXEDMODE_UNSUPPORTED = 26000
VIX_E_NET_HTTP_UNSUPPORTED_PROTOCOL = 30001
VIX_E_NET_HTTP_URL_MALFORMAT = 30003
VIX_E_NET_HTTP_COULDNT_RESOLVE_PROXY = 30005
VIX_E_NET_HTTP_COULDNT_RESOLVE_HOST = 30006
VIX_E_NET_HTTP_COULDNT_CONNECT = 30007
VIX_E_NET_HTTP_HTTP_RETURNED_ERROR = 30022
VIX_E_NET_HTTP_OPERATION_TIMEDOUT = 30028
VIX_E_NET_HTTP_SSL_CONNECT_ERROR = 30035
VIX_E_NET_HTTP_TOO_MANY_REDIRECTS = 30047
VIX_E_NET_HTTP_TRANSFER = 30200
VIX_E_NET_HTTP_SSL_SECURITY = 30201
VIX_E_NET_HTTP_GENERIC = 30202
get_error_text()

Get an error’s text

Returns:A human readable error message.
Return type:str

Internal classes

Warning

These classes shouldn’t be normally dealt with. Using these classes directly may cause python to crash.

VixHandle

class vix.VixHandle.VixHandle(handle)

Bases: object

Represents a handle of the VIX library.

Note

Internal use.

VIX_INVALID_HANDLE = 0
VIX_HANDLETYPE_NONE = 0
VIX_HANDLETYPE_HOST = 2
VIX_HANDLETYPE_VM = 3
VIX_HANDLETYPE_NETWORK = 5
VIX_HANDLETYPE_JOB = 6
VIX_HANDLETYPE_SNAPSHOT = 7
VIX_HANDLETYPE_PROPERTY_LIST = 9
VIX_HANDLETYPE_METADATA_CONTAINER = 1
VIX_PROPERTYTYPE_ANY = 0
VIX_PROPERTYTYPE_INTEGER = 1
VIX_PROPERTYTYPE_STRING = 2
VIX_PROPERTYTYPE_BOOL = 3
VIX_PROPERTYTYPE_HANDLE = 4
VIX_PROPERTYTYPE_INT64 = 5
VIX_PROPERTYTYPE_BLOB = 6
VIX_PROPERTY_NONE = 0
VIX_PROPERTY_META_DATA_CONTAINER = 2
VIX_PROPERTY_HOST_HOSTTYPE = 50
VIX_PROPERTY_HOST_API_VERSION = 51
VIX_PROPERTY_HOST_SOFTWARE_VERSION = 52
VIX_PROPERTY_VM_NUM_VCPUS = 101
VIX_PROPERTY_VM_VMX_PATHNAME = 103
VIX_PROPERTY_VM_VMTEAM_PATHNAME = 105
VIX_PROPERTY_VM_MEMORY_SIZE = 106
VIX_PROPERTY_VM_READ_ONLY = 107
VIX_PROPERTY_VM_NAME = 108
VIX_PROPERTY_VM_GUESTOS = 109
VIX_PROPERTY_VM_IN_VMTEAM = 128
VIX_PROPERTY_VM_POWER_STATE = 129
VIX_PROPERTY_VM_TOOLS_STATE = 152
VIX_PROPERTY_VM_IS_RUNNING = 196
VIX_PROPERTY_VM_SUPPORTED_FEATURES = 197
VIX_PROPERTY_VM_SSL_ERROR = 293
VIX_PROPERTY_FOUND_ITEM_LOCATION = 4010
VIX_PROPERTY_SNAPSHOT_DISPLAYNAME = 4200
VIX_PROPERTY_SNAPSHOT_DESCRIPTION = 4201
VIX_PROPERTY_SNAPSHOT_POWERSTATE = 4205
VIX_PROPERTY_GUEST_SHAREDFOLDERS_SHARES_PATH = 4525
VIX_PROPERTY_VM_ENCRYPTION_PASSWORD = 7001
is_valid()

Checks that the handle is valid.

Returns:True if handle is valid, otherwise False.
Return type:bool
get_type()

Gets the handle’s type.

Returns:Type of handle from VIX_HANDLETYPE_*.
Return type:int
add_ref()

Increases the handle’s refcount.

release()

Decreases refcount or Releases the handle.

get_properties(*args)
get_property_type(property_id)

VixJob

class vix.VixJob.VixJob(handle)

Bases: vix.VixHandle.VixHandle

Represnts a VIX Job handle.

Note

Internal use.

VIX_PROPERTY_JOB_RESULT_ERROR_CODE = 3000
VIX_PROPERTY_JOB_RESULT_VM_IN_GROUP = 3001
VIX_PROPERTY_JOB_RESULT_USER_MESSAGE = 3002
VIX_PROPERTY_JOB_RESULT_EXIT_CODE = 3004
VIX_PROPERTY_JOB_RESULT_COMMAND_OUTPUT = 3005
VIX_PROPERTY_JOB_RESULT_HANDLE = 3010
VIX_PROPERTY_JOB_RESULT_GUEST_OBJECT_EXISTS = 3011
VIX_PROPERTY_JOB_RESULT_GUEST_PROGRAM_ELAPSED_TIME = 3017
VIX_PROPERTY_JOB_RESULT_GUEST_PROGRAM_EXIT_CODE = 3018
VIX_PROPERTY_JOB_RESULT_ITEM_NAME = 3035
VIX_PROPERTY_JOB_RESULT_FOUND_ITEM_DESCRIPTION = 3036
VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_COUNT = 3046
VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_HOST = 3048
VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_FLAGS = 3049
VIX_PROPERTY_JOB_RESULT_PROCESS_ID = 3051
VIX_PROPERTY_JOB_RESULT_PROCESS_OWNER = 3052
VIX_PROPERTY_JOB_RESULT_PROCESS_COMMAND = 3053
VIX_PROPERTY_JOB_RESULT_FILE_FLAGS = 3054
VIX_PROPERTY_JOB_RESULT_PROCESS_START_TIME = 3055
VIX_PROPERTY_JOB_RESULT_VM_VARIABLE_STRING = 3056
VIX_PROPERTY_JOB_RESULT_PROCESS_BEING_DEBUGGED = 3057
VIX_PROPERTY_JOB_RESULT_SCREEN_IMAGE_SIZE = 3058
VIX_PROPERTY_JOB_RESULT_SCREEN_IMAGE_DATA = 3059
VIX_PROPERTY_JOB_RESULT_FILE_SIZE = 3061
VIX_PROPERTY_JOB_RESULT_FILE_MOD_TIME = 3062
VIX_PROPERTY_JOB_RESULT_EXTRA_ERROR_INFO = 3084
VIX_FILE_ATTRIBUTES_DIRECTORY = 1
STR_RESULT_TYPES = (3035, 3056, 3005, 3052, 3053, 3048)
wait(*args)

Waits for the job to complete and gets requested results.

Parameters:*args – A list of properties to retreive (VIX_PROPERTY_JOB_RESULT_*).
Returns:A tuple of results if more than one object was requested.
Raises:vix.VixError – If job failed.
is_done()

Checks if the job completed.

Returns:True if job completed, otherwise False.
Return type:bool
Raises:vix.VixError – If failed to get job state.
get_error()

Gets an exception object.

Returns:Exception object of job. The error may be VixError(VIX_OK).
Return type:VixError
get_properties(*args)

Get properties of a job result

Parameters:*args – properties to fetch.
Returns:A list of tuples of requests properties.
Return type:list
Raises:vix.VixError – On failure to fetch results.

VixBackend

class vix.VixBackend.VixBackend

Bases: object

This class creates the ffi and vix objects that will be used by other classes of this module.

Note

Internal use.

static _get_vix_path()

Finds the expected install path for the so/dll.

Returns:Expected path.
Return type:str
Raises:NotImplemented – If the OS/architecture are not recognized.