virtualbox.library – transform of VirtualBox.xidl

The virtualbox.library is generated using the VirtualBox project’s VirtualBox.xidl file. This file contains a complete definition of the VirtualBox interface.

pyvbox ships with a builder in it’s root folder called build.py. This builder is responsible for implementing the code that transforms VirtualBox.xidl into library.py.

Code reference

This code reference is the result of using automodule to generate code for the entire virtualbox.library module, followed by autoclass to generate doc for the extended classes found in library_ext.

virtualbox.library

Welcome to the VirtualBox Main API documentation. This documentation describes the so-called VirtualBox Main API which comprises all public COM interfaces and components provided by the VirtualBox server and by the VirtualBox client library.

VirtualBox employs a client-server design, meaning that whenever any part of VirtualBox is running – be it the Qt GUI, the VBoxManage command-line interface or any virtual machine –, a dedicated server process named VBoxSVC runs in the background. This allows multiple processes working with VirtualBox to cooperate without conflicts. These processes communicate to each other using inter-process communication facilities provided by the COM implementation of the host computer.

On Windows platforms, the VirtualBox Main API uses Microsoft COM, a native COM implementation. On all other platforms, Mozilla XPCOM, an open-source COM implementation, is used.

All the parts that a typical VirtualBox user interacts with (the Qt GUI and the VBoxManage command-line interface) are technically front-ends to the Main API and only use the interfaces that are documented in this Main API documentation. This ensures that, with any given release version of VirtualBox, all capabilities of the product that could be useful to an external client program are always exposed by way of this API.

The VirtualBox Main API (also called the VirtualBox COM library) contains two public component classes: IVirtualBox and ISession, which implement IVirtualBox and ISession interfaces respectively. These two classes are of supreme importance and will be needed in order for any front-end program to do anything useful. It is recommended to read the documentation of the mentioned interfaces first.

The IVirtualBox class is a singleton. This means that there can be only one object of this class on the local machine at any given time. This object is a parent of many other objects in the VirtualBox COM library and lives in the VBoxSVC process. In fact, when you create an instance of the IVirtualBox, the COM subsystem checks if the VBoxSVC process is already running, starts it if not, and returns you a reference to the VirtualBox object created in this process. When the last reference to this object is released, the VBoxSVC process ends (with a 5 second delay to protect from too frequent restarts).

The ISession class is a regular component. You can create as many Session objects as you need but all of them will live in a process which issues the object instantiation call. Session objects represent virtual machine sessions which are used to configure virtual machines and control their execution.

The naming of methods and attributes is very clearly defined: they all start with a lowercase letter (except if they start with an acronym), and are using CamelCase style otherwise. This naming only applies to the IDL description, and is modified by the various language bindings (some convert the first character to upper case, some not). See the SDK reference for more details about how to call a method or attribute from a specific programming language.

exception virtualbox.library.VBoxErrorObjectNotFound[source]

Object corresponding to the supplied arguments does not exist.

exception virtualbox.library.VBoxErrorInvalidVmState[source]

Current virtual machine state prevents the operation.

exception virtualbox.library.VBoxErrorVmError[source]

Virtual machine error occurred attempting the operation.

exception virtualbox.library.VBoxErrorFileError[source]

File not accessible or erroneous file contents.

exception virtualbox.library.VBoxErrorIprtError[source]

Runtime subsystem error.

exception virtualbox.library.VBoxErrorPdmError[source]

Pluggable Device Manager error.

exception virtualbox.library.VBoxErrorInvalidObjectState[source]

Current object state prohibits operation.

exception virtualbox.library.VBoxErrorHostError[source]

Host operating system related error.

exception virtualbox.library.VBoxErrorNotSupported[source]

Requested operation is not supported.

exception virtualbox.library.VBoxErrorXmlError[source]

Invalid XML found.

exception virtualbox.library.VBoxErrorInvalidSessionState[source]

Current session state prohibits operation.

exception virtualbox.library.VBoxErrorObjectInUse[source]

Object being in use prohibits operation.

exception virtualbox.library.VBoxErrorPasswordIncorrect[source]

A provided password was incorrect.

exception virtualbox.library.OleErrorFail[source]

Unspecified error

exception virtualbox.library.OleErrorNointerface[source]

No such interface supported

exception virtualbox.library.OleErrorAccessdenied[source]

General access denied error

exception virtualbox.library.OleErrorNotimpl[source]

Not implemented

exception virtualbox.library.OleErrorUnexpected[source]

Catastrophic failure

exception virtualbox.library.OleErrorInvalidarg[source]

One or more arguments are invalid

class virtualbox.library.SettingsVersion(value)[source]

Settings version of VirtualBox settings files. This is written to the “version” attribute of the root “VirtualBox” element in the settings file XML and indicates which VirtualBox version wrote the file.

null(0)

Null value, indicates invalid version.

v1_0(1)

Legacy settings version, not currently supported.

v1_1(2)

Legacy settings version, not currently supported.

v1_2(3)

Legacy settings version, not currently supported.

v1_3pre(4)

Legacy settings version, not currently supported.

v1_3(5)

Settings version “1.3”, written by VirtualBox 2.0.12.

v1_4(6)

Intermediate settings version, understood by VirtualBox 2.1.x.

v1_5(7)

Intermediate settings version, understood by VirtualBox 2.1.x.

v1_6(8)

Settings version “1.6”, written by VirtualBox 2.1.4 (at least).

v1_7(9)

Settings version “1.7”, written by VirtualBox 2.2.x and 3.0.x.

v1_8(10)

Intermediate settings version “1.8”, understood by VirtualBox 3.1.x.

v1_9(11)

Settings version “1.9”, written by VirtualBox 3.1.x.

v1_10(12)

Settings version “1.10”, written by VirtualBox 3.2.x.

v1_11(13)

Settings version “1.11”, written by VirtualBox 4.0.x.

v1_12(14)

Settings version “1.12”, written by VirtualBox 4.1.x.

v1_13(15)

Settings version “1.13”, written by VirtualBox 4.2.x.

v1_14(16)

Settings version “1.14”, written by VirtualBox 4.3.x.

v1_15(17)

Settings version “1.15”, written by VirtualBox 5.0.x.

v1_16(18)

Settings version “1.16”, written by VirtualBox 5.1.x.

future(99999)

Settings version greater than “1.15”, written by a future VirtualBox version.

future = SettingsVersion(99999)
null = SettingsVersion(0)
v1_0 = SettingsVersion(1)
v1_1 = SettingsVersion(2)
v1_10 = SettingsVersion(12)
v1_11 = SettingsVersion(13)
v1_12 = SettingsVersion(14)
v1_13 = SettingsVersion(15)
v1_14 = SettingsVersion(16)
v1_15 = SettingsVersion(17)
v1_16 = SettingsVersion(18)
v1_2 = SettingsVersion(3)
v1_3 = SettingsVersion(5)
v1_3pre = SettingsVersion(4)
v1_4 = SettingsVersion(6)
v1_5 = SettingsVersion(7)
v1_6 = SettingsVersion(8)
v1_7 = SettingsVersion(9)
v1_8 = SettingsVersion(10)
v1_9 = SettingsVersion(11)
class virtualbox.library.AccessMode(value)[source]

Access mode for opening files.

read_only(1)
read_write(2)
class virtualbox.library.MachineState(value)[source]

Virtual machine execution state.

This enumeration represents possible values of the IMachine.state() attribute.

Below is the basic virtual machine state diagram. It shows how the state changes during virtual machine execution. The text in square braces shows a method of the IConsole or IMachine interface that performs the given state transition.

+---------[powerDown()] <- Stuck <--[failure]-+
V                                             |
+-> PoweredOff --+-->[powerUp()]--> Starting --+      | +-----[resume()]-----+
|                |                             |      | V                    |
|   Aborted -----+                             +--> Running --[pause()]--> Paused
|                                              |      ^ |                   ^ |
|   Saved -----------[powerUp()]--> Restoring -+      | |                   | |
|     ^                                               | |                   | |
|     |     +-----------------------------------------+-|-------------------+ +
|     |     |                                           |                     |
|     |     +- OnlineSnapshotting <--[takeSnapshot()]<--+---------------------+
|     |                                                 |                     |
|     +-------- Saving <--------[saveState()]<----------+---------------------+
|                                                       |                     |
+-------------- Stopping -------[powerDown()]<----------+---------------------+

Note that states to the right from PoweredOff, Aborted and Saved in the above diagram are called online VM states. These states represent the virtual machine which is being executed in a dedicated process (usually with a GUI window attached to it where you can see the activity of the virtual machine and interact with it). There are two special pseudo-states, FirstOnline and LastOnline, that can be used in relational expressions to detect if the given machine state is online or not:

if (machine.GetState() >= MachineState_FirstOnline &&
machine.GetState() <= MachineState_LastOnline)
{
...the machine is being executed...
}

When the virtual machine is in one of the online VM states (that is, being executed), only a few machine settings can be modified. Methods working with such settings contain an explicit note about that. An attempt to change any other setting or perform a modifying operation during this time will result in the @c VBOX_E_INVALID_VM_STATE error.

All online states except Running, Paused and Stuck are transitional: they represent temporary conditions of the virtual machine that will last as long as the operation that initiated such a condition.

The Stuck state is a special case. It means that execution of the machine has reached the “Guru Meditation” condition. This condition indicates an internal VMM (virtual machine manager) failure which may happen as a result of either an unhandled low-level virtual hardware exception or one of the recompiler exceptions (such as the too-many-traps condition).

Note also that any online VM state may transit to the Aborted state. This happens if the process that is executing the virtual machine terminates unexpectedly (for example, crashes). Other than that, the Aborted state is equivalent to PoweredOff.

There are also a few additional state diagrams that do not deal with virtual machine execution and therefore are shown separately. The states shown on these diagrams are called offline VM states (this includes PoweredOff, Aborted and Saved too).

The first diagram shows what happens when a lengthy setup operation is being executed (such as IMachine.attach_device() ).

+----------------------------------(same state as before the call)------+
|                                                                       |
+-> PoweredOff --+                                                      |
|                |                                                      |
|-> Aborted -----+-->[lengthy VM configuration call] --> SettingUp -----+
|                |
+-> Saved -------+

The next two diagrams demonstrate the process of taking a snapshot of a powered off virtual machine, restoring the state to that as of a snapshot or deleting a snapshot, respectively.

+----------------------------------(same state as before the call)------+
|                                                                       |
+-> PoweredOff --+                                                      |
|                +-->[takeSnapshot()] ------------------> Snapshotting -+
+-> Aborted -----+

+-> PoweredOff --+
|                |
|   Aborted -----+-->[restoreSnapshot()    ]-------> RestoringSnapshot -+
|                |   [deleteSnapshot()     ]-------> DeletingSnapshot --+
+-> Saved -------+                                                      |
|                                                                       |
+---(Saved if restored from an online snapshot, PoweredOff otherwise)---+

For whoever decides to touch this enum: In order to keep the comparisons involving FirstOnline and LastOnline pseudo-states valid, the numeric values of these states must be correspondingly updated if needed: for any online VM state, the condition FirstOnline <= state <= LastOnline must be @c true. The same relates to transient states for which the condition FirstOnline <= state <= LastOnline must be @c true.

null(0)

Null value (never used by the API).

powered_off(1)

The machine is not running and has no saved execution state; it has either never been started or been shut down successfully.

saved(2)

The machine is not currently running, but the execution state of the machine has been saved to an external file when it was running, from where it can be resumed.

teleported(3)

The machine was teleported to a different host (or process) and then powered off. Take care when powering it on again may corrupt resources it shares with the teleportation target (e.g. disk and network).

aborted(4)

The process running the machine has terminated abnormally. This may indicate a crash of the VM process in host execution context, or the VM process has been terminated externally.

running(5)

The machine is currently being executed.

For whoever decides to touch this enum: In order to keep the comparisons in the old source code valid, this state must immediately precede the Paused state.

@todo Lift this spectacularly wonderful restriction.

paused(6)

Execution of the machine has been paused.

For whoever decides to touch this enum: In order to keep the comparisons in the old source code valid, this state must immediately follow the Running state.

@todo Lift this spectacularly wonderful restriction.

stuck(7)

Execution of the machine has reached the “Guru Meditation” condition. This indicates a severe error in the hypervisor itself.

bird: Why this uncool name? Could we rename it to “GuruMeditation” or “Guru”, perhaps? Or are there some other VMM states that are intended to be lumped in here as well?

teleporting(8)

The machine is about to be teleported to a different host or process. It is possible to pause a machine in this state, but it will go to the @c TeleportingPausedVM state and it will not be possible to resume it again unless the teleportation fails.

live_snapshotting(9)

A live snapshot is being taken. The machine is running normally, but some of the runtime configuration options are inaccessible. Also, if paused while in this state it will transition to @c OnlineSnapshotting and it will not be resume the execution until the snapshot operation has completed.

starting(10)

Machine is being started after powering it on from a zero execution state.

stopping(11)

Machine is being normally stopped powering it off, or after the guest OS has initiated a shutdown sequence.

saving(12)

Machine is saving its execution state to a file.

restoring(13)

Execution state of the machine is being restored from a file after powering it on from the saved execution state.

teleporting_paused_vm(14)

The machine is being teleported to another host or process, but it is not running. This is the paused variant of the @c Teleporting state.

teleporting_in(15)

Teleporting the machine state in from another host or process.

fault_tolerant_syncing(16)

The machine is being synced with a fault tolerant VM running elsewhere.

deleting_snapshot_online(17)

Like @c DeletingSnapshot, but the merging of media is ongoing in the background while the machine is running.

deleting_snapshot_paused(18)

Like @c DeletingSnapshotOnline, but the machine was paused when the merging of differencing media was started.

online_snapshotting(19)

Like @c LiveSnapshotting, but the machine was paused when the merging of differencing media was started.

restoring_snapshot(20)

A machine snapshot is being restored; this typically does not take long.

deleting_snapshot(21)

A machine snapshot is being deleted; this can take a long time since this may require merging differencing media. This value indicates that the machine is not running while the snapshot is being deleted.

setting_up(22)

Lengthy setup operation is in progress.

snapshotting(23)

Taking an (offline) snapshot.

first_online(5)

Pseudo-state: first online state (for use in relational expressions).

last_online(19)

Pseudo-state: last online state (for use in relational expressions).

first_transient(8)

Pseudo-state: first transient state (for use in relational expressions).

last_transient(23)

Pseudo-state: last transient state (for use in relational expressions).

aborted = MachineState(4)
deleting_snapshot = MachineState(21)
deleting_snapshot_online = MachineState(17)
deleting_snapshot_paused = MachineState(18)
fault_tolerant_syncing = MachineState(16)
first_online = MachineState(5)
first_transient = MachineState(8)
last_online = MachineState(19)
last_transient = MachineState(23)
live_snapshotting = MachineState(9)
null = MachineState(0)
online_snapshotting = MachineState(19)
paused = MachineState(6)
powered_off = MachineState(1)
restoring = MachineState(13)
restoring_snapshot = MachineState(20)
running = MachineState(5)
saved = MachineState(2)
saving = MachineState(12)
setting_up = MachineState(22)
snapshotting = MachineState(23)
starting = MachineState(10)
stopping = MachineState(11)
stuck = MachineState(7)
teleported = MachineState(3)
teleporting = MachineState(8)
teleporting_in = MachineState(15)
teleporting_paused_vm = MachineState(14)
class virtualbox.library.SessionState(value)[source]

Session state. This enumeration represents possible values of IMachine.session_state() and ISession.state() attributes.

null(0)

Null value (never used by the API).

unlocked(1)

In IMachine.session_state() , this means that the machine is not locked for any sessions.

In ISession.state() , this means that no machine is currently locked for this session.

locked(2)

In IMachine.session_state() , this means that the machine is currently locked for a session, whose process identifier can then be found in the IMachine.session_pid() attribute.

In ISession.state() , this means that a machine is currently locked for this session, and the mutable machine object can be found in the ISession.machine() attribute (see IMachine.lock_machine() for details).

spawning(3)

A new process is being spawned for the machine as a result of IMachine.launch_vm_process() call. This state also occurs as a short transient state during an IMachine.lock_machine() call.

unlocking(4)

The session is being unlocked.

locked = SessionState(2)
null = SessionState(0)
spawning = SessionState(3)
unlocked = SessionState(1)
unlocking = SessionState(4)
class virtualbox.library.CPUPropertyType(value)[source]

Virtual CPU property type. This enumeration represents possible values of the IMachine get- and setCPUProperty methods.

null(0)

Null value (never used by the API).

pae(1)

This setting determines whether VirtualBox will expose the Physical Address Extension (PAE) feature of the host CPU to the guest. Note that in case PAE is not available, it will not be reported.

long_mode(2)

This setting determines whether VirtualBox will advertise long mode (i.e. 64-bit guest support) and let the guest enter it.

triple_fault_reset(3)

This setting determines whether a triple fault within a guest will trigger an internal error condition and stop the VM (default) or reset the virtual CPU/VM and continue execution.

apic(4)

This setting determines whether an APIC is part of the virtual CPU. This feature can only be turned off when the X2APIC feature is off.

x2_apic(5)

This setting determines whether an x2APIC is part of the virtual CPU. Since this feature implies that the APIC feature is present, it automatically enables the APIC feature when set.

apic = CPUPropertyType(4)
long_mode = CPUPropertyType(2)
null = CPUPropertyType(0)
pae = CPUPropertyType(1)
triple_fault_reset = CPUPropertyType(3)
x2_apic = CPUPropertyType(5)
class virtualbox.library.HWVirtExPropertyType(value)[source]

Hardware virtualization property type. This enumeration represents possible values for the IMachine.get_hw_virt_ex_property() and IMachine.set_hw_virt_ex_property() methods.

null(0)

Null value (never used by the API).

enabled(1)

Whether hardware virtualization (VT-x/AMD-V) is enabled at all. If such extensions are not available, they will not be used.

vpid(2)

Whether VT-x VPID is enabled. If this extension is not available, it will not be used.

nested_paging(3)

Whether Nested Paging is enabled. If this extension is not available, it will not be used.

unrestricted_execution(4)

Whether VT-x unrestricted execution is enabled. If this feature is not available, it will not be used.

large_pages(5)

Whether large page allocation is enabled; requires nested paging and a 64-bit host.

force(6)

Whether the VM should fail to start if hardware virtualization (VT-x/AMD-V) cannot be used. If not set, there will be an automatic fallback to software virtualization.

enabled = HWVirtExPropertyType(1)
force = HWVirtExPropertyType(6)
large_pages = HWVirtExPropertyType(5)
nested_paging = HWVirtExPropertyType(3)
null = HWVirtExPropertyType(0)
unrestricted_execution = HWVirtExPropertyType(4)
vpid = HWVirtExPropertyType(2)
class virtualbox.library.ParavirtProvider(value)[source]

The paravirtualized guest interface provider. This enumeration represents possible values for the IMachine.paravirt_provider() attribute.

none(0)

No provider is used.

default(1)

A default provider is automatically chosen according to the guest OS type.

legacy(2)

Used for VMs which didn’t used to have any provider settings. Usually interpreted as @c None for most VMs.

minimal(3)

A minimal set of features to expose to the paravirtualized guest.

hyper_v(4)

Microsoft Hyper-V.

kvm(5)

Linux KVM.

default = ParavirtProvider(1)
hyper_v = ParavirtProvider(4)
kvm = ParavirtProvider(5)
legacy = ParavirtProvider(2)
minimal = ParavirtProvider(3)
none = ParavirtProvider(0)
class virtualbox.library.FaultToleranceState(value)[source]

Used with IMachine.fault_tolerance_state() .

inactive(1)

No fault tolerance enabled.

master(2)

Fault tolerant master VM.

standby(3)

Fault tolerant standby VM.

inactive = FaultToleranceState(1)
master = FaultToleranceState(2)
standby = FaultToleranceState(3)
class virtualbox.library.LockType(value)[source]

Used with IMachine.lock_machine() .

null(0)

Placeholder value, do not use when obtaining a lock.

shared(1)

Request only a shared lock for remote-controlling the machine. Such a lock allows changing certain VM settings which can be safely modified for a running VM.

write(2)

Lock the machine for writing. This requests an exclusive lock, i.e. there cannot be any other API client holding any type of lock for this VM concurrently. Remember that a VM process counts as an API client which implicitly holds the equivalent of a shared lock during the entire VM runtime.

vm(3)

Lock the machine for writing, and create objects necessary for running a VM in this process.

null = LockType(0)
shared = LockType(1)
vm = LockType(3)
write = LockType(2)
class virtualbox.library.SessionType(value)[source]

Session type. This enumeration represents possible values of the ISession.type_p() attribute.

null(0)

Null value (never used by the API).

write_lock(1)

Session has acquired an exclusive write lock on a machine using IMachine.lock_machine() .

remote(2)

Session has launched a VM process using IMachine.launch_vm_process()

shared(3)

Session has obtained a link to another session using IMachine.lock_machine()

null = SessionType(0)
remote = SessionType(2)
shared = SessionType(3)
write_lock = SessionType(1)
class virtualbox.library.DeviceType(value)[source]

Device type.

null(0)

Null value, may also mean “no device” (not allowed for IConsole.get_device_activity() ).

floppy(1)

Floppy device.

dvd(2)

CD/DVD-ROM device.

hard_disk(3)

Hard disk device.

network(4)

Network device.

usb(5)

USB device.

shared_folder(6)

Shared folder device.

graphics3_d(7)

Graphics device 3D activity.

dvd = DeviceType(2)
floppy = DeviceType(1)
graphics3_d = DeviceType(7)
hard_disk = DeviceType(3)
network = DeviceType(4)
null = DeviceType(0)
shared_folder = DeviceType(6)
usb = DeviceType(5)
class virtualbox.library.DeviceActivity(value)[source]

Device activity for IConsole.get_device_activity() .

null(0)
idle(1)
reading(2)
writing(3)
class virtualbox.library.ClipboardMode(value)[source]

Host-Guest clipboard interchange mode.

disabled(0)
host_to_guest(1)
guest_to_host(2)
bidirectional(3)
class virtualbox.library.DnDMode(value)[source]

Drag and drop interchange mode.

disabled(0)
host_to_guest(1)
guest_to_host(2)
bidirectional(3)
class virtualbox.library.Scope(value)[source]

Scope of the operation.

A generic enumeration used in various methods to define the action or argument scope.

global_p(0)
machine(1)
session(2)
class virtualbox.library.BIOSBootMenuMode(value)[source]

BIOS boot menu mode.

disabled(0)
menu_only(1)
message_and_menu(2)
class virtualbox.library.APICMode(value)[source]

BIOS APIC initialization mode. If the hardware does not support the mode then the code falls back to a lower mode.

disabled(0)
apic(1)
x2_apic(2)
class virtualbox.library.ProcessorFeature(value)[source]

CPU features.

hw_virt_ex(0)
pae(1)
long_mode(2)
nested_paging(3)
class virtualbox.library.FirmwareType(value)[source]

Firmware type.

bios(1)

BIOS Firmware.

efi(2)

EFI Firmware, bitness detected basing on OS type.

efi32(3)

EFI firmware, 32-bit.

efi64(4)

EFI firmware, 64-bit.

efidual(5)

EFI firmware, combined 32 and 64-bit.

bios = FirmwareType(1)
efi = FirmwareType(2)
efi32 = FirmwareType(3)
efi64 = FirmwareType(4)
efidual = FirmwareType(5)
class virtualbox.library.PointingHIDType(value)[source]

Type of pointing device used in a virtual machine.

none(1)

No mouse.

ps2_mouse(2)

PS/2 auxiliary device, a.k.a. mouse.

usb_mouse(3)

USB mouse (relative pointer).

usb_tablet(4)

USB tablet (absolute pointer). Also enables a relative USB mouse in addition.

combo_mouse(5)

Combined device, working as PS/2 or USB mouse, depending on guest behavior. Using this device can have negative performance implications.

usb_multi_touch(6)

USB multi-touch device. Also enables the USB tablet and mouse devices.

combo_mouse = PointingHIDType(5)
none = PointingHIDType(1)
ps2_mouse = PointingHIDType(2)
usb_mouse = PointingHIDType(3)
usb_multi_touch = PointingHIDType(6)
usb_tablet = PointingHIDType(4)
class virtualbox.library.KeyboardHIDType(value)[source]

Type of keyboard device used in a virtual machine.

none(1)

No keyboard.

ps2_keyboard(2)

PS/2 keyboard.

usb_keyboard(3)

USB keyboard.

combo_keyboard(4)

Combined device, working as PS/2 or USB keyboard, depending on guest behavior. Using of such device can have negative performance implications.

combo_keyboard = KeyboardHIDType(4)
none = KeyboardHIDType(1)
ps2_keyboard = KeyboardHIDType(2)
usb_keyboard = KeyboardHIDType(3)
class virtualbox.library.BitmapFormat(value)[source]

Format of a bitmap. Generic values for formats used by the source bitmap, the screen shot or image update APIs.

opaque(0)

Unknown buffer format (the user may not assume any particular format of the buffer).

bgr(542263106)

Generic BGR format without alpha channel. Pixel layout depends on the number of bits per pixel:

32 - bits 31:24 undefined, bits 23:16 R, bits 15:8 G, bits 7:0 B.

16 - bits 15:11 R, bits 10:5 G, bits 4:0 B.

bgr0(810698562)

4 bytes per pixel: B, G, R, 0.

bgra(1095911234)

4 bytes per pixel: B, G, R, A.

rgba(1094862674)

4 bytes per pixel: R, G, B, A.

png(541544016)

PNG image.

jpeg(1195724874)

JPEG image.

bgr = BitmapFormat(542263106)
bgr0 = BitmapFormat(810698562)
bgra = BitmapFormat(1095911234)
jpeg = BitmapFormat(1195724874)
opaque = BitmapFormat(0)
png = BitmapFormat(541544016)
rgba = BitmapFormat(1094862674)
class virtualbox.library.DhcpOpt(value)[source]
subnet_mask(1)
time_offset(2)
router(3)
time_server(4)
name_server(5)
domain_name_server(6)
log_server(7)
cookie(8)
lpr_server(9)
impress_server(10)
resourse_location_server(11)
host_name(12)
boot_file_size(13)
merit_dump_file(14)
domain_name(15)
swap_server(16)
root_path(17)
extension_path(18)
ip_forwarding_enable_disable(19)
non_local_source_routing_enable_disable(20)
policy_filter(21)
maximum_datagram_reassembly_size(22)
default_ip_time2_live(23)
path_mtu_aging_timeout(24)
ip_layer_parameters_per_interface(25)
interface_mtu(26)
all_subnets_are_local(27)
broadcast_address(28)
perform_mask_discovery(29)
mask_supplier(30)
perform_route_discovery(31)
router_solicitation_address(32)
static_route(33)
trailer_encapsulation(34)
arp_cache_timeout(35)
ethernet_encapsulation(36)
tcp_default_ttl(37)
tcp_keep_alive_interval(38)
tcp_keep_alive_garbage(39)
network_information_service_domain(40)
network_information_service_servers(41)
network_time_protocol_servers(42)
vendor_specific_information(43)
option_44(44)
option_45(45)
option_46(46)
option_47(47)
option_48(48)
option_49(49)
ip_address_lease_time(51)
option_64(64)
option_65(65)
tftp_server_name(66)
bootfile_name(67)
option_68(68)
option_69(69)
option_70(70)
option_71(71)
option_72(72)
option_73(73)
option_74(74)
option_75(75)
option_119(119)
class virtualbox.library.DhcpOptEncoding(value)[source]
legacy(0)
hex_p(1)
class virtualbox.library.VFSType(value)[source]

Virtual file systems supported by VFSExplorer.

file_p(1)
cloud(2)
s3(3)
web_dav(4)
class virtualbox.library.ImportOptions(value)[source]

Import options, used with IAppliance.import_machines() .

keep_all_ma_cs(1)

Don’t generate new MAC addresses of the attached network adapters.

keep_natma_cs(2)

Don’t generate new MAC addresses of the attached network adapters when they are using NAT.

import_to_vdi(3)

Import all disks to VDI format

import_to_vdi = ImportOptions(3)
keep_all_ma_cs = ImportOptions(1)
keep_natma_cs = ImportOptions(2)
class virtualbox.library.ExportOptions(value)[source]

Export options, used with IAppliance.write() .

create_manifest(1)

Write the optional manifest file (.mf) which is used for integrity checks prior import.

export_dvd_images(2)

Export DVD images. Default is not to export them as it is rarely needed for typical VMs.

strip_all_ma_cs(3)

Do not export any MAC address information. Default is to keep them to avoid losing information which can cause trouble after import, at the price of risking duplicate MAC addresses, if the import options are used to keep them.

strip_all_non_natma_cs(4)

Do not export any MAC address information, except for adapters using NAT. Default is to keep them to avoid losing information which can cause trouble after import, at the price of risking duplicate MAC addresses, if the import options are used to keep them.

create_manifest = ExportOptions(1)
export_dvd_images = ExportOptions(2)
strip_all_ma_cs = ExportOptions(3)
strip_all_non_natma_cs = ExportOptions(4)
class virtualbox.library.CertificateVersion(value)[source]

X.509 certificate version numbers.

v1(1)
v2(2)
v3(3)
unknown(99)
class virtualbox.library.VirtualSystemDescriptionType(value)[source]

Used with IVirtualSystemDescription to describe the type of a configuration value.

ignore(1)
os(2)
name(3)
product(4)
vendor(5)
version(6)
product_url(7)
vendor_url(8)
description(9)
license_p(10)
miscellaneous(11)
cpu(12)
memory(13)
hard_disk_controller_ide(14)
hard_disk_controller_sata(15)
hard_disk_controller_scsi(16)
hard_disk_controller_sas(17)
hard_disk_image(18)
floppy(19)
cdrom(20)
network_adapter(21)
usb_controller(22)
sound_card(23)
settings_file(24)

Not used/implemented right now, will be added later in 4.1.x.

settings_file = VirtualSystemDescriptionType(24)
class virtualbox.library.VirtualSystemDescriptionValueType(value)[source]

Used with IVirtualSystemDescription.get_values_by_type() to describe the value type to fetch.

reference(1)
original(2)
auto(3)
extra_config(4)
class virtualbox.library.GraphicsControllerType(value)[source]

Graphics controller type, used with IMachine.unregister() .

null(0)

Reserved value, invalid.

v_box_vga(1)

Default VirtualBox VGA device.

vmsvga(2)

VMware SVGA II device.

null = GraphicsControllerType(0)
v_box_vga = GraphicsControllerType(1)
vmsvga = GraphicsControllerType(2)
class virtualbox.library.CleanupMode(value)[source]

Cleanup mode, used with IMachine.unregister() .

unregister_only(1)

Unregister only the machine, but neither delete snapshots nor detach media.

detach_all_return_none(2)

Delete all snapshots and detach all media but return none; this will keep all media registered.

detach_all_return_hard_disks_only(3)

Delete all snapshots, detach all media and return hard disks for closing, but not removable media.

full(4)

Delete all snapshots, detach all media and return all media for closing.

detach_all_return_hard_disks_only = CleanupMode(3)
detach_all_return_none = CleanupMode(2)
full = CleanupMode(4)
unregister_only = CleanupMode(1)
class virtualbox.library.CloneMode(value)[source]

Clone mode, used with IMachine.clone_to() .

machine_state(1)

Clone the state of the selected machine.

machine_and_child_states(2)

Clone the state of the selected machine and its child snapshots if present.

all_states(3)

Clone all states (including all snapshots) of the machine, regardless of the machine object used.

all_states = CloneMode(3)
machine_and_child_states = CloneMode(2)
machine_state = CloneMode(1)
class virtualbox.library.CloneOptions(value)[source]

Clone options, used with IMachine.clone_to() .

link(1)

Create a clone VM where all virtual disks are linked to the original VM.

keep_all_ma_cs(2)

Don’t generate new MAC addresses of the attached network adapters.

keep_natma_cs(3)

Don’t generate new MAC addresses of the attached network adapters when they are using NAT.

keep_disk_names(4)

Don’t change the disk names.

keep_all_ma_cs = CloneOptions(2)
keep_disk_names = CloneOptions(4)
keep_natma_cs = CloneOptions(3)
class virtualbox.library.AutostopType(value)[source]

Autostop types, used with IMachine.autostop_type() .

disabled(1)

Stopping the VM during system shutdown is disabled.

save_state(2)

The state of the VM will be saved when the system shuts down.

power_off(3)

The VM is powered off when the system shuts down.

acpi_shutdown(4)

An ACPI shutdown event is generated.

acpi_shutdown = AutostopType(4)
disabled = AutostopType(1)
power_off = AutostopType(3)
save_state = AutostopType(2)
class virtualbox.library.HostNetworkInterfaceMediumType(value)[source]

Type of encapsulation. Ethernet encapsulation includes both wired and wireless Ethernet connections. IHostNetworkInterface

unknown(0)

The type of interface cannot be determined.

ethernet(1)

Ethernet frame encapsulation.

ppp(2)

Point-to-point protocol encapsulation.

slip(3)

Serial line IP encapsulation.

ethernet = HostNetworkInterfaceMediumType(1)
ppp = HostNetworkInterfaceMediumType(2)
slip = HostNetworkInterfaceMediumType(3)
unknown = HostNetworkInterfaceMediumType(0)
class virtualbox.library.HostNetworkInterfaceStatus(value)[source]

Current status of the interface. IHostNetworkInterface

unknown(0)

The state of interface cannot be determined.

up(1)

The interface is fully operational.

down(2)

The interface is not functioning.

down = HostNetworkInterfaceStatus(2)
unknown = HostNetworkInterfaceStatus(0)
up = HostNetworkInterfaceStatus(1)
class virtualbox.library.HostNetworkInterfaceType(value)[source]

Network interface type.

bridged(1)
host_only(2)
class virtualbox.library.AdditionsFacilityType(value)[source]

Guest Additions facility IDs.

none(0)

No/invalid facility.

v_box_guest_driver(20)

VirtualBox base driver (VBoxGuest).

auto_logon(90)

Auto-logon modules (VBoxGINA, VBoxCredProv, pam_vbox).

v_box_service(100)

VirtualBox system service (VBoxService).

v_box_tray_client(101)

VirtualBox desktop integration (VBoxTray on Windows, VBoxClient on non-Windows).

seamless(1000)

Seamless guest desktop integration.

graphics(1100)

Guest graphics mode. If not enabled, seamless rendering will not work, resize hints are not immediately acted on and guest display resizes are probably not initiated by the guest additions.

all_p(2147483646)

All facilities selected.

all_p = AdditionsFacilityType(2147483646)
auto_logon = AdditionsFacilityType(90)
graphics = AdditionsFacilityType(1100)
none = AdditionsFacilityType(0)
seamless = AdditionsFacilityType(1000)
v_box_guest_driver = AdditionsFacilityType(20)
v_box_service = AdditionsFacilityType(100)
v_box_tray_client = AdditionsFacilityType(101)
class virtualbox.library.AdditionsFacilityClass(value)[source]

Guest Additions facility classes.

none(0)

No/invalid class.

driver(10)

Driver.

service(30)

System service.

program(50)

Program.

feature(100)

Feature.

third_party(999)

Third party.

all_p(2147483646)

All facility classes selected.

all_p = AdditionsFacilityClass(2147483646)
driver = AdditionsFacilityClass(10)
feature = AdditionsFacilityClass(100)
none = AdditionsFacilityClass(0)
program = AdditionsFacilityClass(50)
service = AdditionsFacilityClass(30)
third_party = AdditionsFacilityClass(999)
class virtualbox.library.AdditionsFacilityStatus(value)[source]

Guest Additions facility states.

inactive(0)

Facility is not active.

paused(1)

Facility has been paused.

pre_init(20)

Facility is preparing to initialize.

init(30)

Facility is initializing.

active(50)

Facility is up and running.

terminating(100)

Facility is shutting down.

terminated(101)

Facility successfully shut down.

failed(800)

Facility failed to start.

unknown(999)

Facility status is unknown.

active = AdditionsFacilityStatus(50)
failed = AdditionsFacilityStatus(800)
inactive = AdditionsFacilityStatus(0)
init = AdditionsFacilityStatus(30)
paused = AdditionsFacilityStatus(1)
pre_init = AdditionsFacilityStatus(20)
terminated = AdditionsFacilityStatus(101)
terminating = AdditionsFacilityStatus(100)
unknown = AdditionsFacilityStatus(999)
class virtualbox.library.AdditionsRunLevelType(value)[source]

Guest Additions run level type.

none(0)

Guest Additions are not loaded.

system(1)

Guest drivers are loaded.

userland(2)

Common components (such as application services) are loaded.

desktop(3)

Per-user desktop components are loaded.

desktop = AdditionsRunLevelType(3)
none = AdditionsRunLevelType(0)
system = AdditionsRunLevelType(1)
userland = AdditionsRunLevelType(2)
class virtualbox.library.AdditionsUpdateFlag(value)[source]

Guest Additions update flags.

none(0)

No flag set.

wait_for_update_start_only(1)

Starts the regular updating process and waits until the actual Guest Additions update inside the guest was started. This can be necessary due to needed interaction with the guest OS during the installation phase.

none = AdditionsUpdateFlag(0)
wait_for_update_start_only = AdditionsUpdateFlag(1)
class virtualbox.library.GuestSessionStatus(value)[source]

Guest session status. This enumeration represents possible values of the IGuestSession.status() attribute.

undefined(0)

Guest session is in an undefined state.

starting(10)

Guest session is being started.

started(100)

Guest session has been started.

terminating(480)

Guest session is being terminated.

terminated(500)

Guest session terminated normally.

timed_out_killed(512)

Guest session timed out and was killed.

timed_out_abnormally(513)

Guest session timed out and was not killed successfully.

down(600)

Service/OS is stopping, guest session was killed.

error(800)

Something went wrong.

down = GuestSessionStatus(600)
error = GuestSessionStatus(800)
started = GuestSessionStatus(100)
starting = GuestSessionStatus(10)
terminated = GuestSessionStatus(500)
terminating = GuestSessionStatus(480)
timed_out_abnormally = GuestSessionStatus(513)
timed_out_killed = GuestSessionStatus(512)
undefined = GuestSessionStatus(0)
class virtualbox.library.GuestSessionWaitForFlag(value)[source]

Guest session waiting flags. Multiple flags can be combined.

none(0)

No waiting flags specified. Do not use this.

start(1)

Wait for the guest session being started.

terminate(2)

Wait for the guest session being terminated.

status(4)

Wait for the next guest session status change.

none = GuestSessionWaitForFlag(0)
start = GuestSessionWaitForFlag(1)
status = GuestSessionWaitForFlag(4)
terminate = GuestSessionWaitForFlag(2)
class virtualbox.library.GuestSessionWaitResult(value)[source]

Guest session waiting results. Depending on the session waiting flags (for more information see GuestSessionWaitForFlag ) the waiting result can vary based on the session’s current status.

To wait for a guest session to terminate after it has been created by IGuest.create_session() one would specify GuestSessionWaitResult_Terminate.

none(0)

No result was returned. Not being used.

start(1)

The guest session has been started.

terminate(2)

The guest session has been terminated.

status(3)

The guest session has changed its status. The status then can be retrieved via IGuestSession.status() .

error(4)

Error while executing the process.

timeout(5)

The waiting operation timed out. This also will happen when no event has been occurred matching the current waiting flags in a IGuestSession.wait_for() call.

wait_flag_not_supported(6)

A waiting flag specified in the IGuestSession.wait_for() call is not supported by the guest.

error = GuestSessionWaitResult(4)
none = GuestSessionWaitResult(0)
start = GuestSessionWaitResult(1)
status = GuestSessionWaitResult(3)
terminate = GuestSessionWaitResult(2)
timeout = GuestSessionWaitResult(5)
wait_flag_not_supported = GuestSessionWaitResult(6)
class virtualbox.library.GuestUserState(value)[source]

State a guest user has been changed to.

unknown(0)

Unknown state. Not being used.

logged_in(1)

A guest user has been successfully logged into the guest OS. This property is not implemented yet!

logged_out(2)

A guest user has been successfully logged out of the guest OS. This property is not implemented yet!

locked(3)

A guest user has locked its account. This might include running a password-protected screensaver in the guest. This property is not implemented yet!

unlocked(4)

A guest user has unlocked its account. This property is not implemented yet!

disabled(5)

A guest user has been disabled by the guest OS. This property is not implemented yet!

idle(6)

A guest user currently is not using the guest OS. Currently only available for Windows guests since Windows 2000 SP2. On Windows guests this function currently only supports reporting contiguous idle times up to 49.7 days per user. The event will be triggered if a guest user is not active for at least 5 seconds. This threshold can be adjusted by either altering VBoxService’s command line in the guest to –vminfo-user-idle-threshold , or by setting the per-VM guest property /VirtualBox/GuestAdd/VBoxService/–vminfo-user-idle-threshold with the RDONLYGUEST flag on the host. In both cases VBoxService needs to be restarted in order to get the changes applied.

in_use(7)

A guest user continued using the guest OS after being idle.

created(8)

A guest user has been successfully created. This property is not implemented yet!

deleted(9)

A guest user has been successfully deleted. This property is not implemented yet!

session_changed(10)

To guest OS has changed the session of a user. This property is not implemented yet!

credentials_changed(11)

To guest OS has changed the authentication credentials of a user. This might include changed passwords and authentication types. This property is not implemented yet!

role_changed(12)

To guest OS has changed the role of a user permanently, e.g. granting / denying administrative rights. This property is not implemented yet!

group_added(13)

To guest OS has added a user to a specific user group. This property is not implemented yet!

group_removed(14)

To guest OS has removed a user from a specific user group. This property is not implemented yet!

elevated(15)

To guest OS temporarily has elevated a user to perform a certain task. This property is not implemented yet!

created = GuestUserState(8)
credentials_changed = GuestUserState(11)
deleted = GuestUserState(9)
disabled = GuestUserState(5)
elevated = GuestUserState(15)
group_added = GuestUserState(13)
group_removed = GuestUserState(14)
idle = GuestUserState(6)
in_use = GuestUserState(7)
locked = GuestUserState(3)
logged_in = GuestUserState(1)
logged_out = GuestUserState(2)
role_changed = GuestUserState(12)
session_changed = GuestUserState(10)
unknown = GuestUserState(0)
unlocked = GuestUserState(4)
class virtualbox.library.FileSeekOrigin(value)[source]

What a file seek (IFile.seek() ) is relative to.

begin(0)

Seek from the beginning of the file.

current(1)

Seek from the current file position.

end(2)

Seek relative to the end of the file. To seek to the position two bytes from the end of the file, specify -2 as the seek offset.

begin = FileSeekOrigin(0)
current = FileSeekOrigin(1)
end = FileSeekOrigin(2)
class virtualbox.library.ProcessInputFlag(value)[source]

Guest process input flags.

none(0)

No flag set.

end_of_file(1)

End of file (input) reached.

end_of_file = ProcessInputFlag(1)
none = ProcessInputFlag(0)
class virtualbox.library.ProcessOutputFlag(value)[source]

Guest process output flags for specifying which type of output to retrieve.

none(0)

No flags set. Get output from stdout.

std_err(1)

Get output from stderr.

none = ProcessOutputFlag(0)
std_err = ProcessOutputFlag(1)
class virtualbox.library.ProcessWaitForFlag(value)[source]

Process waiting flags. Multiple flags can be combined.

none(0)

No waiting flags specified. Do not use this.

start(1)

Wait for the process being started.

terminate(2)

Wait for the process being terminated.

std_in(4)

Wait for stdin becoming available.

std_out(8)

Wait for data becoming available on stdout.

std_err(16)

Wait for data becoming available on stderr.

none = ProcessWaitForFlag(0)
start = ProcessWaitForFlag(1)
std_err = ProcessWaitForFlag(16)
std_in = ProcessWaitForFlag(4)
std_out = ProcessWaitForFlag(8)
terminate = ProcessWaitForFlag(2)
class virtualbox.library.ProcessWaitResult(value)[source]

Process waiting results. Depending on the process waiting flags (for more information see ProcessWaitForFlag ) the waiting result can vary based on the processes’ current status.

To wait for a guest process to terminate after it has been created by IGuestSession.process_create() or IGuestSession.process_create_ex() one would specify ProcessWaitFor_Terminate.

If a guest process has been started with ProcessCreateFlag_WaitForStdOut a client can wait with ProcessWaitResult_StdOut for new data to arrive on stdout; same applies for ProcessCreateFlag_WaitForStdErr and ProcessWaitResult_StdErr.

none(0)

No result was returned. Not being used.

start(1)

The process has been started.

terminate(2)

The process has been terminated.

status(3)

The process has changed its status. The status then can be retrieved via IProcess.status() .

error(4)

Error while executing the process.

timeout(5)

The waiting operation timed out. Also use if the guest process has timed out in the guest side (kill attempted).

std_in(6)

The process signalled that stdin became available for writing.

std_out(7)

Data on stdout became available for reading.

std_err(8)

Data on stderr became available for reading.

wait_flag_not_supported(9)

A waiting flag specified in the IProcess.wait_for() call is not supported by the guest.

error = ProcessWaitResult(4)
none = ProcessWaitResult(0)
start = ProcessWaitResult(1)
status = ProcessWaitResult(3)
std_err = ProcessWaitResult(8)
std_in = ProcessWaitResult(6)
std_out = ProcessWaitResult(7)
terminate = ProcessWaitResult(2)
timeout = ProcessWaitResult(5)
wait_flag_not_supported = ProcessWaitResult(9)
class virtualbox.library.FileCopyFlag(value)[source]

File copying flags. Not flags are implemented yet.

none(0)

No flag set.

no_replace(1)

Do not replace the destination file if it exists. This flag is not implemented yet.

follow_links(2)

Follow symbolic links. This flag is not implemented yet.

update(4)

Only copy when the source file is newer than the destination file or when the destination file is missing. This flag is not implemented yet.

no_replace = FileCopyFlag(1)
none = FileCopyFlag(0)
update = FileCopyFlag(4)
class virtualbox.library.FsObjMoveFlags(value)[source]

File moving flags.

none(0)

No flag set.

replace(1)

Replace the destination file, symlink, etc if it exists, however this does not allow replacing any directories.

follow_links(2)

Follow symbolic links in the final components or not (only applied to the given source and target paths, not to anything else).

allow_directory_moves(4)

Allow moving directories accross file system boundraries. Because it is could be a big undertaking, we require extra assurance that we should do it when requested.

allow_directory_moves = FsObjMoveFlags(4)
none = FsObjMoveFlags(0)
replace = FsObjMoveFlags(1)
class virtualbox.library.DirectoryCreateFlag(value)[source]

Directory creation flags.

none(0)

No flag set.

parents(1)

No error if existing, make parent directories as needed.

none = DirectoryCreateFlag(0)
parents = DirectoryCreateFlag(1)
class virtualbox.library.DirectoryCopyFlags(value)[source]

Directory copying flags. Not flags are implemented yet.

none(0)

No flag set.

copy_into_existing(1)

Allow copying into an existing destination directory.

copy_into_existing = DirectoryCopyFlags(1)
none = DirectoryCopyFlags(0)
class virtualbox.library.DirectoryRemoveRecFlag(value)[source]

Directory recursive removement flags.

WARNING!! THE FLAGS ARE CURRENTLY IGNORED. THE METHOD APPLIES DirectoryRemoveRecFlag.content_and_dir REGARDLESS OF THE INPUT.

none(0)

No flag set.

content_and_dir(1)

Delete the content of the directory and the directory itself.

content_only(2)

Only delete the content of the directory, omit the directory it self.

content_and_dir = DirectoryRemoveRecFlag(1)
content_only = DirectoryRemoveRecFlag(2)
none = DirectoryRemoveRecFlag(0)
class virtualbox.library.FsObjRenameFlag(value)[source]

Flags for use when renaming file system objects (files, directories, symlink, etc), see IGuestSession.fs_obj_rename() .

no_replace(0)

Do not replace any destination object.

replace(1)

This will attempt to replace any destination object other except directories. (The default is to fail if the destination exists.)

no_replace = FsObjRenameFlag(0)
replace = FsObjRenameFlag(1)
class virtualbox.library.ProcessCreateFlag(value)[source]

Guest process execution flags. The values are passed to the guest additions, so its not possible to change (move) or reuse values.here. See EXECUTEPROCESSFLAG_XXX in GuestControlSvc.h.

none(0)

No flag set.

wait_for_process_start_only(1)

Only use the specified timeout value to wait for starting the guest process - the guest process itself then uses an infinite timeout.

ignore_orphaned_processes(2)

Do not report an error when executed processes are still alive when VBoxService or the guest OS is shutting down.

hidden(4)

Do not show the started process according to the guest OS guidelines.

profile(8)

Utilize the user’s profile data when exeuting a process. Only available for Windows guests at the moment.

wait_for_std_out(16)

The guest process waits until all data from stdout is read out.

wait_for_std_err(32)

The guest process waits until all data from stderr is read out.

expand_arguments(64)

Expands environment variables in process arguments.

This is not yet implemented and is currently silently ignored. We will document the protocolVersion number for this feature once it appears, so don’t use it till then.

unquoted_arguments(128)

Work around for Windows and OS/2 applications not following normal argument quoting and escaping rules. The arguments are passed to the application without any extra quoting, just a single space between each. Present since VirtualBox 4.3.28 and 5.0 beta 3.

expand_arguments = ProcessCreateFlag(64)
hidden = ProcessCreateFlag(4)
ignore_orphaned_processes = ProcessCreateFlag(2)
none = ProcessCreateFlag(0)
profile = ProcessCreateFlag(8)
unquoted_arguments = ProcessCreateFlag(128)
wait_for_process_start_only = ProcessCreateFlag(1)
wait_for_std_err = ProcessCreateFlag(32)
wait_for_std_out = ProcessCreateFlag(16)
class virtualbox.library.ProcessPriority(value)[source]

Process priorities.

invalid(0)

Invalid priority, do not use.

default(1)

Default process priority determined by the OS.

default = ProcessPriority(1)
invalid = ProcessPriority(0)
class virtualbox.library.SymlinkType(value)[source]

Symbolic link types. This is significant when creating links on the Windows platform, ignored elsewhere.

unknown(0)

It is not known what is being targeted.

directory(1)

The link targets a directory.

file_p(2)

The link targets a file (or whatever else except directories).

directory = SymlinkType(1)
file_p = SymlinkType(2)
unknown = SymlinkType(0)
class virtualbox.library.SymlinkReadFlag(value)[source]

Symbolic link reading flags.

none(0)

No flags set.

no_symlinks(1)

Don’t allow symbolic links as part of the path.

none = SymlinkReadFlag(0)
class virtualbox.library.ProcessStatus(value)[source]

Process execution statuses.

undefined(0)

Process is in an undefined state.

starting(10)

Process is being started.

started(100)

Process has been started.

paused(110)

Process has been paused.

terminating(480)

Process is being terminated.

terminated_normally(500)

Process terminated normally.

terminated_signal(510)

Process terminated via signal.

terminated_abnormally(511)

Process terminated abnormally.

timed_out_killed(512)

Process timed out and was killed.

timed_out_abnormally(513)

Process timed out and was not killed successfully.

down(600)

Service/OS is stopping, process was killed.

error(800)

Something went wrong.

down = ProcessStatus(600)
error = ProcessStatus(800)
paused = ProcessStatus(110)
started = ProcessStatus(100)
starting = ProcessStatus(10)
terminated_abnormally = ProcessStatus(511)
terminated_normally = ProcessStatus(500)
terminated_signal = ProcessStatus(510)
terminating = ProcessStatus(480)
timed_out_abnormally = ProcessStatus(513)
timed_out_killed = ProcessStatus(512)
undefined = ProcessStatus(0)
class virtualbox.library.ProcessInputStatus(value)[source]

Process input statuses.

undefined(0)

Undefined state.

broken(1)

Input pipe is broken.

available(10)

Input pipe became available for writing.

written(50)

Data has been successfully written.

overflow(100)

Too much input data supplied, data overflow.

available = ProcessInputStatus(10)
broken = ProcessInputStatus(1)
overflow = ProcessInputStatus(100)
undefined = ProcessInputStatus(0)
written = ProcessInputStatus(50)
class virtualbox.library.PathStyle(value)[source]

The path style of a system. (Values matches the RTPATH_STR_F_STYLE_XXX defines in iprt/path.h!)

dos(1)

DOS-style paths with forward and backward slashes, drive letters and UNC. Known from DOS, OS/2 and Windows.

unix(2)

UNIX-style paths with forward slashes only.

unknown(8)

The path style is not known, most likely because the guest additions aren’t active yet.

dos = PathStyle(1)
unix = PathStyle(2)
unknown = PathStyle(8)
class virtualbox.library.FileAccessMode(value)[source]

File open access mode for use with IGuestSession.file_open() and IGuestSession.file_open_ex() .

read_only(1)

Open the file only with read access.

write_only(2)

Open the file only with write access.

read_write(3)

Open the file with both read and write access.

append_only(4)

Open the file for appending only, no read or seek access. Not yet implemented.

append_read(5)

Open the file for appending and read. Writes always goes to the end of the file while reads are done at the current or specified file position. Not yet implemented.

append_only = FileAccessMode(4)
append_read = FileAccessMode(5)
read_only = FileAccessMode(1)
read_write = FileAccessMode(3)
write_only = FileAccessMode(2)
class virtualbox.library.FileOpenAction(value)[source]

What action IGuestSession.file_open() and IGuestSession.file_open_ex() should take whether the file being opened exists or not.

open_existing(1)

Opens an existing file, fails if no file exists. (Was “oe”.)

open_or_create(2)

Opens an existing file, creates a new one if no file exists. (Was “oc”.)

create_new(3)

Creates a new file is no file exists, fails if there is a file there already. (Was “ce”.)

create_or_replace(4)

Creates a new file, replace any existing file. (Was “ca”.)

Currently undefined whether we will inherit mode and ACLs from the existing file or replace them.

open_existing_truncated(5)

Opens and truncate an existing file, fails if no file exists. (Was “ot”.)

append_or_create(99)

Opens an existing file and places the file pointer at the end of the file, creates the file if it does not exist. This action implies write access. (Was “oa”.)

<!– @todo r=bird: See iprt/file.h, RTFILE_O_APPEND - not an action/disposition! Moving the file pointer to the end, is almost fine, but implying ‘write’ access isn’t. That is something that is exclusively reserved for the opening mode. –> Deprecated. Only here for historical reasons. Do not use!

append_or_create = FileOpenAction(99)
create_new = FileOpenAction(3)
create_or_replace = FileOpenAction(4)
open_existing = FileOpenAction(1)
open_existing_truncated = FileOpenAction(5)
open_or_create = FileOpenAction(2)
class virtualbox.library.FileSharingMode(value)[source]

File sharing mode for IGuestSession.file_open_ex() .

read(1)

Only share read access to the file.

write(2)

Only share write access to the file.

read_write(3)

Share both read and write access to the file, but deny deletion.

delete(4)

Only share delete access, denying read and write.

read_delete(5)

Share read and delete access to the file, denying writing.

write_delete(6)

Share write and delete access to the file, denying reading.

all_p(7)

Share all access, i.e. read, write and delete, to the file.

all_p = FileSharingMode(7)
delete = FileSharingMode(4)
read = FileSharingMode(1)
read_delete = FileSharingMode(5)
read_write = FileSharingMode(3)
write = FileSharingMode(2)
write_delete = FileSharingMode(6)
class virtualbox.library.FileOpenExFlags(value)[source]

Open flags for IGuestSession.file_open_ex() .

none(0)

No flag set.

none = FileOpenExFlags(0)
class virtualbox.library.FileStatus(value)[source]

File statuses.

undefined(0)

File is in an undefined state.

opening(10)

Guest file is opening.

open_p(100)

Guest file has been successfully opened.

closing(150)

Guest file closing.

closed(200)

Guest file has been closed.

down(600)

Service/OS is stopping, guest file was closed.

error(800)

Something went wrong.

closed = FileStatus(200)
closing = FileStatus(150)
down = FileStatus(600)
error = FileStatus(800)
open_p = FileStatus(100)
opening = FileStatus(10)
undefined = FileStatus(0)
class virtualbox.library.FsObjType(value)[source]

File system object (file) types.

unknown(1)

Used either if the object has type that is not in this enum, or if the type has not yet been determined or set.

fifo(2)

FIFO or named pipe, depending on the platform/terminology.

dev_char(3)

Character device.

directory(4)

Directory.

dev_block(5)

Block device.

file_p(6)

Regular file.

symlink(7)

Symbolic link.

socket(8)

Socket.

white_out(9)

A white-out file. Found in union mounts where it is used for hiding files after deletion, I think.

dev_block = FsObjType(5)
dev_char = FsObjType(3)
directory = FsObjType(4)
fifo = FsObjType(2)
file_p = FsObjType(6)
socket = FsObjType(8)
unknown = FsObjType(1)
white_out = FsObjType(9)
class virtualbox.library.DnDAction(value)[source]

Possible actions of a drag’n drop operation.

ignore(0)

Do nothing.

copy(1)

Copy the item to the target.

move(2)

Move the item to the target.

link(3)

Link the item from within the target.

copy = DnDAction(1)
ignore = DnDAction(0)
move = DnDAction(2)
class virtualbox.library.DirectoryOpenFlag(value)[source]

Directory open flags.

none(0)

No flag set.

no_symlinks(1)

Don’t allow symbolic links as part of the path.

none = DirectoryOpenFlag(0)
class virtualbox.library.MediumState(value)[source]

Virtual medium state. IMedium

not_created(0)

Associated medium storage does not exist (either was not created yet or was deleted).

created(1)

Associated storage exists and accessible; this gets set if the accessibility check performed by IMedium.refresh_state() was successful.

locked_read(2)

Medium is locked for reading (see IMedium.lock_read() ), no data modification is possible.

locked_write(3)

Medium is locked for writing (see IMedium.lock_write() ), no concurrent data reading or modification is possible.

inaccessible(4)

Medium accessibility check (see IMedium.refresh_state() ) has not yet been performed, or else, associated medium storage is not accessible. In the first case, IMedium.last_access_error() is empty, in the second case, it describes the error that occurred.

creating(5)

Associated medium storage is being created.

deleting(6)

Associated medium storage is being deleted.

created = MediumState(1)
creating = MediumState(5)
deleting = MediumState(6)
inaccessible = MediumState(4)
locked_read = MediumState(2)
locked_write = MediumState(3)
not_created = MediumState(0)
class virtualbox.library.MediumType(value)[source]

Virtual medium type. For each IMedium , this defines how the medium is attached to a virtual machine (see IMediumAttachment ) and what happens when a snapshot (see ISnapshot ) is taken of a virtual machine which has the medium attached. At the moment DVD and floppy media are always of type “writethrough”.

normal(0)

Normal medium (attached directly or indirectly, preserved when taking snapshots).

immutable(1)

Immutable medium (attached indirectly, changes are wiped out the next time the virtual machine is started).

writethrough(2)

Write through medium (attached directly, ignored when taking snapshots).

shareable(3)

Allow using this medium concurrently by several machines. Present since VirtualBox 3.2.0, and accepted since 3.2.8.

readonly(4)

A readonly medium, which can of course be used by several machines. Present and accepted since VirtualBox 4.0.

multi_attach(5)

A medium which is indirectly attached, so that one base medium can be used for several VMs which have their own differencing medium to store their modifications. In some sense a variant of Immutable with unset AutoReset flag in each differencing medium. Present and accepted since VirtualBox 4.0.

immutable = MediumType(1)
multi_attach = MediumType(5)
normal = MediumType(0)
readonly = MediumType(4)
shareable = MediumType(3)
writethrough = MediumType(2)
class virtualbox.library.MediumVariant(value)[source]

Virtual medium image variant. More than one flag may be set. IMedium

standard(0)

No particular variant requested, results in using the backend default.

vmdk_split2_g(1)

VMDK image split in chunks of less than 2GByte.

vmdk_raw_disk(2)

VMDK image representing a raw disk.

vmdk_stream_optimized(4)

VMDK streamOptimized image. Special import/export format which is read-only/append-only.

vmdk_esx(8)

VMDK format variant used on ESX products.

vdi_zero_expand(256)

Fill new blocks with zeroes while expanding image file.

fixed(65536)

Fixed image. Only allowed for base images.

diff(131072)

Differencing image. Only allowed for child images.

no_create_dir(1073741824)

Special flag which suppresses automatic creation of the subdirectory. Only used when passing the medium variant as an input parameter.

diff = MediumVariant(131072)
fixed = MediumVariant(65536)
no_create_dir = MediumVariant(1073741824)
standard = MediumVariant(0)
vdi_zero_expand = MediumVariant(256)
vmdk_esx = MediumVariant(8)
vmdk_raw_disk = MediumVariant(2)
vmdk_split2_g = MediumVariant(1)
vmdk_stream_optimized = MediumVariant(4)
class virtualbox.library.DataType(value)[source]
int32(0)
int8(1)
string(2)
class virtualbox.library.DataFlags(value)[source]
none(0)
mandatory(1)
expert(2)
array(4)
flag_mask(7)
class virtualbox.library.MediumFormatCapabilities(value)[source]

Medium format capability flags.

uuid(1)

Supports UUIDs as expected by VirtualBox code.

create_fixed(2)

Supports creating fixed size images, allocating all space instantly.

create_dynamic(4)

Supports creating dynamically growing images, allocating space on demand.

create_split2_g(8)

Supports creating images split in chunks of a bit less than 2 GBytes.

differencing(16)

Supports being used as a format for differencing media (see IMedium.create_diff_storage() ).

asynchronous(32)

Supports asynchronous I/O operations for at least some configurations.

file_p(64)

The format backend operates on files (the IMedium.location() attribute of the medium specifies a file used to store medium data; for a list of supported file extensions see IMediumFormat.describe_file_extensions() ).

properties(128)

The format backend uses the property interface to configure the storage location and properties (the IMediumFormat.describe_properties() method is used to get access to properties supported by the given medium format).

tcp_networking(256)

The format backend uses the TCP networking interface for network access.

vfs(512)

The format backend supports virtual filesystem functionality.

discard(1024)

The format backend supports discarding blocks.

preferred(2048)

Indicates that this is a frequently used format backend.

capability_mask(4095)
asynchronous = MediumFormatCapabilities(32)
create_dynamic = MediumFormatCapabilities(4)
create_fixed = MediumFormatCapabilities(2)
create_split2_g = MediumFormatCapabilities(8)
differencing = MediumFormatCapabilities(16)
discard = MediumFormatCapabilities(1024)
file_p = MediumFormatCapabilities(64)
preferred = MediumFormatCapabilities(2048)
properties = MediumFormatCapabilities(128)
tcp_networking = MediumFormatCapabilities(256)
uuid = MediumFormatCapabilities(1)
vfs = MediumFormatCapabilities(512)
class virtualbox.library.KeyboardLED(value)[source]

Keyboard LED indicators.

num_lock(1)
caps_lock(2)
scroll_lock(4)
class virtualbox.library.MouseButtonState(value)[source]

Mouse button state.

left_button(1)
right_button(2)
middle_button(4)
wheel_up(8)
wheel_down(16)
x_button1(32)
x_button2(64)
mouse_state_mask(127)
class virtualbox.library.TouchContactState(value)[source]

Touch event contact state.

none(0)

The touch has finished.

in_contact(1)

Whether the touch is really touching the device.

in_range(2)

Whether the touch is close enough to the device to be detected.

contact_state_mask(3)
in_contact = TouchContactState(1)
in_range = TouchContactState(2)
none = TouchContactState(0)
class virtualbox.library.FramebufferCapabilities(value)[source]

Framebuffer capability flags.

update_image(1)

Requires NotifyUpdateImage. NotifyUpdate must not be called.

vhwa(2)

Supports VHWA interface. If set, then IFramebuffer::processVHWACommand can be called.

visible_region(4)

Supports visible region. If set, then IFramebuffer::setVisibleRegion can be called.

update_image = FramebufferCapabilities(1)
vhwa = FramebufferCapabilities(2)
visible_region = FramebufferCapabilities(4)
class virtualbox.library.GuestMonitorStatus(value)[source]

The current status of the guest display.

disabled(0)

The guest monitor is disabled in the guest.

enabled(1)

The guest monitor is enabled in the guest.

blank(2)

The guest monitor is enabled in the guest but should display nothing.

blank = GuestMonitorStatus(2)
disabled = GuestMonitorStatus(0)
enabled = GuestMonitorStatus(1)
class virtualbox.library.ScreenLayoutMode(value)[source]

How IDisplay::setScreenLayout method should work.

apply_p(0)

If the guest is already at desired mode then the API might avoid setting the mode.

reset(1)

Always set the new mode even if the guest is already at desired mode.

apply_p = ScreenLayoutMode(0)
reset = ScreenLayoutMode(1)
class virtualbox.library.NetworkAttachmentType(value)[source]

Network attachment type.

null(0)

Null value, also means “not attached”.

nat(1)
bridged(2)
internal(3)
host_only(4)
generic(5)
nat_network(6)
null = NetworkAttachmentType(0)
class virtualbox.library.NetworkAdapterType(value)[source]

Network adapter type.

null(0)

Null value (never used by the API).

am79_c970_a(1)

AMD PCNet-PCI II network card (Am79C970A).

am79_c973(2)

AMD PCNet-FAST III network card (Am79C973).

i82540_em(3)

Intel PRO/1000 MT Desktop network card (82540EM).

i82543_gc(4)

Intel PRO/1000 T Server network card (82543GC).

i82545_em(5)

Intel PRO/1000 MT Server network card (82545EM).

virtio(6)

Virtio network device.

am79_c970_a = NetworkAdapterType(1)
am79_c973 = NetworkAdapterType(2)
i82540_em = NetworkAdapterType(3)
i82543_gc = NetworkAdapterType(4)
i82545_em = NetworkAdapterType(5)
null = NetworkAdapterType(0)
virtio = NetworkAdapterType(6)
class virtualbox.library.NetworkAdapterPromiscModePolicy(value)[source]

The promiscuous mode policy of an interface.

deny(1)

Deny promiscuous mode requests.

allow_network(2)

Allow promiscuous mode, but restrict the scope it to the internal network so that it only applies to other VMs.

allow_all(3)

Allow promiscuous mode, include unrelated traffic going over the wire and internally on the host.

allow_all = NetworkAdapterPromiscModePolicy(3)
allow_network = NetworkAdapterPromiscModePolicy(2)
deny = NetworkAdapterPromiscModePolicy(1)
class virtualbox.library.PortMode(value)[source]

The PortMode enumeration represents possible communication modes for the virtual serial port device.

disconnected(0)

Virtual device is not attached to any real host device.

host_pipe(1)

Virtual device is attached to a host pipe.

host_device(2)

Virtual device is attached to a host device.

raw_file(3)

Virtual device is attached to a raw file.

tcp(4)

Virtual device is attached to a TCP socket.

disconnected = PortMode(0)
host_device = PortMode(2)
host_pipe = PortMode(1)
raw_file = PortMode(3)
tcp = PortMode(4)
class virtualbox.library.USBControllerType(value)[source]

The USB controller type. IUSBController.type_p() .

null(0)

@c null value. Never used by the API.

ohci(1)
ehci(2)
xhci(3)
last(4)

Last element (invalid). Used for parameter checks.

last = USBControllerType(4)
null = USBControllerType(0)
class virtualbox.library.USBConnectionSpeed(value)[source]

USB device/port speed state. This enumeration represents speeds at which a USB device can communicate with the host.

The speed is a function of both the device itself and the port which it is attached to, including hubs and cables in the path.

Due to differences in USB stack implementations on various hosts, the reported speed may not exactly match the actual speed.

IHostUSBDevice

null(0)

@c null value. Never returned by the API.

low(1)

Low speed, 1.5 Mbps.

full(2)

Full speed, 12 Mbps.

high(3)

High speed, 480 Mbps.

super_p(4)

SuperSpeed, 5 Gbps.

super_plus(5)

SuperSpeedPlus, 10 Gbps.

full = USBConnectionSpeed(2)
high = USBConnectionSpeed(3)
low = USBConnectionSpeed(1)
null = USBConnectionSpeed(0)
super_p = USBConnectionSpeed(4)
super_plus = USBConnectionSpeed(5)
class virtualbox.library.USBDeviceState(value)[source]

USB device state. This enumeration represents all possible states of the USB device physically attached to the host computer regarding its state on the host computer and availability to guest computers (all currently running virtual machines).

Once a supported USB device is attached to the host, global USB filters (IHost.usb_device_filters() ) are activated. They can either ignore the device, or put it to USBDeviceState_Held state, or do nothing. Unless the device is ignored by global filters, filters of all currently running guests (IUSBDeviceFilters.device_filters() ) are activated that can put it to USBDeviceState_Captured state.

If the device was ignored by global filters, or didn’t match any filters at all (including guest ones), it is handled by the host in a normal way. In this case, the device state is determined by the host and can be one of USBDeviceState_Unavailable, USBDeviceState_Busy or USBDeviceState_Available, depending on the current device usage.

Besides auto-capturing based on filters, the device can be manually captured by guests (IConsole.attach_usb_device() ) if its state is USBDeviceState_Busy, USBDeviceState_Available or USBDeviceState_Held.

Due to differences in USB stack implementations in Linux and Win32, states USBDeviceState_Busy and USBDeviceState_Unavailable are applicable only to the Linux version of the product. This also means that (IConsole.attach_usb_device() ) can only succeed on Win32 if the device state is USBDeviceState_Held.

IHostUSBDevice , IHostUSBDeviceFilter

not_supported(0)

Not supported by the VirtualBox server, not available to guests.

unavailable(1)

Being used by the host computer exclusively, not available to guests.

busy(2)

Being used by the host computer, potentially available to guests.

available(3)

Not used by the host computer, available to guests (the host computer can also start using the device at any time).

held(4)

Held by the VirtualBox server (ignored by the host computer), available to guests.

captured(5)

Captured by one of the guest computers, not available to anybody else.

available = USBDeviceState(3)
busy = USBDeviceState(2)
captured = USBDeviceState(5)
held = USBDeviceState(4)
not_supported = USBDeviceState(0)
unavailable = USBDeviceState(1)
class virtualbox.library.USBDeviceFilterAction(value)[source]

Actions for host USB device filters. IHostUSBDeviceFilter , USBDeviceState

null(0)

Null value (never used by the API).

ignore(1)

Ignore the matched USB device.

hold(2)

Hold the matched USB device.

hold = USBDeviceFilterAction(2)
ignore = USBDeviceFilterAction(1)
null = USBDeviceFilterAction(0)
class virtualbox.library.AudioDriverType(value)[source]

Host audio driver type.

null(0)

Null value, also means “dummy audio driver”.

win_mm(1)

Windows multimedia (Windows hosts only, not supported at the moment).

oss(2)

Open Sound System (Linux / Unix hosts only).

alsa(3)

Advanced Linux Sound Architecture (Linux hosts only).

direct_sound(4)

DirectSound (Windows hosts only).

core_audio(5)

CoreAudio (Mac hosts only).

mmpm(6)

Reserved for historical reasons.

pulse(7)

PulseAudio (Linux hosts only).

sol_audio(8)

Solaris audio (Solaris hosts only, not supported at the moment).

alsa = AudioDriverType(3)
core_audio = AudioDriverType(5)
direct_sound = AudioDriverType(4)
mmpm = AudioDriverType(6)
null = AudioDriverType(0)
oss = AudioDriverType(2)
pulse = AudioDriverType(7)
sol_audio = AudioDriverType(8)
win_mm = AudioDriverType(1)
class virtualbox.library.AudioControllerType(value)[source]

Virtual audio controller type.

ac97(0)
sb16(1)
hda(2)
class virtualbox.library.AudioCodecType(value)[source]

The exact variant of audio codec hardware presented to the guest; see IAudioAdapter.audio_codec() .

null(0)

@c null value. Never used by the API.

sb16(1)

SB16; this is the only option for the SB16 device.

stac9700(2)

A STAC9700 AC‘97 codec.

ad1980(3)

An AD1980 AC‘97 codec. Recommended for Linux guests.

stac9221(4)

A STAC9221 HDA codec.

ad1980 = AudioCodecType(3)
null = AudioCodecType(0)
sb16 = AudioCodecType(1)
stac9221 = AudioCodecType(4)
stac9700 = AudioCodecType(2)
class virtualbox.library.AuthType(value)[source]

VirtualBox authentication type.

null(0)

Null value, also means “no authentication”.

external(1)
guest(2)
null = AuthType(0)
class virtualbox.library.Reason(value)[source]

Internal event reason type.

unspecified(0)

Null value, means “no known reason”.

host_suspend(1)

Host is being suspended (power management event).

host_resume(2)

Host is being resumed (power management event).

host_battery_low(3)

Host is running low on battery (power management event).

snapshot(4)

A snapshot of the VM is being taken.

host_battery_low = Reason(3)
host_resume = Reason(2)
host_suspend = Reason(1)
snapshot = Reason(4)
unspecified = Reason(0)
class virtualbox.library.StorageBus(value)[source]

The bus type of the storage controller (IDE, SATA, SCSI, SAS or Floppy); see IStorageController.bus() .

null(0)

@c null value. Never used by the API.

ide(1)
sata(2)
scsi(3)
floppy(4)
sas(5)
usb(6)
pc_ie(7)
null = StorageBus(0)
class virtualbox.library.StorageControllerType(value)[source]

The exact variant of storage controller hardware presented to the guest; see IStorageController.controller_type() .

null(0)

@c null value. Never used by the API.

lsi_logic(1)

A SCSI controller of the LsiLogic variant.

bus_logic(2)

A SCSI controller of the BusLogic variant.

intel_ahci(3)

An Intel AHCI SATA controller; this is the only variant for SATA.

piix3(4)

An IDE controller of the PIIX3 variant.

piix4(5)

An IDE controller of the PIIX4 variant.

ich6(6)

An IDE controller of the ICH6 variant.

i82078(7)

A floppy disk controller; this is the only variant for floppy drives.

lsi_logic_sas(8)

A variant of the LsiLogic controller using SAS.

usb(9)

Special USB based storage controller.

nv_me(10)

An NVMe storage controller.

bus_logic = StorageControllerType(2)
i82078 = StorageControllerType(7)
ich6 = StorageControllerType(6)
intel_ahci = StorageControllerType(3)
lsi_logic = StorageControllerType(1)
lsi_logic_sas = StorageControllerType(8)
null = StorageControllerType(0)
nv_me = StorageControllerType(10)
piix3 = StorageControllerType(4)
piix4 = StorageControllerType(5)
usb = StorageControllerType(9)
class virtualbox.library.ChipsetType(value)[source]

Type of emulated chipset (mostly southbridge).

null(0)

@c null value. Never used by the API.

piix3(1)

A PIIX3 (PCI IDE ISA Xcelerator) chipset.

ich9(2)

A ICH9 (I/O Controller Hub) chipset.

ich9 = ChipsetType(2)
null = ChipsetType(0)
piix3 = ChipsetType(1)
class virtualbox.library.NATAliasMode(value)[source]
alias_log(1)
alias_proxy_only(2)
alias_use_same_ports(4)
class virtualbox.library.NATProtocol(value)[source]

Protocol definitions used with NAT port-forwarding rules.

udp(0)

Port-forwarding uses UDP protocol.

tcp(1)

Port-forwarding uses TCP protocol.

tcp = NATProtocol(1)
udp = NATProtocol(0)
class virtualbox.library.BandwidthGroupType(value)[source]

Type of a bandwidth control group.

null(0)

Null type, must be first.

disk(1)

The bandwidth group controls disk I/O.

network(2)

The bandwidth group controls network I/O.

disk = BandwidthGroupType(1)
network = BandwidthGroupType(2)
null = BandwidthGroupType(0)
class virtualbox.library.VBoxEventType(value)[source]

Type of an event. See IEvent for an introduction to VirtualBox event handling.

invalid(0)

Invalid event, must be first.

any_p(1)

Wildcard for all events. Events of this type are never delivered, and only used in IEventSource.register_listener() call to simplify registration.

vetoable(2)

Wildcard for all vetoable events. Events of this type are never delivered, and only used in IEventSource.register_listener() call to simplify registration.

machine_event(3)

Wildcard for all machine events. Events of this type are never delivered, and only used in IEventSource.register_listener() call to simplify registration.

snapshot_event(4)

Wildcard for all snapshot events. Events of this type are never delivered, and only used in IEventSource.register_listener() call to simplify registration.

input_event(5)

Wildcard for all input device (keyboard, mouse) events. Events of this type are never delivered, and only used in IEventSource.register_listener() call to simplify registration.

last_wildcard(31)

Last wildcard.

on_machine_state_changed(32)

See IMachineStateChangedEvent IMachineStateChangedEvent.

on_machine_data_changed(33)

See IMachineDataChangedEvent IMachineDataChangedEvent.

on_extra_data_changed(34)

See IExtraDataChangedEvent IExtraDataChangedEvent.

on_extra_data_can_change(35)

See IExtraDataCanChangeEvent IExtraDataCanChangeEvent.

on_medium_registered(36)

See IMediumRegisteredEvent IMediumRegisteredEvent.

on_machine_registered(37)

See IMachineRegisteredEvent IMachineRegisteredEvent.

on_session_state_changed(38)

See ISessionStateChangedEvent ISessionStateChangedEvent.

on_snapshot_taken(39)

See ISnapshotTakenEvent ISnapshotTakenEvent.

on_snapshot_deleted(40)

See ISnapshotDeletedEvent ISnapshotDeletedEvent.

on_snapshot_changed(41)

See ISnapshotChangedEvent ISnapshotChangedEvent.

on_guest_property_changed(42)

See IGuestPropertyChangedEvent IGuestPropertyChangedEvent.

on_mouse_pointer_shape_changed(43)

See IMousePointerShapeChangedEvent IMousePointerShapeChangedEvent.

on_mouse_capability_changed(44)

See IMouseCapabilityChangedEvent IMouseCapabilityChangedEvent.

on_keyboard_leds_changed(45)

See IKeyboardLedsChangedEvent IKeyboardLedsChangedEvent.

on_state_changed(46)

See IStateChangedEvent IStateChangedEvent.

on_additions_state_changed(47)

See IAdditionsStateChangedEvent IAdditionsStateChangedEvent.

on_network_adapter_changed(48)

See INetworkAdapterChangedEvent INetworkAdapterChangedEvent.

on_serial_port_changed(49)

See ISerialPortChangedEvent ISerialPortChangedEvent.

on_parallel_port_changed(50)

See IParallelPortChangedEvent IParallelPortChangedEvent.

on_storage_controller_changed(51)

See IStorageControllerChangedEvent IStorageControllerChangedEvent.

on_medium_changed(52)

See IMediumChangedEvent IMediumChangedEvent.

on_vrde_server_changed(53)

See IVRDEServerChangedEvent IVRDEServerChangedEvent.

on_usb_controller_changed(54)

See IUSBControllerChangedEvent IUSBControllerChangedEvent.

on_usb_device_state_changed(55)

See IUSBDeviceStateChangedEvent IUSBDeviceStateChangedEvent.

on_shared_folder_changed(56)

See ISharedFolderChangedEvent ISharedFolderChangedEvent.

on_runtime_error(57)

See IRuntimeErrorEvent IRuntimeErrorEvent.

on_can_show_window(58)

See ICanShowWindowEvent ICanShowWindowEvent.

on_show_window(59)

See IShowWindowEvent IShowWindowEvent.

on_cpu_changed(60)

See ICPUChangedEvent ICPUChangedEvent.

on_vrde_server_info_changed(61)

See IVRDEServerInfoChangedEvent IVRDEServerInfoChangedEvent.

on_event_source_changed(62)

See IEventSourceChangedEvent IEventSourceChangedEvent.

on_cpu_execution_cap_changed(63)

See ICPUExecutionCapChangedEvent ICPUExecutionCapChangedEvent.

on_guest_keyboard(64)

See IGuestKeyboardEvent IGuestKeyboardEvent.

on_guest_mouse(65)

See IGuestMouseEvent IGuestMouseEvent.

on_nat_redirect(66)

See INATRedirectEvent INATRedirectEvent.

on_host_pci_device_plug(67)

See IHostPCIDevicePlugEvent IHostPCIDevicePlugEvent.

on_v_box_svc_availability_changed(68)

See IVBoxSVCAvailabilityChangedEvent IVBoxSVCAvailablityChangedEvent.

on_bandwidth_group_changed(69)

See IBandwidthGroupChangedEvent IBandwidthGroupChangedEvent.

on_guest_monitor_changed(70)

See IGuestMonitorChangedEvent IGuestMonitorChangedEvent.

on_storage_device_changed(71)

See IStorageDeviceChangedEvent IStorageDeviceChangedEvent.

on_clipboard_mode_changed(72)

See IClipboardModeChangedEvent IClipboardModeChangedEvent.

on_dn_d_mode_changed(73)

See IDnDModeChangedEvent IDnDModeChangedEvent.

on_nat_network_changed(74)

See INATNetworkChangedEvent INATNetworkChangedEvent.

on_nat_network_start_stop(75)

See INATNetworkStartStopEvent INATNetworkStartStopEvent.

on_nat_network_alter(76)

See INATNetworkAlterEvent INATNetworkAlterEvent.

on_nat_network_creation_deletion(77)

See INATNetworkCreationDeletionEvent INATNetworkCreationDeletionEvent.

on_nat_network_setting(78)

See INATNetworkSettingEvent INATNetworkSettingEvent.

on_nat_network_port_forward(79)

See INATNetworkPortForwardEvent INATNetworkPortForwardEvent.

on_guest_session_state_changed(80)

See IGuestSessionStateChangedEvent IGuestSessionStateChangedEvent.

on_guest_session_registered(81)

See IGuestSessionRegisteredEvent IGuestSessionRegisteredEvent.

on_guest_process_registered(82)

See IGuestProcessRegisteredEvent IGuestProcessRegisteredEvent.

on_guest_process_state_changed(83)

See IGuestProcessStateChangedEvent IGuestProcessStateChangedEvent.

on_guest_process_input_notify(84)

See IGuestProcessInputNotifyEvent IGuestProcessInputNotifyEvent.

on_guest_process_output(85)

See IGuestProcessOutputEvent IGuestProcessOutputEvent.

on_guest_file_registered(86)

See IGuestFileRegisteredEvent IGuestFileRegisteredEvent.

on_guest_file_state_changed(87)

See IGuestFileStateChangedEvent IGuestFileStateChangedEvent.

on_guest_file_offset_changed(88)

See IGuestFileOffsetChangedEvent IGuestFileOffsetChangedEvent.

on_guest_file_read(89)

See IGuestFileReadEvent IGuestFileReadEvent.

For performance reasons this is a separate event to not unnecessarily overflow the event queue.

on_guest_file_write(90)

See IGuestFileWriteEvent IGuestFileWriteEvent.

For performance reasons this is a separate event to not unnecessarily overflow the event queue.

on_video_capture_changed(91)

See IVideoCaptureChangedEvent IVideoCapturedChangeEvent.

on_guest_user_state_changed(92)

See IGuestUserStateChangedEvent IGuestUserStateChangedEvent.

on_guest_multi_touch(93)

See IGuestMouseEvent IGuestMouseEvent.

on_host_name_resolution_configuration_change(94)

See IHostNameResolutionConfigurationChangeEvent IHostNameResolutionConfigurationChangeEvent.

on_snapshot_restored(95)

See ISnapshotRestoredEvent ISnapshotRestoredEvent.

on_medium_config_changed(96)

See IMediumConfigChangedEvent IMediumConfigChangedEvent.

last(97)

Must be last event, used for iterations and structures relying on numerical event values.

any_p = VBoxEventType(1)
input_event = VBoxEventType(5)
invalid = VBoxEventType(0)
last = VBoxEventType(97)
last_wildcard = VBoxEventType(31)
machine_event = VBoxEventType(3)
on_additions_state_changed = VBoxEventType(47)
on_bandwidth_group_changed = VBoxEventType(69)
on_can_show_window = VBoxEventType(58)
on_clipboard_mode_changed = VBoxEventType(72)
on_cpu_changed = VBoxEventType(60)
on_cpu_execution_cap_changed = VBoxEventType(63)
on_dn_d_mode_changed = VBoxEventType(73)
on_event_source_changed = VBoxEventType(62)
on_extra_data_can_change = VBoxEventType(35)
on_extra_data_changed = VBoxEventType(34)
on_guest_file_offset_changed = VBoxEventType(88)
on_guest_file_read = VBoxEventType(89)
on_guest_file_registered = VBoxEventType(86)
on_guest_file_state_changed = VBoxEventType(87)
on_guest_file_write = VBoxEventType(90)
on_guest_keyboard = VBoxEventType(64)
on_guest_monitor_changed = VBoxEventType(70)
on_guest_mouse = VBoxEventType(65)
on_guest_multi_touch = VBoxEventType(93)
on_guest_process_input_notify = VBoxEventType(84)
on_guest_process_output = VBoxEventType(85)
on_guest_process_registered = VBoxEventType(82)
on_guest_process_state_changed = VBoxEventType(83)
on_guest_property_changed = VBoxEventType(42)
on_guest_session_registered = VBoxEventType(81)
on_guest_session_state_changed = VBoxEventType(80)
on_guest_user_state_changed = VBoxEventType(92)
on_host_name_resolution_configuration_change = VBoxEventType(94)
on_host_pci_device_plug = VBoxEventType(67)
on_keyboard_leds_changed = VBoxEventType(45)
on_machine_data_changed = VBoxEventType(33)
on_machine_registered = VBoxEventType(37)
on_machine_state_changed = VBoxEventType(32)
on_medium_changed = VBoxEventType(52)
on_medium_config_changed = VBoxEventType(96)
on_medium_registered = VBoxEventType(36)
on_mouse_capability_changed = VBoxEventType(44)
on_mouse_pointer_shape_changed = VBoxEventType(43)
on_nat_network_alter = VBoxEventType(76)
on_nat_network_changed = VBoxEventType(74)
on_nat_network_creation_deletion = VBoxEventType(77)
on_nat_network_port_forward = VBoxEventType(79)
on_nat_network_setting = VBoxEventType(78)
on_nat_network_start_stop = VBoxEventType(75)
on_nat_redirect = VBoxEventType(66)
on_network_adapter_changed = VBoxEventType(48)
on_parallel_port_changed = VBoxEventType(50)
on_runtime_error = VBoxEventType(57)
on_serial_port_changed = VBoxEventType(49)
on_session_state_changed = VBoxEventType(38)
on_shared_folder_changed = VBoxEventType(56)
on_show_window = VBoxEventType(59)
on_snapshot_changed = VBoxEventType(41)
on_snapshot_deleted = VBoxEventType(40)
on_snapshot_restored = VBoxEventType(95)
on_snapshot_taken = VBoxEventType(39)
on_state_changed = VBoxEventType(46)
on_storage_controller_changed = VBoxEventType(51)
on_storage_device_changed = VBoxEventType(71)
on_usb_controller_changed = VBoxEventType(54)
on_usb_device_state_changed = VBoxEventType(55)
on_v_box_svc_availability_changed = VBoxEventType(68)
on_video_capture_changed = VBoxEventType(91)
on_vrde_server_changed = VBoxEventType(53)
on_vrde_server_info_changed = VBoxEventType(61)
snapshot_event = VBoxEventType(4)
vetoable = VBoxEventType(2)
class virtualbox.library.GuestMouseEventMode(value)[source]

The mode (relative, absolute, multi-touch) of a pointer event.

@todo A clear pattern seems to be emerging that we should usually have multiple input devices active for different types of reporting, so we should really have different event types for relative (including wheel), absolute (not including wheel) and multi-touch events.

relative(0)

Relative event.

absolute(1)

Absolute event.

absolute = GuestMouseEventMode(1)
relative = GuestMouseEventMode(0)
class virtualbox.library.GuestMonitorChangedEventType(value)[source]

How the guest monitor has been changed.

enabled(0)

The guest monitor has been enabled by the guest.

disabled(1)

The guest monitor has been disabled by the guest.

new_origin(2)

The guest monitor origin has changed in the guest.

disabled = GuestMonitorChangedEventType(1)
enabled = GuestMonitorChangedEventType(0)
new_origin = GuestMonitorChangedEventType(2)
class virtualbox.library.IVirtualBoxErrorInfo(interface=None)[source]

The IVirtualBoxErrorInfo interface represents extended error information.

Extended error information can be set by VirtualBox components after unsuccessful or partially successful method invocation. This information can be retrieved by the calling party as an IVirtualBoxErrorInfo object and then shown to the client in addition to the plain 32-bit result code.

In MS COM, this interface extends the IErrorInfo interface, in XPCOM, it extends the nsIException interface. In both cases, it provides a set of common attributes to retrieve error information.

Sometimes invocation of some component’s method may involve methods of other components that may also fail (independently of this method’s failure), or a series of non-fatal errors may precede a fatal error that causes method failure. In cases like that, it may be desirable to preserve information about all errors happened during method invocation and deliver it to the caller. The next_p() attribute is intended specifically for this purpose and allows to represent a chain of errors through a single IVirtualBoxErrorInfo object set after method invocation.

errors are stored to a chain in the reverse order, i.e. the initial error object you query right after method invocation is the last error set by the callee, the object it points to in the @a next attribute is the previous error and so on, up to the first error (which is the last in the chain).

result_code

Get int value for ‘resultCode’ Result code of the error. Usually, it will be the same as the result code returned by the method that provided this error information, but not always. For example, on Win32, CoCreateInstance() will most likely return E_NOINTERFACE upon unsuccessful component instantiation attempt, but not the value the component factory returned. Value is typed ‘long’, not ‘result’, to make interface usable from scripting languages.

In MS COM, there is no equivalent. In XPCOM, it is the same as nsIException::result.

result_detail

Get int value for ‘resultDetail’ Optional result data of this error. This will vary depending on the actual error usage. By default this attribute is not being used.

interface_id

Get str value for ‘interfaceID’ UUID of the interface that defined the error.

In MS COM, it is the same as IErrorInfo::GetGUID, except for the data type. In XPCOM, there is no equivalent.

component

Get str value for ‘component’ Name of the component that generated the error.

In MS COM, it is the same as IErrorInfo::GetSource. In XPCOM, there is no equivalent.

text

Get str value for ‘text’ Text description of the error.

In MS COM, it is the same as IErrorInfo::GetDescription. In XPCOM, it is the same as nsIException::message.

next_p

Get IVirtualBoxErrorInfo value for ‘next’ Next error object if there is any, or @c null otherwise.

In MS COM, there is no equivalent. In XPCOM, it is the same as nsIException::inner.

class virtualbox.library.INATNetwork(interface=None)[source]

TBD: the idea, technically we can start any number of the NAT networks, but we should expect that at some point we will get collisions because of port-forwanding rules. so perhaps we should support only single instance of NAT network.

network_name

Get or set str value for ‘networkName’ TBD: the idea, technically we can start any number of the NAT networks, but we should expect that at some point we will get collisions because of port-forwanding rules. so perhaps we should support only single instance of NAT network.

enabled

Get or set bool value for ‘enabled’

network

Get or set str value for ‘network’ This is CIDR IPv4 string. Specifying it user defines IPv4 addresses of gateway (low address + 1) and DHCP server (= low address + 2). Note: If there are defined IPv4 port-forward rules update of network will be ignored (because new assignment could break existing rules).

gateway

Get str value for ‘gateway’ This attribute is read-only. It’s recalculated on changing network attribute (low address of network + 1).

i_pv6_enabled

Get or set bool value for ‘IPv6Enabled’ This attribute define whether gateway will support IPv6 or not.

i_pv6_prefix

Get or set str value for ‘IPv6Prefix’ This a CIDR IPv6 defining prefix for link-local addresses autoconfiguration within network. Note: ignored if attribute IPv6Enabled is false.

advertise_default_i_pv6_route_enabled

Get or set bool value for ‘advertiseDefaultIPv6RouteEnabled’

need_dhcp_server

Get or set bool value for ‘needDhcpServer’

event_source

Get IEventSource value for ‘eventSource’

port_forward_rules4

Get str value for ‘portForwardRules4’ Array of NAT port-forwarding rules in string representation, in the following format: “name:protocolid:[host ip]:host port:[guest ip]:guest port”.

local_mappings

Get str value for ‘localMappings’ Array of mappings (address,offset),e.g. (“127.0.1.1=4”) maps 127.0.1.1 to networkid + 4.

add_local_mapping(hostid, offset)[source]

in hostid of type str

in offset of type int

loopback_ip6

Get or set int value for ‘loopbackIp6’ Offset in ipv6 network from network id for address mapped into loopback6 interface of the host.

port_forward_rules6

Get str value for ‘portForwardRules6’ Array of NAT port-forwarding rules in string representation, in the following format: “name:protocolid:[host ip]:host port:[guest ip]:guest port”.

add_port_forward_rule(is_ipv6, rule_name, proto, host_ip, host_port, guest_ip, guest_port)[source]

Protocol handled with the rule.

in is_ipv6 of type bool

in rule_name of type str

in proto of type NATProtocol
Protocol handled with the rule.
in host_ip of type str
IP of the host interface to which the rule should apply. An empty ip address is acceptable, in which case the NAT engine binds the handling socket to any interface.
in host_port of type int
The port number to listen on.
in guest_ip of type str
The IP address of the guest which the NAT engine will forward matching packets to. An empty IP address is not acceptable.
in guest_port of type int
The port number to forward.
remove_port_forward_rule(i_sipv6, rule_name)[source]

in i_sipv6 of type bool

in rule_name of type str

start(trunk_type)[source]

Type of internal network trunk.

in trunk_type of type str
Type of internal network trunk.
stop()[source]
class virtualbox.library.IDHCPServer(interface=None)[source]

The IDHCPServer interface represents the VirtualBox DHCP server configuration.

To enumerate all the DHCP servers on the host, use the IVirtualBox.dhcp_servers() attribute.

event_source

Get IEventSource value for ‘eventSource’

enabled

Get or set bool value for ‘enabled’ specifies if the DHCP server is enabled

ip_address

Get str value for ‘IPAddress’ specifies server IP

network_mask

Get str value for ‘networkMask’ specifies server network mask

network_name

Get str value for ‘networkName’ specifies internal network name the server is used for

lower_ip

Get str value for ‘lowerIP’ specifies from IP address in server address range

upper_ip

Get str value for ‘upperIP’ specifies to IP address in server address range

add_global_option(option, value)[source]

in option of type DhcpOpt

in value of type str

global_options

Get str value for ‘globalOptions’

vm_configs

Get str value for ‘vmConfigs’

add_vm_slot_option(vmname, slot, option, value)[source]

in vmname of type str

in slot of type int

in option of type DhcpOpt

in value of type str

remove_vm_slot_options(vmname, slot)[source]

in vmname of type str

in slot of type int

get_vm_slot_options(vmname, slot)[source]

in vmname of type str

in slot of type int

return option of type str

get_mac_options(mac)[source]

in mac of type str

return option of type str

set_configuration(ip_address, network_mask, from_ip_address, to_ip_address)[source]

configures the server

in ip_address of type str
server IP address
in network_mask of type str
server network mask
in from_ip_address of type str
server From IP address for address range
in to_ip_address of type str
server To IP address for address range
raises OleErrorInvalidarg
invalid configuration supplied
start(network_name, trunk_name, trunk_type)[source]

Starts DHCP server process.

in network_name of type str
Name of internal network DHCP server should attach to.
in trunk_name of type str
Name of internal network trunk.
in trunk_type of type str
Type of internal network trunk.
raises OleErrorFail
Failed to start the process.
stop()[source]

Stops DHCP server process.

raises OleErrorFail
Failed to stop the process.
class virtualbox.library.IVFSExplorer(interface=None)[source]

The VFSExplorer interface unifies access to different file system types. This includes local file systems as well remote file systems like S3. For a list of supported types see VFSType . An instance of this is returned by IAppliance.create_vfs_explorer() .

path

Get str value for ‘path’ Returns the current path in the virtual file system.

type_p

Get VFSType value for ‘type’ Returns the file system type which is currently in use.

update()[source]

Updates the internal list of files/directories from the current directory level. Use entry_list() to get the full list after a call to this method.

return progress of type IProgress
Progress object to track the operation completion.
cd(dir_p)[source]

Change the current directory level.

in dir_p of type str
The name of the directory to go in.
return progress of type IProgress
Progress object to track the operation completion.
cd_up()[source]

Go one directory upwards from the current directory level.

return progress of type IProgress
Progress object to track the operation completion.
entry_list()[source]

Returns a list of files/directories after a call to update() . The user is responsible for keeping this internal list up do date.

out names of type str
The list of names for the entries.
out types of type int
The list of types for the entries. FsObjType
out sizes of type int
The list of sizes (in bytes) for the entries.
out modes of type int
The list of file modes (in octal form) for the entries.
exists(names)[source]

Checks if the given file list exists in the current directory level.

in names of type str
The names to check.
return exists of type str
The names which exist.
remove(names)[source]

Deletes the given files in the current directory level.

in names of type str
The names to remove.
return progress of type IProgress
Progress object to track the operation completion.
class virtualbox.library.ICertificate(interface=None)[source]

X.509 certificate details.

version_number

Get CertificateVersion value for ‘versionNumber’ Certificate version number.

serial_number

Get str value for ‘serialNumber’ Certificate serial number.

signature_algorithm_oid

Get str value for ‘signatureAlgorithmOID’ The dotted OID of the signature algorithm.

signature_algorithm_name

Get str value for ‘signatureAlgorithmName’ The signature algorithm name if known (if known).

issuer_name

Get str value for ‘issuerName’ Issuer name. Each member of the array is on the format COMPONENT=NAME, e.g. “C=DE”, “ST=Example”, “L=For Instance”, “O=Beispiel GmbH”, “CN=beispiel.example.org”.

subject_name

Get str value for ‘subjectName’ Subject name. Same format as issuerName.

friendly_name

Get str value for ‘friendlyName’ Friendly subject name or similar.

validity_period_not_before

Get str value for ‘validityPeriodNotBefore’ Certificate not valid before ISO time stamp.

validity_period_not_after

Get str value for ‘validityPeriodNotAfter’ Certificate not valid after ISO time stamp.

public_key_algorithm_oid

Get str value for ‘publicKeyAlgorithmOID’ The dotted OID of the public key algorithm.

public_key_algorithm

Get str value for ‘publicKeyAlgorithm’ The public key algorithm name (if known).

subject_public_key

Get str value for ‘subjectPublicKey’ The raw public key bytes.

issuer_unique_identifier

Get str value for ‘issuerUniqueIdentifier’ Unique identifier of the issuer (empty string if not present).

subject_unique_identifier

Get str value for ‘subjectUniqueIdentifier’ Unique identifier of this certificate (empty string if not present).

certificate_authority

Get bool value for ‘certificateAuthority’ Whether this certificate is a certificate authority. Will return E_FAIL if this attribute is not present.

key_usage

Get int value for ‘keyUsage’ Key usage mask. Will return 0 if not present.

extended_key_usage

Get str value for ‘extendedKeyUsage’ Array of dotted extended key usage OIDs. Empty array if not present.

raw_cert_data

Get str value for ‘rawCertData’ The raw certificate bytes.

self_signed

Get bool value for ‘selfSigned’ Set if self signed certificate.

trusted

Get bool value for ‘trusted’ Set if the certificate is trusted (by the parent object).

expired

Get bool value for ‘expired’ Set if the certificate has expired (relevant to the parent object)/

is_currently_expired()[source]

Tests if the certificate has expired at the present time according to the X.509 validity of the certificate.

return result of type bool

query_info(what)[source]

Way to extend the interface.

in what of type int

return result of type str

class virtualbox.library.IInternalMachineControl(interface=None)[source]

Updates the VM state.

This operation will also update the settings file with the correct information about the saved state file and delete this file from disk when appropriate.

update_state(state)[source]

Updates the VM state.

This operation will also update the settings file with the correct information about the saved state file and delete this file from disk when appropriate.

in state of type MachineState

begin_power_up(progress)[source]

Tells VBoxSVC that IConsole.power_up() is under ways and gives it the progress object that should be part of any pending IMachine.launch_vm_process() operations. The progress object may be called back to reflect an early cancelation, so some care have to be taken with respect to any cancelation callbacks. The console object will call IInternalMachineControl.end_power_up() to signal the completion of the progress object.

in progress of type IProgress

end_power_up(result)[source]

Tells VBoxSVC that IConsole.power_up() has completed. This method may query status information from the progress object it received in IInternalMachineControl.begin_power_up() and copy it over to any in-progress IMachine.launch_vm_process() call in order to complete that progress object.

in result of type int

begin_powering_down()[source]

Called by the VM process to inform the server it wants to stop the VM execution and power down.

out progress of type IProgress
Progress object created by VBoxSVC to wait until the VM is powered down.
end_powering_down(result, err_msg)[source]

Called by the VM process to inform the server that powering down previously requested by #beginPoweringDown is either successfully finished or there was a failure.

in result of type int
@c S_OK to indicate success.
in err_msg of type str
@c human readable error message in case of failure.
raises VBoxErrorFileError
Settings file not accessible.
raises VBoxErrorXmlError
Could not parse the settings file.
run_usb_device_filters(device)[source]

Asks the server to run USB devices filters of the associated machine against the given USB device and tell if there is a match.

Intended to be used only for remote USB devices. Local ones don’t require to call this method (this is done implicitly by the Host and USBProxyService).

in device of type IUSBDevice

out matched of type bool

out masked_interfaces of type int

capture_usb_device(id_p, capture_filename)[source]

Requests a capture of the given host USB device. When the request is completed, the VM process will get a IInternalSessionControl.on_usb_device_attach() notification.

in id_p of type str

in capture_filename of type str

detach_usb_device(id_p, done)[source]

Notification that a VM is going to detach (@a done = @c false) or has already detached (@a done = @c true) the given USB device. When the @a done = @c true request is completed, the VM process will get a IInternalSessionControl.on_usb_device_detach() notification.

In the @a done = @c true case, the server must run its own filters and filters of all VMs but this one on the detached device as if it were just attached to the host computer.

in id_p of type str

in done of type bool

auto_capture_usb_devices()[source]

Requests a capture all matching USB devices attached to the host. When the request is completed, the VM process will get a IInternalSessionControl.on_usb_device_attach() notification per every captured device.

detach_all_usb_devices(done)[source]

Notification that a VM that is being powered down. The done parameter indicates whether which stage of the power down we’re at. When @a done = @c false the VM is announcing its intentions, while when @a done = @c true the VM is reporting what it has done.

In the @a done = @c true case, the server must run its own filters and filters of all VMs but this one on all detach devices as if they were just attached to the host computer.

in done of type bool

on_session_end(session)[source]

Triggered by the given session object when the session is about to close normally.

in session of type ISession
Session that is being closed
return progress of type IProgress
Used to wait until the corresponding machine is actually dissociated from the given session on the server. Returned only when this session is a direct one.
finish_online_merge_medium()[source]

Gets called by IInternalSessionControl.online_merge_medium() . All necessary state information is available at the called object.

pull_guest_properties()[source]

Get the list of the guest properties matching a set of patterns along with their values, time stamps and flags and give responsibility for managing properties to the console.

out names of type str
The names of the properties returned.
out values of type str
The values of the properties returned. The array entries match the corresponding entries in the @a name array.
out timestamps of type int
The time stamps of the properties returned. The array entries match the corresponding entries in the @a name array.
out flags of type str
The flags of the properties returned. The array entries match the corresponding entries in the @a name array.
push_guest_property(name, value, timestamp, flags)[source]

Update a single guest property in IMachine.

in name of type str
The name of the property to be updated.
in value of type str
The value of the property.
in timestamp of type int
The timestamp of the property.
in flags of type str
The flags of the property.
lock_media()[source]

Locks all media attached to the machine for writing and parents of attached differencing media (if any) for reading. This operation is atomic so that if it fails no media is actually locked.

This method is intended to be called when the machine is in Starting or Restoring state. The locked media will be automatically unlocked when the machine is powered off or crashed.

unlock_media()[source]

Unlocks all media previously locked using IInternalMachineControl.lock_media() .

This method is intended to be used with teleportation so that it is possible to teleport between processes on the same machine.

eject_medium(attachment)[source]

Tells VBoxSVC that the guest has ejected the medium associated with the medium attachment.

in attachment of type IMediumAttachment
The medium attachment where the eject happened.
return new_attachment of type IMediumAttachment
A new reference to the medium attachment, as the config change can result in the creation of a new instance.
report_vm_statistics(valid_stats, cpu_user, cpu_kernel, cpu_idle, mem_total, mem_free, mem_balloon, mem_shared, mem_cache, paged_total, mem_alloc_total, mem_free_total, mem_balloon_total, mem_shared_total, vm_net_rx, vm_net_tx)[source]

Passes statistics collected by VM (including guest statistics) to VBoxSVC.

in valid_stats of type int
Mask defining which parameters are valid. For example: 0x11 means that cpuIdle and XXX are valid. Other parameters should be ignored.
in cpu_user of type int
Percentage of processor time spent in user mode as seen by the guest.
in cpu_kernel of type int
Percentage of processor time spent in kernel mode as seen by the guest.
in cpu_idle of type int
Percentage of processor time spent idling as seen by the guest.
in mem_total of type int
Total amount of physical guest RAM.
in mem_free of type int
Free amount of physical guest RAM.
in mem_balloon of type int
Amount of ballooned physical guest RAM.
in mem_shared of type int
Amount of shared physical guest RAM.
in mem_cache of type int
Total amount of guest (disk) cache memory.
in paged_total of type int
Total amount of space in the page file.
in mem_alloc_total of type int
Total amount of memory allocated by the hypervisor.
in mem_free_total of type int
Total amount of free memory available in the hypervisor.
in mem_balloon_total of type int
Total amount of memory ballooned by the hypervisor.
in mem_shared_total of type int
Total amount of shared memory in the hypervisor.
in vm_net_rx of type int
Network receive rate for VM.
in vm_net_tx of type int
Network transmit rate for VM.
authenticate_external(auth_params)[source]

Verify credentials using the external auth library.

in auth_params of type str
The auth parameters, credentials, etc.
out result of type str
The authentification result.
class virtualbox.library.IBIOSSettings(interface=None)[source]

The IBIOSSettings interface represents BIOS settings of the virtual machine. This is used only in the IMachine.bios_settings() attribute.

logo_fade_in

Get or set bool value for ‘logoFadeIn’ Fade in flag for BIOS logo animation.

logo_fade_out

Get or set bool value for ‘logoFadeOut’ Fade out flag for BIOS logo animation.

logo_display_time

Get or set int value for ‘logoDisplayTime’ BIOS logo display time in milliseconds (0 = default).

logo_image_path

Get or set str value for ‘logoImagePath’ Local file system path for external BIOS splash image. Empty string means the default image is shown on boot.

boot_menu_mode

Get or set BIOSBootMenuMode value for ‘bootMenuMode’ Mode of the BIOS boot device menu.

acpi_enabled

Get or set bool value for ‘ACPIEnabled’ ACPI support flag.

ioapic_enabled

Get or set bool value for ‘IOAPICEnabled’ I/O-APIC support flag. If set, VirtualBox will provide an I/O-APIC and support IRQs above 15.

apic_mode

Get or set APICMode value for ‘APICMode’ APIC mode to set up by the firmware.

time_offset

Get or set int value for ‘timeOffset’ Offset in milliseconds from the host system time. This allows for guests running with a different system date/time than the host. It is equivalent to setting the system date/time in the BIOS except it is not an absolute value but a relative one. Guest Additions time synchronization honors this offset.

pxe_debug_enabled

Get or set bool value for ‘PXEDebugEnabled’ PXE debug logging flag. If set, VirtualBox will write extensive PXE trace information to the release log.

non_volatile_storage_file

Get str value for ‘nonVolatileStorageFile’ The location of the file storing the non-volatile memory content when the VM is powered off. The file does not always exist.

This feature will be realized after VirtualBox v4.3.0.

class virtualbox.library.IPCIAddress(interface=None)[source]

Address on the PCI bus.

bus

Get or set int value for ‘bus’ Bus number.

device

Get or set int value for ‘device’ Device number.

dev_function

Get or set int value for ‘devFunction’ Device function number.

as_long()[source]

Convert PCI address into long.

return result of type int

from_long(number)[source]

Make PCI address from long.

in number of type int

class virtualbox.library.IPCIDeviceAttachment(interface=None)[source]

Information about PCI attachments.

name

Get str value for ‘name’ Device name.

is_physical_device

Get bool value for ‘isPhysicalDevice’ If this is physical or virtual device.

host_address

Get int value for ‘hostAddress’ Address of device on the host, applicable only to host devices.

guest_address

Get int value for ‘guestAddress’ Address of device in the guest.

class virtualbox.library.IEmulatedUSB(interface=None)[source]

Manages emulated USB devices.

webcam_attach(path, settings)[source]

Attaches the emulated USB webcam to the VM, which will use a host video capture device.

in path of type str
The host path of the capture device to use.
in settings of type str
Optional settings.
webcam_detach(path)[source]

Detaches the emulated USB webcam from the VM

in path of type str
The host path of the capture device to detach.
webcams

Get str value for ‘webcams’ Lists attached virtual webcams.

class virtualbox.library.IVRDEServerInfo(interface=None)[source]

Contains information about the remote desktop (VRDE) server capabilities and status. This is used in the IConsole.vrde_server_info() attribute.

active

Get bool value for ‘active’ Whether the remote desktop connection is active.

port

Get int value for ‘port’ VRDE server port number. If this property is equal to 0, then the VRDE server failed to start, usually because there are no free IP ports to bind to. If this property is equal to -1, then the VRDE server has not yet been started.

number_of_clients

Get int value for ‘numberOfClients’ How many times a client connected.

begin_time

Get int value for ‘beginTime’ When the last connection was established, in milliseconds since 1970-01-01 UTC.

end_time

Get int value for ‘endTime’ When the last connection was terminated or the current time, if connection is still active, in milliseconds since 1970-01-01 UTC.

bytes_sent

Get int value for ‘bytesSent’ How many bytes were sent in last or current, if still active, connection.

bytes_sent_total

Get int value for ‘bytesSentTotal’ How many bytes were sent in all connections.

bytes_received

Get int value for ‘bytesReceived’ How many bytes were received in last or current, if still active, connection.

bytes_received_total

Get int value for ‘bytesReceivedTotal’ How many bytes were received in all connections.

user

Get str value for ‘user’ Login user name supplied by the client.

domain

Get str value for ‘domain’ Login domain name supplied by the client.

client_name

Get str value for ‘clientName’ The client name supplied by the client.

client_ip

Get str value for ‘clientIP’ The IP address of the client.

client_version

Get int value for ‘clientVersion’ The client software version number.

encryption_style

Get int value for ‘encryptionStyle’ Public key exchange method used when connection was established. Values: 0 - RDP4 public key exchange scheme. 1 - X509 certificates were sent to client.

class virtualbox.library.IHostNetworkInterface(interface=None)[source]

Represents one of host’s network interfaces. IP V6 address and network mask are strings of 32 hexadecimal digits grouped by four. Groups are separated by colons. For example, fe80:0000:0000:0000:021e:c2ff:fed2:b030.

name

Get str value for ‘name’ Returns the host network interface name.

short_name

Get str value for ‘shortName’ Returns the host network interface short name.

id_p

Get str value for ‘id’ Returns the interface UUID.

network_name

Get str value for ‘networkName’ Returns the name of a virtual network the interface gets attached to.

dhcp_enabled

Get bool value for ‘DHCPEnabled’ Specifies whether the DHCP is enabled for the interface.

ip_address

Get str value for ‘IPAddress’ Returns the IP V4 address of the interface.

network_mask

Get str value for ‘networkMask’ Returns the network mask of the interface.

ipv6_supported

Get bool value for ‘IPV6Supported’ Specifies whether the IP V6 is supported/enabled for the interface.

ipv6_address

Get str value for ‘IPV6Address’ Returns the IP V6 address of the interface.

ipv6_network_mask_prefix_length

Get int value for ‘IPV6NetworkMaskPrefixLength’ Returns the length IP V6 network mask prefix of the interface.

hardware_address

Get str value for ‘hardwareAddress’ Returns the hardware address. For Ethernet it is MAC address.

medium_type

Get HostNetworkInterfaceMediumType value for ‘mediumType’ Type of protocol encapsulation used.

status

Get HostNetworkInterfaceStatus value for ‘status’ Status of the interface.

interface_type

Get HostNetworkInterfaceType value for ‘interfaceType’ specifies the host interface type.

enable_static_ip_config(ip_address, network_mask)[source]

sets and enables the static IP V4 configuration for the given interface.

in ip_address of type str
IP address.
in network_mask of type str
network mask.
enable_static_ip_config_v6(ipv6_address, ipv6_network_mask_prefix_length)[source]

sets and enables the static IP V6 configuration for the given interface.

in ipv6_address of type str
IP address.
in ipv6_network_mask_prefix_length of type int
network mask.
enable_dynamic_ip_config()[source]

enables the dynamic IP configuration.

dhcp_rediscover()[source]

refreshes the IP configuration for DHCP-enabled interface.

class virtualbox.library.IHostVideoInputDevice(interface=None)[source]

Represents one of host’s video capture devices, for example a webcam.

name

Get str value for ‘name’ User friendly name.

path

Get str value for ‘path’ The host path of the device.

alias

Get str value for ‘alias’ An alias which can be used for IConsole::webcamAttach

class virtualbox.library.ISystemProperties(interface=None)[source]

The ISystemProperties interface represents global properties of the given VirtualBox installation.

These properties define limits and default values for various attributes and parameters. Most of the properties are read-only, but some can be changed by a user.

min_guest_ram

Get int value for ‘minGuestRAM’ Minimum guest system memory in Megabytes.

max_guest_ram

Get int value for ‘maxGuestRAM’ Maximum guest system memory in Megabytes.

min_guest_vram

Get int value for ‘minGuestVRAM’ Minimum guest video memory in Megabytes.

max_guest_vram

Get int value for ‘maxGuestVRAM’ Maximum guest video memory in Megabytes.

min_guest_cpu_count

Get int value for ‘minGuestCPUCount’ Minimum CPU count.

max_guest_cpu_count

Get int value for ‘maxGuestCPUCount’ Maximum CPU count.

max_guest_monitors

Get int value for ‘maxGuestMonitors’ Maximum of monitors which could be connected.

info_vd_size

Get int value for ‘infoVDSize’ Maximum size of a virtual disk image in bytes. Informational value, does not reflect the limits of any virtual disk image format.

serial_port_count

Get int value for ‘serialPortCount’ Maximum number of serial ports associated with every IMachine instance.

parallel_port_count

Get int value for ‘parallelPortCount’ Maximum number of parallel ports associated with every IMachine instance.

max_boot_position

Get int value for ‘maxBootPosition’ Maximum device position in the boot order. This value corresponds to the total number of devices a machine can boot from, to make it possible to include all possible devices to the boot list. IMachine.set_boot_order()

raw_mode_supported

Get bool value for ‘rawModeSupported’ Indicates whether VirtualBox was built with raw-mode support.

When this reads as False, the HWVirtExPropertyType.enabled setting will be ignored and assumed to be True.

exclusive_hw_virt

Get or set bool value for ‘exclusiveHwVirt’ Exclusive use of hardware virtualization by VirtualBox. When enabled, VirtualBox assumes it can obtain full and exclusive access to the VT-x or AMD-V feature of the host. To share hardware virtualization with other hypervisors, this property must be disabled.

This is ignored on OS X, the kernel mediates hardware access there.

default_machine_folder

Get or set str value for ‘defaultMachineFolder’ Full path to the default directory used to create new or open existing machines when a machine settings file name contains no path.

Starting with VirtualBox 4.0, by default, this attribute contains the full path of folder named “VirtualBox VMs” in the user’s home directory, which depends on the host platform.

When setting this attribute, a full path must be specified. Setting this property to @c null or an empty string or the special value “Machines” (for compatibility reasons) will restore that default value.

If the folder specified herein does not exist, it will be created automatically as needed.

IVirtualBox.create_machine() , IVirtualBox.open_machine()

logging_level

Get or set str value for ‘loggingLevel’ Specifies the logging level in current use by VirtualBox.

medium_formats

Get IMediumFormat value for ‘mediumFormats’ List of all medium storage formats supported by this VirtualBox installation.

Keep in mind that the medium format identifier (IMediumFormat.id_p() ) used in other API calls like IVirtualBox.create_medium() to refer to a particular medium format is a case-insensitive string. This means that, for example, all of the following strings:

"VDI"
"vdi"
"VdI"

refer to the same medium format.

Note that the virtual medium framework is backend-based, therefore the list of supported formats depends on what backends are currently installed.

IMediumFormat

default_hard_disk_format

Get or set str value for ‘defaultHardDiskFormat’ Identifier of the default medium format used by VirtualBox.

The medium format set by this attribute is used by VirtualBox when the medium format was not specified explicitly. One example is IVirtualBox.create_medium() with the empty format argument. A more complex example is implicit creation of differencing media when taking a snapshot of a virtual machine: this operation will try to use a format of the parent medium first and if this format does not support differencing media the default format specified by this argument will be used.

The list of supported medium formats may be obtained by the medium_formats() call. Note that the default medium format must have a capability to create differencing media; otherwise operations that create media implicitly may fail unexpectedly.

The initial value of this property is “VDI” in the current version of the VirtualBox product, but may change in the future.

Setting this property to @c null or empty string will restore the initial value.

medium_formats() , IMediumFormat.id_p() , IVirtualBox.create_medium()

free_disk_space_warning

Get or set int value for ‘freeDiskSpaceWarning’ Issue a warning if the free disk space is below (or in some disk intensive operation is expected to go below) the given size in bytes.

free_disk_space_percent_warning

Get or set int value for ‘freeDiskSpacePercentWarning’ Issue a warning if the free disk space is below (or in some disk intensive operation is expected to go below) the given percentage.

free_disk_space_error

Get or set int value for ‘freeDiskSpaceError’ Issue an error if the free disk space is below (or in some disk intensive operation is expected to go below) the given size in bytes.

free_disk_space_percent_error

Get or set int value for ‘freeDiskSpacePercentError’ Issue an error if the free disk space is below (or in some disk intensive operation is expected to go below) the given percentage.

vrde_auth_library

Get or set str value for ‘VRDEAuthLibrary’ Library that provides authentication for Remote Desktop clients. The library is used if a virtual machine’s authentication type is set to “external” in the VM RemoteDisplay configuration.

The system library extension (“.DLL” or “.so”) must be omitted. A full path can be specified; if not, then the library must reside on the system’s default library path.

The default value of this property is “VBoxAuth”. There is a library of that name in one of the default VirtualBox library directories.

For details about VirtualBox authentication libraries and how to implement them, please refer to the VirtualBox manual.

Setting this property to @c null or empty string will restore the initial value.

web_service_auth_library

Get or set str value for ‘webServiceAuthLibrary’ Library that provides authentication for webservice clients. The library is used if a virtual machine’s authentication type is set to “external” in the VM RemoteDisplay configuration and will be called from within the IWebsessionManager.logon() implementation.

As opposed to ISystemProperties.vrde_auth_library() , there is no per-VM setting for this, as the webservice is a global resource (if it is running). Only for this setting (for the webservice), setting this value to a literal “null” string disables authentication, meaning that IWebsessionManager.logon() will always succeed, no matter what user name and password are supplied.

The initial value of this property is “VBoxAuth”, meaning that the webservice will use the same authentication library that is used by default for VRDE (again, see ISystemProperties.vrde_auth_library() ). The format and calling convention of authentication libraries is the same for the webservice as it is for VRDE.

Setting this property to @c null or empty string will restore the initial value.

default_vrde_ext_pack

Get or set str value for ‘defaultVRDEExtPack’ The name of the extension pack providing the default VRDE.

This attribute is for choosing between multiple extension packs providing VRDE. If only one is installed, it will automatically be the default one. The attribute value can be empty if no VRDE extension pack is installed.

For details about VirtualBox Remote Desktop Extension and how to implement one, please refer to the VirtualBox SDK.

log_history_count

Get or set int value for ‘logHistoryCount’ This value specifies how many old release log files are kept.

default_audio_driver

Get AudioDriverType value for ‘defaultAudioDriver’ This value hold the default audio driver for the current system.

autostart_database_path

Get or set str value for ‘autostartDatabasePath’ The path to the autostart database. Depending on the host this might be a filesystem path or something else.

default_additions_iso

Get or set str value for ‘defaultAdditionsISO’ The path to the default Guest Additions ISO image. Can be empty if the location is not known in this installation.

default_frontend

Get or set str value for ‘defaultFrontend’ Selects which VM frontend should be used by default when launching a VM through the IMachine.launch_vm_process() method. Empty or @c null strings do not define a particular default, it is up to IMachine.launch_vm_process() to select one. See the description of IMachine.launch_vm_process() for the valid frontend types.

This global setting is overridden by the per-VM attribute IMachine.default_frontend() or a frontend type passed to IMachine.launch_vm_process() .

screen_shot_formats

Get BitmapFormat value for ‘screenShotFormats’ Supported bitmap formats which can be used with takeScreenShot and takeScreenShotToArray methods.

get_max_network_adapters(chipset)[source]

Maximum total number of network adapters associated with every IMachine instance.

in chipset of type ChipsetType
The chipset type to get the value for.
return max_network_adapters of type int
The maximum total number of network adapters allowed.
get_max_network_adapters_of_type(chipset, type_p)[source]

Maximum number of network adapters of a given attachment type, associated with every IMachine instance.

in chipset of type ChipsetType
The chipset type to get the value for.
in type_p of type NetworkAttachmentType
Type of attachment.
return max_network_adapters of type int
The maximum number of network adapters allowed for particular chipset and attachment type.
get_max_devices_per_port_for_storage_bus(bus)[source]

Returns the maximum number of devices which can be attached to a port for the given storage bus.

in bus of type StorageBus
The storage bus type to get the value for.
return max_devices_per_port of type int
The maximum number of devices which can be attached to the port for the given storage bus.
get_min_port_count_for_storage_bus(bus)[source]

Returns the minimum number of ports the given storage bus supports.

in bus of type StorageBus
The storage bus type to get the value for.
return min_port_count of type int
The minimum number of ports for the given storage bus.
get_max_port_count_for_storage_bus(bus)[source]

Returns the maximum number of ports the given storage bus supports.

in bus of type StorageBus
The storage bus type to get the value for.
return max_port_count of type int
The maximum number of ports for the given storage bus.
get_max_instances_of_storage_bus(chipset, bus)[source]

Returns the maximum number of storage bus instances which can be configured for each VM. This corresponds to the number of storage controllers one can have. Value may depend on chipset type used.

in chipset of type ChipsetType
The chipset type to get the value for.
in bus of type StorageBus
The storage bus type to get the value for.
return max_instances of type int
The maximum number of instances for the given storage bus.
get_device_types_for_storage_bus(bus)[source]

Returns list of all the supported device types (DeviceType ) for the given type of storage bus.

in bus of type StorageBus
The storage bus type to get the value for.
return device_types of type DeviceType
The list of all supported device types for the given storage bus.
get_default_io_cache_setting_for_storage_controller(controller_type)[source]

Returns the default I/O cache setting for the given storage controller

in controller_type of type StorageControllerType
The storage controller type to get the setting for.
return enabled of type bool
Returned flag indicating the default value
get_storage_controller_hotplug_capable(controller_type)[source]

Returns whether the given storage controller supports hot-plugging devices.

in controller_type of type StorageControllerType
The storage controller to check the setting for.
return hotplug_capable of type bool
Returned flag indicating whether the controller is hotplug capable
get_max_instances_of_usb_controller_type(chipset, type_p)[source]

Returns the maximum number of USB controller instances which can be configured for each VM. This corresponds to the number of USB controllers one can have. Value may depend on chipset type used.

in chipset of type ChipsetType
The chipset type to get the value for.
in type_p of type USBControllerType
The USB controller type to get the value for.
return max_instances of type int
The maximum number of instances for the given USB controller type.
class virtualbox.library.IAdditionsFacility(interface=None)[source]

Structure representing a Guest Additions facility.

class_type

Get AdditionsFacilityClass value for ‘classType’ The class this facility is part of.

last_updated

Get int value for ‘lastUpdated’ Time stamp of the last status update, in milliseconds since 1970-01-01 UTC.

name

Get str value for ‘name’ The facility’s friendly name.

status

Get AdditionsFacilityStatus value for ‘status’ The current status.

type_p

Get AdditionsFacilityType value for ‘type’ The facility’s type ID.

class virtualbox.library.IDnDBase(interface=None)[source]

Base abstract interface for drag’n drop.

formats

Get str value for ‘formats’ Returns all supported drag’n drop formats.

protocol_version

Get int value for ‘protocolVersion’ Returns the protocol version which is used to communicate with the guest.

is_format_supported(format_p)[source]

Checks if a specific drag’n drop MIME / Content-type format is supported.

in format_p of type str
Format to check for.
return supported of type bool
Returns @c true if the specified format is supported, @c false if not.
add_formats(formats)[source]

Adds MIME / Content-type formats to the supported formats.

in formats of type str
Collection of formats to add.
remove_formats(formats)[source]

Removes MIME / Content-type formats from the supported formats.

in formats of type str
Collection of formats to remove.
class virtualbox.library.IDnDSource(interface=None)[source]

Abstract interface for handling drag’n drop sources.

drag_is_pending(screen_id)[source]

Ask the source if there is any drag and drop operation pending. If no drag and drop operation is pending currently, DnDAction_Ignore is returned.

in screen_id of type int
The screen ID where the drag and drop event occurred.
out formats of type str
On return the supported mime types.
out allowed_actions of type DnDAction
On return the actions which are allowed.
return default_action of type DnDAction
On return the default action to use.
raises VBoxErrorVmError
VMM device is not available.
drop(format_p, action)[source]

Informs the source that a drop event occurred for a pending drag and drop operation.

in format_p of type str
The mime type the data must be in.
in action of type DnDAction
The action to use.
return progress of type IProgress
Progress object to track the operation completion.
raises VBoxErrorVmError
VMM device is not available.
receive_data()[source]

Receive the data of a previously drag and drop event from the source.

return data of type str
The actual data.
raises VBoxErrorVmError
VMM device is not available.
class virtualbox.library.IGuestDnDSource(interface=None)[source]

Implementation of the IDnDSource object for source drag’n drop operations on the guest.

midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.IDnDTarget(interface=None)[source]

Abstract interface for handling drag’n drop targets.

enter(screen_id, y, x, default_action, allowed_actions, formats)[source]

Informs the target about a drag and drop enter event.

in screen_id of type int
The screen ID where the drag and drop event occurred.
in y of type int
Y-position of the event.
in x of type int
X-position of the event.
in default_action of type DnDAction
The default action to use.
in allowed_actions of type DnDAction
The actions which are allowed.
in formats of type str
The supported MIME types.
return result_action of type DnDAction
The resulting action of this event.
raises VBoxErrorVmError
VMM device is not available.
move(screen_id, x, y, default_action, allowed_actions, formats)[source]

Informs the target about a drag and drop move event.

in screen_id of type int
The screen ID where the drag and drop event occurred.
in x of type int
X-position of the event.
in y of type int
Y-position of the event.
in default_action of type DnDAction
The default action to use.
in allowed_actions of type DnDAction
The actions which are allowed.
in formats of type str
The supported MIME types.
return result_action of type DnDAction
The resulting action of this event.
raises VBoxErrorVmError
VMM device is not available.
leave(screen_id)[source]

Informs the target about a drag and drop leave event.

in screen_id of type int
The screen ID where the drag and drop event occurred.
raises VBoxErrorVmError
VMM device is not available.
drop(screen_id, x, y, default_action, allowed_actions, formats)[source]

Informs the target about a drop event.

in screen_id of type int
The screen ID where the Drag and Drop event occurred.
in x of type int
X-position of the event.
in y of type int
Y-position of the event.
in default_action of type DnDAction
The default action to use.
in allowed_actions of type DnDAction
The actions which are allowed.
in formats of type str
The supported MIME types.
out format_p of type str
The resulting format of this event.
return result_action of type DnDAction
The resulting action of this event.
raises VBoxErrorVmError
VMM device is not available.
send_data(screen_id, format_p, data)[source]

Initiates sending data to the target.

in screen_id of type int
The screen ID where the drag and drop event occurred.
in format_p of type str
The MIME type the data is in.
in data of type str
The actual data.
return progress of type IProgress
Progress object to track the operation completion.
raises VBoxErrorVmError
VMM device is not available.
cancel()[source]

Requests cancelling the current operation. The target can veto the request in case the operation is not cancelable at the moment.

return veto of type bool
Whether the target has vetoed cancelling the operation.
raises VBoxErrorVmError
VMM device is not available.
class virtualbox.library.IGuestDnDTarget(interface=None)[source]

Implementation of the IDnDTarget object for target drag’n drop operations on the guest.

midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.IDirectory(interface=None)[source]

Abstract parent interface for directories handled by VirtualBox.

directory_name

Get str value for ‘directoryName’ The path specified when opening the directory.

filter_p

Get str value for ‘filter’ Directory listing filter to (specified when opening the directory).

close()[source]

Closes this directory. After closing operations like reading the next directory entry will not be possible anymore.

read()[source]

Reads the next directory entry of this directory.

return obj_info of type IFsObjInfo
Object information of the current directory entry read. Also see IFsObjInfo .
raises VBoxErrorObjectNotFound
No more directory entries to read.
class virtualbox.library.IGuestDirectory(interface=None)[source]

Implementation of the IDirectory object for directories in the guest.

midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.IFile(interface=None)[source]

Abstract parent interface for files handled by VirtualBox.

event_source

Get IEventSource value for ‘eventSource’ Event source for file events.

id_p

Get int value for ‘id’ The ID VirtualBox internally assigned to the open file.

initial_size

Get int value for ‘initialSize’ The initial size in bytes when opened.

offset

Get int value for ‘offset’ The current file position.

The file current position always applies to the IFile.read() method, which updates it upon return. Same goes for the IFile.write() method except when IFile.access_mode() is FileAccessMode.append_only or FileAccessMode.append_read , where it will always write to the end of the file and will leave this attribute unchanged.

The IFile.seek() is used to change this attribute without transfering any file data like read and write does.

status

Get FileStatus value for ‘status’ Current file status.

file_name

Get str value for ‘fileName’ Full path of the actual file name of this file. <!– r=bird: The ‘actual’ file name is too tough, we cannot guarentee that on unix guests. Seeing how IGuestDirectory did things, I’m questioning the ‘Full path’ part too. Not urgent to check. –>

creation_mode

Get int value for ‘creationMode’ The UNIX-style creation mode specified when opening the file.

open_action

Get FileOpenAction value for ‘openAction’ The opening action specified when opening the file.

access_mode

Get FileAccessMode value for ‘accessMode’ The file access mode.

close()[source]

Closes this file. After closing operations like reading data, writing data or querying information will not be possible anymore.

query_info()[source]

Queries information about this file.

return obj_info of type IFsObjInfo
Object information of this file. Also see IFsObjInfo .
raises OleErrorNotimpl
The method is not implemented yet.
query_size()[source]

Queries the current file size.

return size of type int
Queried file size.
raises OleErrorNotimpl
The method is not implemented yet.
read(to_read, timeout_ms)[source]

Reads data from this file.

in to_read of type int
Number of bytes to read.
in timeout_ms of type int
Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
return data of type str
Array of data read.
raises OleErrorNotimpl
The method is not implemented yet.
read_at(offset, to_read, timeout_ms)[source]

Reads data from an offset of this file.

in offset of type int
Offset in bytes to start reading.
in to_read of type int
Number of bytes to read.
in timeout_ms of type int
Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
return data of type str
Array of data read.
raises OleErrorNotimpl
The method is not implemented yet.
seek(offset, whence)[source]

Changes the current file position of this file.

The file current position always applies to the IFile.read() method. Same for the IFile.write() method it except when the IFile.access_mode() is FileAccessMode.append_only or FileAccessMode.append_read .

in offset of type int
Offset to seek relative to the position specified by @a whence.
in whence of type FileSeekOrigin
One of the FileSeekOrigin seek starting points.
return new_offset of type int
The new file offset after the seek operation.
set_acl(acl, mode)[source]

Sets the ACL of this file.

in acl of type str
The ACL specification string. To-be-defined.
in mode of type int
UNIX-style mode mask to use if @a acl is empty. As mention in IGuestSession.directory_create() this is realized on a best effort basis and the exact behavior depends on the Guest OS.
raises OleErrorNotimpl
The method is not implemented yet.
set_size(size)[source]

Changes the file size.

in size of type int
The new file size.
raises OleErrorNotimpl
The method is not implemented yet.
write(data, timeout_ms)[source]

Writes bytes to this file.

in data of type str
Array of bytes to write. The size of the array also specifies how much to write.
in timeout_ms of type int
Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
return written of type int
How much bytes were written.
write_at(offset, data, timeout_ms)[source]

Writes bytes at a certain offset to this file.

in offset of type int
Offset in bytes to start writing.
in data of type str
Array of bytes to write. The size of the array also specifies how much to write.
in timeout_ms of type int
Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
return written of type int
How much bytes were written.
raises OleErrorNotimpl
The method is not implemented yet.
class virtualbox.library.IGuestFile(interface=None)[source]

Implementation of the IFile object for files in the guest.

midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.IFsObjInfo(interface=None)[source]

Abstract parent interface for VirtualBox file system object information. This can be information about a file or a directory, for example.

access_time

Get int value for ‘accessTime’ Time of last access (st_atime).

allocated_size

Get int value for ‘allocatedSize’ Disk allocation size (st_blocks * DEV_BSIZE).

birth_time

Get int value for ‘birthTime’ Time of file birth (st_birthtime).

change_time

Get int value for ‘changeTime’ Time of last status change (st_ctime).

device_number

Get int value for ‘deviceNumber’ The device number of a character or block device type object (st_rdev).

file_attributes

Get str value for ‘fileAttributes’ File attributes. Not implemented yet.

generation_id

Get int value for ‘generationId’ The current generation number (st_gen).

gid

Get int value for ‘GID’ The group the filesystem object is assigned (st_gid).

group_name

Get str value for ‘groupName’ The group name.

Get int value for ‘hardLinks’ Number of hard links to this filesystem object (st_nlink).

modification_time

Get int value for ‘modificationTime’ Time of last data modification (st_mtime).

name

Get str value for ‘name’ The object’s name.

node_id

Get int value for ‘nodeId’ The unique identifier (within the filesystem) of this filesystem object (st_ino).

node_id_device

Get int value for ‘nodeIdDevice’ The device number of the device which this filesystem object resides on (st_dev).

object_size

Get int value for ‘objectSize’ The logical size (st_size). For normal files this is the size of the file. For symbolic links, this is the length of the path name contained in the symbolic link. For other objects this fields needs to be specified.

type_p

Get FsObjType value for ‘type’ The object type. See FsObjType for more.

uid

Get int value for ‘UID’ The user owning the filesystem object (st_uid).

user_flags

Get int value for ‘userFlags’ User flags (st_flags).

user_name

Get str value for ‘userName’ The user name.

class virtualbox.library.IGuestFsObjInfo(interface=None)[source]

Represents the guest implementation of the IFsObjInfo object.

midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.ISnapshot(interface=None)[source]

The ISnapshot interface represents a snapshot of the virtual machine.

Together with the differencing media that are created when a snapshot is taken, a machine can be brought back to the exact state it was in when the snapshot was taken.

The ISnapshot interface has no methods, only attributes; snapshots are controlled through methods of the IMachine interface which also manage the media associated with the snapshot. The following operations exist:

IMachine.take_snapshot() creates a new snapshot by creating new, empty differencing images for the machine’s media and saving the VM settings and (if the VM is running) the current VM state in the snapshot.

The differencing images will then receive all data written to the machine’s media, while their parent (base) images remain unmodified after the snapshot has been taken (see IMedium for details about differencing images). This simplifies restoring a machine to the state of a snapshot: only the differencing images need to be deleted.

The current machine state is not changed by taking a snapshot except that IMachine.current_snapshot() is set to the newly created snapshot, which is also added to the machine’s snapshots tree.

IMachine.restore_snapshot() resets a machine to the state of a previous snapshot by deleting the differencing image of each of the machine’s media and setting the machine’s settings and state to the state that was saved in the snapshot (if any).

This destroys the machine’s current state. After calling this, IMachine.current_snapshot() points to the snapshot that was restored.

IMachine.delete_snapshot() deletes a snapshot without affecting the current machine state.

This does not change the current machine state, but instead frees the resources allocated when the snapshot was taken: the settings and machine state file are deleted (if any), and the snapshot’s differencing image for each of the machine’s media gets merged with its parent image.

Neither the current machine state nor other snapshots are affected by this operation, except that parent media will be modified to contain the disk data associated with the snapshot being deleted.

When deleting the current snapshot, the IMachine.current_snapshot() attribute is set to the current snapshot’s parent or @c null if it has no parent. Otherwise the attribute is unchanged.

Each snapshot contains a copy of virtual machine’s settings (hardware configuration etc.). This copy is contained in an immutable (read-only) instance of IMachine which is available from the snapshot’s machine() attribute. When restoring the snapshot, these settings are copied back to the original machine.

In addition, if the machine was running when the snapshot was taken (IMachine.state() is MachineState.running ), the current VM state is saved in the snapshot (similarly to what happens when a VM’s state is saved). The snapshot is then said to be online because when restoring it, the VM will be running.

If the machine was in MachineState.saved saved saved, the snapshot receives a copy of the execution state file (IMachine.state_file_path() ).

Otherwise, if the machine was not running (MachineState.powered_off or MachineState.aborted ), the snapshot is offline; it then contains a so-called “zero execution state”, representing a machine that is powered off.

id_p

Get str value for ‘id’ UUID of the snapshot.

name

Get or set str value for ‘name’ Short name of the snapshot. Setting this attribute causes IMachine.save_settings() to be called implicitly.

description

Get or set str value for ‘description’ Optional description of the snapshot. Setting this attribute causes IMachine.save_settings() to be called implicitly.

time_stamp

Get int value for ‘timeStamp’ Time stamp of the snapshot, in milliseconds since 1970-01-01 UTC.

online

Get bool value for ‘online’ @c true if this snapshot is an online snapshot and @c false otherwise.

When this attribute is @c true, the IMachine.state_file_path() attribute of the machine() object associated with this snapshot will point to the saved state file. Otherwise, it will be an empty string.

machine

Get IMachine value for ‘machine’ Virtual machine this snapshot is taken on. This object stores all settings the machine had when taking this snapshot.

The returned machine object is immutable, i.e. no any settings can be changed.

parent

Get ISnapshot value for ‘parent’ Parent snapshot (a snapshot this one is based on), or @c null if the snapshot has no parent (i.e. is the first snapshot).

children

Get ISnapshot value for ‘children’ Child snapshots (all snapshots having this one as a parent). By inspecting this attribute starting with a machine’s root snapshot (which can be obtained by calling IMachine.find_snapshot() with a @c null UUID), a machine’s snapshots tree can be iterated over.

get_children_count()[source]

Returns the number of direct children of this snapshot.

return children_count of type int

class virtualbox.library.IMediumAttachment(interface=None)[source]

The IMediumAttachment interface links storage media to virtual machines. For each medium (IMedium ) which has been attached to a storage controller (IStorageController ) of a machine (IMachine ) via the IMachine.attach_device() method, one instance of IMediumAttachment is added to the machine’s IMachine.medium_attachments() array attribute.

Each medium attachment specifies the storage controller as well as a port and device number and the IMedium instance representing a virtual hard disk or floppy or DVD image.

For removable media (DVDs or floppies), there are two additional options. For one, the IMedium instance can be @c null to represent an empty drive with no media inserted (see IMachine.mount_medium() ); secondly, the medium can be one of the pseudo-media for host drives listed in IHost.dvd_drives() or IHost.floppy_drives() .

Attaching Hard Disks

Hard disks are attached to virtual machines using the IMachine.attach_device() method and detached using the IMachine.detach_device() method. Depending on a medium’s type (see IMedium.type_p() ), hard disks are attached either directly or indirectly.

When a hard disk is being attached directly, it is associated with the virtual machine and used for hard disk operations when the machine is running. When a hard disk is being attached indirectly, a new differencing hard disk linked to it is implicitly created and this differencing hard disk is associated with the machine and used for hard disk operations. This also means that if IMachine.attach_device() performs a direct attachment then the same hard disk will be returned in response to the subsequent IMachine.get_medium() call; however if an indirect attachment is performed then IMachine.get_medium() will return the implicitly created differencing hard disk, not the original one passed to IMachine.attach_device() . In detail:

Normal base hard disks that do not have children (i.e. differencing hard disks linked to them) and that are not already attached to virtual machines in snapshots are attached directly. Otherwise, they are attached indirectly because having dependent children or being part of the snapshot makes it impossible to modify hard disk contents without breaking the integrity of the dependent party. The IMedium.read_only() attribute allows to quickly determine the kind of the attachment for the given hard disk. Note that if a normal base hard disk is to be indirectly attached to a virtual machine with snapshots then a special procedure called smart attachment is performed (see below). Normal differencing hard disks are like normal base hard disks: they are attached directly if they do not have children and are not attached to virtual machines in snapshots, and indirectly otherwise. Note that the smart attachment procedure is never performed for differencing hard disks. Immutable hard disks are always attached indirectly because they are designed to be non-writable. If an immutable hard disk is attached to a virtual machine with snapshots then a special procedure called smart attachment is performed (see below). Writethrough hard disks are always attached directly, also as designed. This also means that writethrough hard disks cannot have other hard disks linked to them at all. Shareable hard disks are always attached directly, also as designed. This also means that shareable hard disks cannot have other hard disks linked to them at all. They behave almost like writethrough hard disks, except that shareable hard disks can be attached to several virtual machines which are running, allowing concurrent accesses. You need special cluster software running in the virtual machines to make use of such disks.

Note that the same hard disk, regardless of its type, may be attached to more than one virtual machine at a time. In this case, the machine that is started first gains exclusive access to the hard disk and attempts to start other machines having this hard disk attached will fail until the first machine is powered down.

Detaching hard disks is performed in a deferred fashion. This means that the given hard disk remains associated with the given machine after a successful IMachine.detach_device() call until IMachine.save_settings() is called to save all changes to machine settings to disk. This deferring is necessary to guarantee that the hard disk configuration may be restored at any time by a call to IMachine.discard_settings() before the settings are saved (committed).

Note that if IMachine.discard_settings() is called after indirectly attaching some hard disks to the machine but before a call to IMachine.save_settings() is made, it will implicitly delete all differencing hard disks implicitly created by IMachine.attach_device() for these indirect attachments. Such implicitly created hard disks will also be immediately deleted when detached explicitly using the IMachine.detach_device() call if it is made before IMachine.save_settings() . This implicit deletion is safe because newly created differencing hard disks do not contain any user data.

However, keep in mind that detaching differencing hard disks that were implicitly created by IMachine.attach_device() before the last IMachine.save_settings() call will not implicitly delete them as they may already contain some data (for example, as a result of virtual machine execution). If these hard disks are no more necessary, the caller can always delete them explicitly using IMedium.delete_storage() after they are actually de-associated from this machine by the IMachine.save_settings() call.

Smart Attachment

When normal base or immutable hard disks are indirectly attached to a virtual machine then some additional steps are performed to make sure the virtual machine will have the most recent “view” of the hard disk being attached. These steps include walking through the machine’s snapshots starting from the current one and going through ancestors up to the first snapshot. Hard disks attached to the virtual machine in all of the encountered snapshots are checked whether they are descendants of the given normal base or immutable hard disk. The first found child (which is the differencing hard disk) will be used instead of the normal base or immutable hard disk as a parent for creating a new differencing hard disk that will be actually attached to the machine. And only if no descendants are found or if the virtual machine does not have any snapshots then the normal base or immutable hard disk will be used itself as a parent for this differencing hard disk.

It is easier to explain what smart attachment does using the following example:

BEFORE attaching B.vdi:       AFTER attaching B.vdi:

Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
Snapshot 2 (D1->B.vdi)        Snapshot 2 (D1->B.vdi)
Snapshot 3 (D2->D1.vdi)       Snapshot 3 (D2->D1.vdi)
Snapshot 4 (none)             Snapshot 4 (none)
CurState   (none)             CurState   (D3->D2.vdi)

NOT
...
CurState   (D3->B.vdi)

The first column is the virtual machine configuration before the base hard disk B.vdi is attached, the second column shows the machine after this hard disk is attached. Constructs like D1->B.vdi and similar mean that the hard disk that is actually attached to the machine is a differencing hard disk, D1.vdi, which is linked to (based on) another hard disk, B.vdi.

As we can see from the example, the hard disk B.vdi was detached from the machine before taking Snapshot 4. Later, after Snapshot 4 was taken, the user decides to attach B.vdi again. B.vdi has dependent child hard disks (D1.vdi, D2.vdi), therefore it cannot be attached directly and needs an indirect attachment (i.e. implicit creation of a new differencing hard disk). Due to the smart attachment procedure, the new differencing hard disk (D3.vdi) will be based on D2.vdi, not on B.vdi itself, since D2.vdi is the most recent view of B.vdi existing for this snapshot branch of the given virtual machine.

Note that if there is more than one descendant hard disk of the given base hard disk found in a snapshot, and there is an exact device, channel and bus match, then this exact match will be used. Otherwise, the youngest descendant will be picked up.

There is one more important aspect of the smart attachment procedure which is not related to snapshots at all. Before walking through the snapshots as described above, the backup copy of the current list of hard disk attachment is searched for descendants. This backup copy is created when the hard disk configuration is changed for the first time after the last IMachine.save_settings() call and used by IMachine.discard_settings() to undo the recent hard disk changes. When such a descendant is found in this backup copy, it will be simply re-attached back, without creating a new differencing hard disk for it. This optimization is necessary to make it possible to re-attach the base or immutable hard disk to a different bus, channel or device slot without losing the contents of the differencing hard disk actually attached to the machine in place of it.

medium

Get IMedium value for ‘medium’ Medium object associated with this attachment; it can be @c null for removable devices.

controller

Get str value for ‘controller’ Name of the storage controller of this attachment; this refers to one of the controllers in IMachine.storage_controllers() by name.

port

Get int value for ‘port’ Port number of this attachment. See IMachine.attach_device() for the meaning of this value for the different controller types.

device

Get int value for ‘device’ Device slot number of this attachment. See IMachine.attach_device() for the meaning of this value for the different controller types.

type_p

Get DeviceType value for ‘type’ Device type of this attachment.

passthrough

Get bool value for ‘passthrough’ Pass I/O requests through to a device on the host.

temporary_eject

Get bool value for ‘temporaryEject’ Whether guest-triggered eject results in unmounting the medium.

is_ejected

Get bool value for ‘isEjected’ Signals that the removable medium has been ejected. This is not necessarily equivalent to having a @c null medium association.

non_rotational

Get bool value for ‘nonRotational’ Whether the associated medium is non-rotational.

discard

Get bool value for ‘discard’ Whether the associated medium supports discarding unused blocks.

hot_pluggable

Get bool value for ‘hotPluggable’ Whether this attachment is hot pluggable or not.

bandwidth_group

Get IBandwidthGroup value for ‘bandwidthGroup’ The bandwidth group this medium attachment is assigned to.

class virtualbox.library.IMedium(interface=None)[source]

The IMedium interface represents virtual storage for a machine’s hard disks, CD/DVD or floppy drives. It will typically represent a disk image on the host, for example a VDI or VMDK file representing a virtual hard disk, or an ISO or RAW file representing virtual removable media, but can also point to a network location (e.g. for iSCSI targets).

Instances of IMedium are connected to virtual machines by way of medium attachments, which link the storage medium to a particular device slot of a storage controller of the virtual machine. In the VirtualBox API, virtual storage is therefore always represented by the following chain of object links:

IMachine.storage_controllers() contains an array of storage controllers (IDE, SATA, SCSI, SAS or a floppy controller; these are instances of IStorageController ). IMachine.medium_attachments() contains an array of medium attachments (instances of IMediumAttachment created by IMachine.attach_device() ), each containing a storage controller from the above array, a port/device specification, and an instance of IMedium representing the medium storage (image file).

For removable media, the storage medium is optional; a medium attachment with no medium represents a CD/DVD or floppy drive with no medium inserted. By contrast, hard disk attachments will always have an IMedium object attached. Each IMedium in turn points to a storage unit (such as a file on the host computer or a network resource) that holds actual data. This location is represented by the location() attribute.

Existing media are opened using IVirtualBox.open_medium() ; new hard disk media can be created with the VirtualBox API using the IVirtualBox.create_medium() method. Differencing hard disks (see below) are usually implicitly created by VirtualBox as needed, but may also be created explicitly using create_diff_storage() . VirtualBox cannot create CD/DVD or floppy images (ISO and RAW files); these should be created with external tools and then opened from within VirtualBox.

Only for CD/DVDs and floppies, an IMedium instance can also represent a host drive. In that case the id_p() attribute contains the UUID of one of the drives in IHost.dvd_drives() or IHost.floppy_drives() .

Media registries

When a medium has been opened or created using one of the aforementioned APIs, it becomes “known” to VirtualBox. Known media can be attached to virtual machines and re-found through IVirtualBox.open_medium() . They also appear in the global IVirtualBox.hard_disks() , IVirtualBox.dvd_images() and IVirtualBox.floppy_images() arrays.

Prior to VirtualBox 4.0, opening a medium added it to a global media registry in the VirtualBox.xml file, which was shared between all machines and made transporting machines and their media from one host to another difficult.

Starting with VirtualBox 4.0, media are only added to a registry when they are attached to a machine using IMachine.attach_device() . For backwards compatibility, which registry a medium is added to depends on which VirtualBox version created a machine:

If the medium has first been attached to a machine which was created by VirtualBox 4.0 or later, it is added to that machine’s media registry in the machine XML settings file. This way all information about a machine’s media attachments is contained in a single file and can be transported easily. For older media attachments (i.e. if the medium was first attached to a machine which was created with a VirtualBox version before 4.0), media continue to be registered in the global VirtualBox settings file, for backwards compatibility.

See IVirtualBox.open_medium() for more information.

Media are removed from media registries by the IMedium.close() , delete_storage() and merge_to() methods.

Accessibility checks

VirtualBox defers media accessibility checks until the refresh_state() method is called explicitly on a medium. This is done to make the VirtualBox object ready for serving requests as fast as possible and let the end-user application decide if it needs to check media accessibility right away or not.

As a result, when VirtualBox starts up (e.g. the VirtualBox object gets created for the first time), all known media are in the “Inaccessible” state, but the value of the last_access_error() attribute is an empty string because no actual accessibility check has been made yet.

After calling refresh_state() , a medium is considered accessible if its storage unit can be read. In that case, the state() attribute has a value of “Created”. If the storage unit cannot be read (for example, because it is located on a disconnected network resource, or was accidentally deleted outside VirtualBox), the medium is considered inaccessible, which is indicated by the “Inaccessible” state. The exact reason why the medium is inaccessible can be obtained by reading the last_access_error() attribute.

Medium types

There are five types of medium behavior which are stored in the type_p() attribute (see MediumType ) and which define the medium’s behavior with attachments and snapshots.

All media can be also divided in two groups: base media and differencing media. A base medium contains all sectors of the medium data in its own storage and therefore can be used independently. In contrast, a differencing medium is a “delta” to some other medium and contains only those sectors which differ from that other medium, which is then called a parent. The differencing medium is said to be linked to that parent. The parent may be itself a differencing medium, thus forming a chain of linked media. The last element in that chain must always be a base medium. Note that several differencing media may be linked to the same parent medium.

Differencing media can be distinguished from base media by querying the parent() attribute: base media do not have parents they would depend on, so the value of this attribute is always @c null for them. Using this attribute, it is possible to walk up the medium tree (from the child medium to its parent). It is also possible to walk down the tree using the children() attribute.

Note that the type of all differencing media is “normal”; all other values are meaningless for them. Base media may be of any type.

Automatic composition of the file name part

Another extension to the IMedium.location() attribute is that there is a possibility to cause VirtualBox to compose a unique value for the file name part of the location using the UUID of the hard disk. This applies only to hard disks in MediumState.not_created state, e.g. before the storage unit is created, and works as follows. You set the value of the IMedium.location() attribute to a location specification which only contains the path specification but not the file name part and ends with either a forward slash or a backslash character. In response, VirtualBox will generate a new UUID for the hard disk and compose the file name using the following pattern:

<path>/{<uuid>}.<ext>

where <path> is the supplied path specification, <uuid> is the newly generated UUID and <ext> is the default extension for the storage format of this hard disk. After that, you may call any of the methods that create a new hard disk storage unit and they will use the generated UUID and file name.

id_p

Get str value for ‘id’ UUID of the medium. For a newly created medium, this value is a randomly generated UUID.

For media in one of MediumState_NotCreated, MediumState_Creating or MediumState_Deleting states, the value of this property is undefined and will most likely be an empty UUID.

description

Get or set str value for ‘description’ Optional description of the medium. For a newly created medium the value of this attribute is an empty string.

Medium types that don’t support this attribute will return E_NOTIMPL in attempt to get or set this attribute’s value.

For some storage types, reading this attribute may return an outdated (last known) value when state() is MediumState.inaccessible or MediumState.locked_write because the value of this attribute is stored within the storage unit itself. Also note that changing the attribute value is not possible in such case, as well as when the medium is the MediumState.locked_read state.

state

Get MediumState value for ‘state’ Returns the current medium state, which is the last state set by the accessibility check performed by refresh_state() . If that method has not yet been called on the medium, the state is “Inaccessible”; as opposed to truly inaccessible media, the value of last_access_error() will be an empty string in that case.

As of version 3.1, this no longer performs an accessibility check automatically; call refresh_state() for that.

variant

Get MediumVariant value for ‘variant’ Returns the storage format variant information for this medium as an array of the flags described at MediumVariant . Before refresh_state() is called this method returns an undefined value.

location

Get str value for ‘location’ Location of the storage unit holding medium data.

The format of the location string is medium type specific. For medium types using regular files in a host’s file system, the location string is the full file name.

name

Get str value for ‘name’ Name of the storage unit holding medium data.

The returned string is a short version of the location() attribute that is suitable for representing the medium in situations where the full location specification is too long (such as lists and comboboxes in GUI frontends). This string is also used by frontends to sort the media list alphabetically when needed.

For example, for locations that are regular files in the host’s file system, the value of this attribute is just the file name (+ extension), without the path specification.

Note that as opposed to the location() attribute, the name attribute will not necessary be unique for a list of media of the given type and format.

device_type

Get DeviceType value for ‘deviceType’ Kind of device (DVD/Floppy/HardDisk) which is applicable to this medium.

host_drive

Get bool value for ‘hostDrive’ True if this corresponds to a drive on the host.

size

Get int value for ‘size’ Physical size of the storage unit used to hold medium data (in bytes).

For media whose state() is MediumState.inaccessible , the value of this property is the last known size. For MediumState.not_created media, the returned value is zero.

format_p

Get str value for ‘format’ Storage format of this medium.

The value of this attribute is a string that specifies a backend used to store medium data. The storage format is defined when you create a new medium or automatically detected when you open an existing medium, and cannot be changed later.

The list of all storage formats supported by this VirtualBox installation can be obtained using ISystemProperties.medium_formats() .

medium_format

Get IMediumFormat value for ‘mediumFormat’ Storage medium format object corresponding to this medium.

The value of this attribute is a reference to the medium format object that specifies the backend properties used to store medium data. The storage format is defined when you create a new medium or automatically detected when you open an existing medium, and cannot be changed later.

@c null is returned if there is no associated medium format object. This can e.g. happen for medium objects representing host drives and other special medium objects.

type_p

Get or set MediumType value for ‘type’ Type (role) of this medium.

The following constraints apply when changing the value of this attribute:

If a medium is attached to a virtual machine (either in the current state or in one of the snapshots), its type cannot be changed.

As long as the medium has children, its type cannot be set to MediumType.writethrough .

The type of all differencing media is MediumType.normal and cannot be changed.

The type of a newly created or opened medium is set to MediumType.normal , except for DVD and floppy media, which have a type of MediumType.writethrough .

allowed_types

Get MediumType value for ‘allowedTypes’ Returns which medium types can selected for this medium.

parent

Get IMedium value for ‘parent’ Parent of this medium (the medium this medium is directly based on).

Only differencing media have parents. For base (non-differencing) media, @c null is returned.

children

Get IMedium value for ‘children’ Children of this medium (all differencing media directly based on this medium). A @c null array is returned if this medium does not have any children.

base

Get IMedium value for ‘base’ Base medium of this medium.

If this is a differencing medium, its base medium is the medium the given medium branch starts from. For all other types of media, this property returns the medium object itself (i.e. the same object this property is read on).

read_only

Get bool value for ‘readOnly’ Returns @c true if this medium is read-only and @c false otherwise.

A medium is considered to be read-only when its contents cannot be modified without breaking the integrity of other parties that depend on this medium such as its child media or snapshots of virtual machines where this medium is attached to these machines. If there are no children and no such snapshots then there is no dependency and the medium is not read-only.

The value of this attribute can be used to determine the kind of the attachment that will take place when attaching this medium to a virtual machine. If the value is @c false then the medium will be attached directly. If the value is @c true then the medium will be attached indirectly by creating a new differencing child medium for that. See the interface description for more information.

Note that all MediumType.immutable Immutable media are always read-only while all MediumType.writethrough Writethrough media are always not.

The read-only condition represented by this attribute is related to the medium type and usage, not to the current IMedium.state() medium state and not to the read-only state of the storage unit.

logical_size

Get int value for ‘logicalSize’ Logical size of this medium (in bytes), as reported to the guest OS running inside the virtual machine this medium is attached to. The logical size is defined when the medium is created and cannot be changed later.

For media whose state is state() is MediumState.inaccessible , the value of this property is the last known logical size. For MediumState.not_created media, the returned value is zero.

auto_reset

Get or set bool value for ‘autoReset’ Whether this differencing medium will be automatically reset each time a virtual machine it is attached to is powered up. This attribute is automatically set to @c true for the last differencing image of an “immutable” medium (see MediumType ).

See reset() for more information about resetting differencing media.

Reading this property on a base (non-differencing) medium will always @c false. Changing the value of this property in this case is not supported.

last_access_error

Get str value for ‘lastAccessError’ Text message that represents the result of the last accessibility check performed by refresh_state() .

An empty string is returned if the last accessibility check was successful or has not yet been called. As a result, if state() is “Inaccessible” and this attribute is empty, then refresh_state() has yet to be called; this is the default value of media after VirtualBox initialization. A non-empty string indicates a failure and should normally describe a reason of the failure (for example, a file read error).

machine_ids

Get str value for ‘machineIds’ Array of UUIDs of all machines this medium is attached to.

A @c null array is returned if this medium is not attached to any machine or to any machine’s snapshot.

The returned array will include a machine even if this medium is not attached to that machine in the current state but attached to it in one of the machine’s snapshots. See get_snapshot_ids() for details.

set_ids(set_image_id, image_id, set_parent_id, parent_id)[source]

Changes the UUID and parent UUID for a hard disk medium.

in set_image_id of type bool
Select whether a new image UUID is set or not.
in image_id of type str
New UUID for the image. If an empty string is passed, then a new UUID is automatically created, provided that @a setImageId is @c true. Specifying a zero UUID is not allowed.
in set_parent_id of type bool
Select whether a new parent UUID is set or not.
in parent_id of type str
New parent UUID for the image. If an empty string is passed, then a new UUID is automatically created, provided @a setParentId is @c true. A zero UUID is valid.
raises OleErrorInvalidarg
Invalid parameter combination.
raises VBoxErrorNotSupported
Medium is not a hard disk medium.
refresh_state()[source]

If the current medium state (see MediumState ) is one of “Created”, “Inaccessible” or “LockedRead”, then this performs an accessibility check on the medium and sets the value of the state() attribute accordingly; that value is also returned for convenience.

For all other state values, this does not perform a refresh but returns the state only.

The refresh, if performed, may take a long time (several seconds or even minutes, depending on the storage unit location and format) because it performs an accessibility check of the storage unit. This check may cause a significant delay if the storage unit of the given medium is, for example, a file located on a network share which is not currently accessible due to connectivity problems. In that case, the call will not return until a timeout interval defined by the host OS for this operation expires. For this reason, it is recommended to never read this attribute on the main UI thread to avoid making the UI unresponsive.

If the last known state of the medium is “Created” and the accessibility check fails, then the state would be set to “Inaccessible”, and last_access_error() may be used to get more details about the failure. If the state of the medium is “LockedRead”, then it remains the same, and a non-empty value of last_access_error() will indicate a failed accessibility check in this case.

Note that not all medium states are applicable to all medium types.

return state of type MediumState
New medium state.
get_snapshot_ids(machine_id)[source]

Returns an array of UUIDs of all snapshots of the given machine where this medium is attached to.

If the medium is attached to the machine in the current state, then the first element in the array will always be the ID of the queried machine (i.e. the value equal to the @c machineId argument), followed by snapshot IDs (if any).

If the medium is not attached to the machine in the current state, then the array will contain only snapshot IDs.

The returned array may be @c null if this medium is not attached to the given machine at all, neither in the current state nor in one of the snapshots.

in machine_id of type str
UUID of the machine to query.
return snapshot_ids of type str
Array of snapshot UUIDs of the given machine using this medium.
lock_read()[source]

Locks this medium for reading.

A read lock is shared: many clients can simultaneously lock the same medium for reading unless it is already locked for writing (see lock_write() ) in which case an error is returned.

When the medium is locked for reading, it cannot be modified from within VirtualBox. This means that any method that changes the properties of this medium or contents of the storage unit will return an error (unless explicitly stated otherwise). That includes an attempt to start a virtual machine that wants to write to the medium.

When the virtual machine is started up, it locks for reading all media it uses in read-only mode. If some medium cannot be locked for reading, the startup procedure will fail. A medium is typically locked for reading while it is used by a running virtual machine but has a depending differencing image that receives the actual write operations. This way one base medium can have multiple child differencing images which can be written to simultaneously. Read-only media such as DVD and floppy images are also locked for reading only (so they can be in use by multiple machines simultaneously).

A medium is also locked for reading when it is the source of a write operation such as clone_to() or merge_to() .

The medium locked for reading must be unlocked by abandoning the returned token object, see IToken . Calls to lock_read() can be nested and the lock is actually released when all callers have abandoned the token.

This method sets the medium state (see state() ) to “LockedRead” on success. The medium’s previous state must be one of “Created”, “Inaccessible” or “LockedRead”.

Locking an inaccessible medium is not an error; this method performs a logical lock that prevents modifications of this medium through the VirtualBox API, not a physical file-system lock of the underlying storage unit.

This method returns the current state of the medium before the operation.

return token of type IToken
Token object, when this is released (reference count reaches 0) then the lock count is decreased. The lock is released when the lock count reaches 0.
raises VBoxErrorInvalidObjectState
Invalid medium state (e.g. not created, locked, inaccessible,

creating, deleting).

lock_write()[source]

Locks this medium for writing.

A write lock, as opposed to lock_read() , is exclusive: there may be only one client holding a write lock, and there may be no read locks while the write lock is held. As a result, read-locking fails if a write lock is held, and write-locking fails if either a read or another write lock is held.

When a medium is locked for writing, it cannot be modified from within VirtualBox, and it is not guaranteed that the values of its properties are up-to-date. Any method that changes the properties of this medium or contents of the storage unit will return an error (unless explicitly stated otherwise).

When a virtual machine is started up, it locks for writing all media it uses to write data to. If any medium could not be locked for writing, the startup procedure will fail. If a medium has differencing images, then while the machine is running, only the last (“leaf”) differencing image is locked for writing, whereas its parents are locked for reading only.

A medium is also locked for writing when it is the target of a write operation such as clone_to() or merge_to() .

The medium locked for writing must be unlocked by abandoning the returned token object, see IToken . Write locks cannot be nested.

This method sets the medium state (see state() ) to “LockedWrite” on success. The medium’s previous state must be either “Created” or “Inaccessible”.

Locking an inaccessible medium is not an error; this method performs a logical lock that prevents modifications of this medium through the VirtualBox API, not a physical file-system lock of the underlying storage unit.

return token of type IToken
Token object, when this is released (reference count reaches 0) then the lock is released.
raises VBoxErrorInvalidObjectState
Invalid medium state (e.g. not created, locked, inaccessible,

creating, deleting).

close()[source]

Closes this medium.

The medium must not be attached to any known virtual machine and must not have any known child media, otherwise the operation will fail.

When the medium is successfully closed, it is removed from the list of registered media, but its storage unit is not deleted. In particular, this means that this medium can later be opened again using the IVirtualBox.open_medium() call.

Note that after this method successfully returns, the given medium object becomes uninitialized. This means that any attempt to call any of its methods or attributes will fail with the “Object not ready” (E_ACCESSDENIED) error.

raises VBoxErrorInvalidObjectState
Invalid medium state (other than not created, created or

inaccessible).

raises VBoxErrorObjectInUse
Medium attached to virtual machine.
raises VBoxErrorFileError
Settings file not accessible.
raises VBoxErrorXmlError
Could not parse the settings file.
get_property(name)[source]

Returns the value of the custom medium property with the given name.

The list of all properties supported by the given medium format can be obtained with IMediumFormat.describe_properties() .

If this method returns an empty string in @a value, the requested property is supported but currently not assigned any value.

in name of type str
Name of the property to get.
return value of type str
Current property value.
raises VBoxErrorObjectNotFound
Requested property does not exist (not supported by the format).
raises OleErrorInvalidarg
@a name is @c null or empty.
set_property(name, value)[source]

Sets the value of the custom medium property with the given name.

The list of all properties supported by the given medium format can be obtained with IMediumFormat.describe_properties() .

Setting the property value to @c null or an empty string is equivalent to deleting the existing value. A default value (if it is defined for this property) will be used by the format backend in this case.

in name of type str
Name of the property to set.
in value of type str
Property value to set.
raises VBoxErrorObjectNotFound
Requested property does not exist (not supported by the format).
raises OleErrorInvalidarg
@a name is @c null or empty.
get_properties(names)[source]

Returns values for a group of properties in one call.

The names of the properties to get are specified using the @a names argument which is a list of comma-separated property names or an empty string if all properties are to be returned. Currently the value of this argument is ignored and the method always returns all existing properties.

The list of all properties supported by the given medium format can be obtained with IMediumFormat.describe_properties() .

The method returns two arrays, the array of property names corresponding to the @a names argument and the current values of these properties. Both arrays have the same number of elements with each element at the given index in the first array corresponds to an element at the same index in the second array.

For properties that do not have assigned values, an empty string is returned at the appropriate index in the @a returnValues array.

in names of type str
Names of properties to get.
out return_names of type str
Names of returned properties.
return return_values of type str
Values of returned properties.
set_properties(names, values)[source]

Sets values for a group of properties in one call.

The names of the properties to set are passed in the @a names array along with the new values for them in the @a values array. Both arrays have the same number of elements with each element at the given index in the first array corresponding to an element at the same index in the second array.

If there is at least one property name in @a names that is not valid, the method will fail before changing the values of any other properties from the @a names array.

Using this method over set_property() is preferred if you need to set several properties at once since it is more efficient.

The list of all properties supported by the given medium format can be obtained with IMediumFormat.describe_properties() .

Setting the property value to @c null or an empty string is equivalent to deleting the existing value. A default value (if it is defined for this property) will be used by the format backend in this case.

in names of type str
Names of properties to set.
in values of type str
Values of properties to set.
create_base_storage(logical_size, variant)[source]

Starts creating a hard disk storage unit (fixed/dynamic, according to the variant flags) in in the background. The previous storage unit created for this object, if any, must first be deleted using delete_storage() , otherwise the operation will fail.

Before the operation starts, the medium is placed in MediumState.creating state. If the create operation fails, the medium will be placed back in MediumState.not_created state.

After the returned progress object reports that the operation has successfully completed, the medium state will be set to MediumState.created , the medium will be remembered by this VirtualBox installation and may be attached to virtual machines.

in logical_size of type int
Maximum logical size of the medium in bytes.
in variant of type MediumVariant
Exact image variant which should be created (as a combination of MediumVariant flags).
return progress of type IProgress
Progress object to track the operation completion.
raises VBoxErrorNotSupported
The variant of storage creation operation is not supported. See
delete_storage()[source]

Starts deleting the storage unit of this medium.

The medium must not be attached to any known virtual machine and must not have any known child media, otherwise the operation will fail. It will also fail if there is no storage unit to delete or if deletion is already in progress, or if the medium is being in use (locked for read or for write) or inaccessible. Therefore, the only valid state for this operation to succeed is MediumState.created .

Before the operation starts, the medium is placed in MediumState.deleting state and gets removed from the list of remembered hard disks (media registry). If the delete operation fails, the medium will be remembered again and placed back to MediumState.created state.

After the returned progress object reports that the operation is complete, the medium state will be set to MediumState.not_created and you will be able to use one of the storage creation methods to create it again.

close()

If the deletion operation fails, it is not guaranteed that the storage unit still exists. You may check the IMedium.state() value to answer this question.

return progress of type IProgress
Progress object to track the operation completion.
raises VBoxErrorObjectInUse
Medium is attached to a virtual machine.
raises VBoxErrorNotSupported
Storage deletion is not allowed because neither of storage creation

operations are supported. See

create_diff_storage(target, variant)[source]

Starts creating an empty differencing storage unit based on this medium in the format and at the location defined by the @a target argument.

The target medium must be in MediumState.not_created state (i.e. must not have an existing storage unit). Upon successful completion, this operation will set the type of the target medium to MediumType.normal and create a storage unit necessary to represent the differencing medium data in the given format (according to the storage format of the target object).

After the returned progress object reports that the operation is successfully complete, the target medium gets remembered by this VirtualBox installation and may be attached to virtual machines.

The medium will be set to MediumState.locked_read state for the duration of this operation.

in target of type IMedium
Target medium.
in variant of type MediumVariant
Exact image variant which should be created (as a combination of MediumVariant flags).
return progress of type IProgress
Progress object to track the operation completion.
raises VBoxErrorObjectInUse
Medium not in @c NotCreated state.
merge_to(target)[source]

Starts merging the contents of this medium and all intermediate differencing media in the chain to the given target medium.

The target medium must be either a descendant of this medium or its ancestor (otherwise this method will immediately return a failure). It follows that there are two logical directions of the merge operation: from ancestor to descendant (forward merge) and from descendant to ancestor (backward merge). Let us consider the following medium chain:

Base <- Diff_1 <- Diff_2

Here, calling this method on the Base medium object with Diff_2 as an argument will be a forward merge; calling it on Diff_2 with Base as an argument will be a backward merge. Note that in both cases the contents of the resulting medium will be the same, the only difference is the medium object that takes the result of the merge operation. In case of the forward merge in the above example, the result will be written to Diff_2; in case of the backward merge, the result will be written to Base. In other words, the result of the operation is always stored in the target medium.

Upon successful operation completion, the storage units of all media in the chain between this (source) medium and the target medium, including the source medium itself, will be automatically deleted and the relevant medium objects (including this medium) will become uninitialized. This means that any attempt to call any of their methods or attributes will fail with the “Object not ready” (E_ACCESSDENIED) error. Applied to the above example, the forward merge of Base to Diff_2 will delete and uninitialize both Base and Diff_1 media. Note that Diff_2 in this case will become a base medium itself since it will no longer be based on any other medium.

Considering the above, all of the following conditions must be met in order for the merge operation to succeed:

Neither this (source) medium nor any intermediate differencing medium in the chain between it and the target medium is attached to any virtual machine.

Neither the source medium nor the target medium is an MediumType.immutable medium.

The part of the medium tree from the source medium to the target medium is a linear chain, i.e. all medium in this chain have exactly one child which is the next medium in this chain. The only exception from this rule is the target medium in the forward merge operation; it is allowed to have any number of child media because the merge operation will not change its logical contents (as it is seen by the guest OS or by children).

None of the involved media are in MediumState.locked_read or MediumState.locked_write state.

This (source) medium and all intermediates will be placed to MediumState.deleting state and the target medium will be placed to MediumState.locked_write state and for the duration of this operation.

in target of type IMedium
Target medium.
return progress of type IProgress
Progress object to track the operation completion.
clone_to(target, variant, parent)[source]

Starts creating a clone of this medium in the format and at the location defined by the @a target argument.

The target medium must be either in MediumState.not_created state (i.e. must not have an existing storage unit) or in MediumState.created state (i.e. created and not locked, and big enough to hold the data or else the copy will be partial). Upon successful completion, the cloned medium will contain exactly the same sector data as the medium being cloned, except that in the first case a new UUID for the clone will be randomly generated, and in the second case the UUID will remain unchanged.

The @a parent argument defines which medium will be the parent of the clone. Passing a @c null reference indicates that the clone will be a base image, i.e. completely independent. It is possible to specify an arbitrary medium for this parameter, including the parent of the medium which is being cloned. Even cloning to a child of the source medium is possible. Note that when cloning to an existing image, the @a parent argument is ignored.

After the returned progress object reports that the operation is successfully complete, the target medium gets remembered by this VirtualBox installation and may be attached to virtual machines.

This medium will be placed to MediumState.locked_read state for the duration of this operation.

in target of type IMedium
Target medium.
in variant of type MediumVariant
Exact image variant which should be created (as a combination of MediumVariant flags).
in parent of type IMedium
Parent of the cloned medium.
return progress of type IProgress
Progress object to track the operation completion.
raises OleErrorNotimpl
The specified cloning variant is not supported at the moment.
clone_to_base(target, variant)[source]

Starts creating a clone of this medium in the format and at the location defined by the @a target argument.

The target medium must be either in MediumState.not_created state (i.e. must not have an existing storage unit) or in MediumState.created state (i.e. created and not locked, and big enough to hold the data or else the copy will be partial). Upon successful completion, the cloned medium will contain exactly the same sector data as the medium being cloned, except that in the first case a new UUID for the clone will be randomly generated, and in the second case the UUID will remain unchanged.

The @a parent argument defines which medium will be the parent of the clone. In this case the clone will be a base image, i.e. completely independent. It is possible to specify an arbitrary medium for this parameter, including the parent of the medium which is being cloned. Even cloning to a child of the source medium is possible. Note that when cloning to an existing image, the @a parent argument is ignored.

After the returned progress object reports that the operation is successfully complete, the target medium gets remembered by this VirtualBox installation and may be attached to virtual machines.

This medium will be placed to MediumState.locked_read state for the duration of this operation.

in target of type IMedium
Target medium.
in variant of type MediumVariant
MediumVariant flags).
return progress of type IProgress
Progress object to track the operation completion.
raises OleErrorNotimpl
The specified cloning variant is not supported at the moment.
set_location(location)[source]

Changes the location of this medium. Some medium types may support changing the storage unit location by simply changing the value of the associated property. In this case the operation is performed immediately, and @a progress is returning a @c null reference. Otherwise on success there is a progress object returned, which signals progress and completion of the operation. This distinction is necessary because for some formats the operation is very fast, while for others it can be very slow (moving the image file by copying all data), and in the former case it’d be a waste of resources to create a progress object which will immediately signal completion.

When setting a location for a medium which corresponds to a/several regular file(s) in the host’s file system, the given file name may be either relative to the IVirtualBox.home_folder() VirtualBox home folder or absolute. Note that if the given location specification does not contain the file extension part then a proper default extension will be automatically appended by the implementation depending on the medium type.

in location of type str
New location.
return progress of type IProgress
Progress object to track the operation completion.
raises OleErrorNotimpl
The operation is not implemented yet.
raises VBoxErrorNotSupported
Medium format does not support changing the location.
compact()[source]
Starts compacting of this medium. This means that the medium is

transformed into a possibly more compact storage representation. This potentially creates temporary images, which can require a substantial amount of additional disk space.

This medium will be placed to MediumState.locked_write state and all its parent media (if any) will be placed to MediumState.locked_read state for the duration of this operation.

Please note that the results can be either returned straight away, or later as the result of the background operation via the object returned via the @a progress parameter.

return progress of type IProgress
Progress object to track the operation completion.
raises VBoxErrorNotSupported
Medium format does not support compacting (but potentially

needs it).

resize(logical_size)[source]

Starts resizing this medium. This means that the nominal size of the medium is set to the new value. Both increasing and decreasing the size is possible, and there are no safety checks, since VirtualBox does not make any assumptions about the medium contents.

Resizing usually needs additional disk space, and possibly also some temporary disk space. Note that resize does not create a full temporary copy of the medium, so the additional disk space requirement is usually much lower than using the clone operation.

This medium will be placed to MediumState.locked_write state for the duration of this operation.

Please note that the results can be either returned straight away, or later as the result of the background operation via the object returned via the @a progress parameter.

in logical_size of type int
New nominal capacity of the medium in bytes.
return progress of type IProgress
Progress object to track the operation completion.
raises VBoxErrorNotSupported
Medium format does not support resizing.
reset()[source]

Starts erasing the contents of this differencing medium.

This operation will reset the differencing medium to its initial state when it does not contain any sector data and any read operation is redirected to its parent medium. This automatically gets called during VM power-up for every medium whose auto_reset() attribute is @c true.

The medium will be write-locked for the duration of this operation (see lock_write() ).

return progress of type IProgress
Progress object to track the operation completion.
raises VBoxErrorNotSupported
This is not a differencing medium.
raises VBoxErrorInvalidObjectState
Medium is not in
change_encryption(current_password, cipher, new_password, new_password_id)[source]
Starts encryption of this medium. This means that the stored data in the

medium is encrypted.

This medium will be placed to MediumState.locked_write state.

Please note that the results can be either returned straight away, or later as the result of the background operation via the object returned via the @a progress parameter.

in current_password of type str
The current password the medium is protected with. Use an empty string to indicate that the medium isn’t encrypted.
in cipher of type str
The cipher to use for encryption. An empty string indicates no encryption for the result.
in new_password of type str
The new password the medium should be protected with. An empty password and password ID will result in the medium being encrypted with the current password.
in new_password_id of type str
The ID of the new password when unlocking the medium.
return progress of type IProgress
Progress object to track the operation completion.
raises VBoxErrorNotSupported
Encryption is not supported for this medium because it is attached to more than one VM

or has children.

get_encryption_settings()[source]

Returns the encryption settings for this medium.

out cipher of type str
The cipher used for encryption.
return password_id of type str
The ID of the password when unlocking the medium.
raises VBoxErrorNotSupported
Encryption is not configured for this medium.
check_encryption_password(password)[source]

Checks whether the supplied password is correct for the medium.

in password of type str
The password to check.
raises VBoxErrorNotSupported
Encryption is not configured for this medium.
raises VBoxErrorPasswordIncorrect
The given password is incorrect.
class virtualbox.library.IMediumFormat(interface=None)[source]

The IMediumFormat interface represents a medium format.

Each medium format has an associated backend which is used to handle media stored in this format. This interface provides information about the properties of the associated backend.

Each medium format is identified by a string represented by the id_p() attribute. This string is used in calls like IVirtualBox.create_medium() to specify the desired format.

The list of all supported medium formats can be obtained using ISystemProperties.medium_formats() .

IMedium

id_p

Get str value for ‘id’ Identifier of this format.

The format identifier is a non-@c null non-empty ASCII string. Note that this string is case-insensitive. This means that, for example, all of the following strings:

"VDI"
"vdi"
"VdI"

refer to the same medium format.

This string is used in methods of other interfaces where it is necessary to specify a medium format, such as IVirtualBox.create_medium() .

name

Get str value for ‘name’ Human readable description of this format.

Mainly for use in file open dialogs.

capabilities

Get MediumFormatCapabilities value for ‘capabilities’ Capabilities of the format as an array of the flags.

For the meaning of individual capability flags see MediumFormatCapabilities .

describe_file_extensions()[source]

Returns two arrays describing the supported file extensions.

The first array contains the supported extensions and the seconds one the type each extension supports. Both have the same size.

Note that some backends do not work on files, so this array may be empty.

IMediumFormat.capabilities()

out extensions of type str
The array of supported extensions.
out types of type DeviceType
The array which indicates the device type for every given extension.
describe_properties()[source]

Returns several arrays describing the properties supported by this format.

An element with the given index in each array describes one property. Thus, the number of elements in each returned array is the same and corresponds to the number of supported properties.

The returned arrays are filled in only if the MediumFormatCapabilities.properties flag is set. All arguments must be non-@c null.

DataType , DataFlags

out names of type str
Array of property names.
out descriptions of type str
Array of property descriptions.
out types of type DataType
Array of property types.
out flags of type int
Array of property flags.
out defaults of type str
Array of default property values.
class virtualbox.library.IToken(interface=None)[source]

The IToken interface represents a token passed to an API client, which triggers cleanup actions when it is explicitly released by calling the abandon() method (preferred, as it is accurately defined when the release happens), or when the object reference count drops to 0. The latter way is implicitly used when an API client crashes, however the discovery that there was a crash can take rather long, depending on the platform (COM needs 6 minutes). So better don’t rely on the crash behavior too much.

abandon()[source]

Releases this token. Cannot be undone in any way, and makes the token object unusable (even the dummy() method will return an error), ready for releasing. It is a more defined way than just letting the reference count drop to 0, because the latter (depending on the platform) can trigger asynchronous cleanup activity.

dummy()[source]

Purely a NOOP. Useful when using proxy type API bindings (e.g. the webservice) which manage objects on behalf of the actual client, using an object reference expiration time based garbage collector.

class virtualbox.library.IMousePointerShape(interface=None)[source]

The guest mouse pointer description.

visible

Get bool value for ‘visible’ Flag whether the pointer is visible.

alpha

Get bool value for ‘alpha’ Flag whether the pointer has an alpha channel.

hot_x

Get int value for ‘hotX’ The pointer hot spot X coordinate.

hot_y

Get int value for ‘hotY’ The pointer hot spot Y coordinate.

width

Get int value for ‘width’ Width of the pointer shape in pixels.

height

Get int value for ‘height’ Height of the pointer shape in pixels.

shape

Get str value for ‘shape’ Shape bitmaps.

The @a shape buffer contains a 1bpp (bits per pixel) AND mask followed by a 32bpp XOR (color) mask.

For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb). For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.

An AND mask is provided for pointers with alpha channel, so if the client does not support alpha, the pointer could be displayed as a normal color pointer.

The AND mask is a 1bpp bitmap with byte aligned scanlines. The size of the AND mask therefore is cbAnd = (width + 7) / 8 * height. The padding bits at the end of each scanline are undefined.

The XOR mask follows the AND mask on the next 4-byte aligned offset: uint8_t *pu8Xor = pu8And + (cbAnd + 3) & ~3. Bytes in the gap between the AND and the XOR mask are undefined. The XOR mask scanlines have no gap between them and the size of the XOR mask is: cbXor = width * 4 * height.

If @a shape size is 0, then the shape is not known or did not change. This can happen if only the pointer visibility is changed.

class virtualbox.library.IDisplaySourceBitmap(interface=None)[source]

Information about the screen bitmap.

screen_id

Get int value for ‘screenId’

query_bitmap_info()[source]

Information about the screen bitmap.

out address of type str

out width of type int

out height of type int

out bits_per_pixel of type int

out bytes_per_line of type int

out bitmap_format of type BitmapFormat

class virtualbox.library.IFramebuffer(interface=None)[source]

Frame buffer width, in pixels.

width

Get int value for ‘width’ Frame buffer width, in pixels.

height

Get int value for ‘height’ Frame buffer height, in pixels.

bits_per_pixel

Get int value for ‘bitsPerPixel’ Color depth, in bits per pixel.

bytes_per_line

Get int value for ‘bytesPerLine’ Scan line size, in bytes.

pixel_format

Get BitmapFormat value for ‘pixelFormat’ Frame buffer pixel format. It’s one of the values defined by BitmapFormat .

This attribute must never (and will never) return BitmapFormat.opaque – the format of the frame buffer must be always known.

height_reduction

Get int value for ‘heightReduction’ Hint from the frame buffer about how much of the standard screen height it wants to use for itself. This information is exposed to the guest through the VESA BIOS and VMMDev interface so that it can use it for determining its video mode table. It is not guaranteed that the guest respects the value.

overlay

Get IFramebufferOverlay value for ‘overlay’ An alpha-blended overlay which is superposed over the frame buffer. The initial purpose is to allow the display of icons providing information about the VM state, including disk activity, in front ends which do not have other means of doing that. The overlay is designed to controlled exclusively by IDisplay. It has no locking of its own, and any changes made to it are not guaranteed to be visible until the affected portion of IFramebuffer is updated. The overlay can be created lazily the first time it is requested. This attribute can also return @c null to signal that the overlay is not implemented.

win_id

Get int value for ‘winId’ Platform-dependent identifier of the window where context of this frame buffer is drawn, or zero if there’s no such window.

capabilities

Get FramebufferCapabilities value for ‘capabilities’ Capabilities of the framebuffer instance.

For the meaning of individual capability flags see FramebufferCapabilities .

notify_update(x, y, width, height)[source]

Informs about an update. Gets called by the display object where this buffer is registered.

in x of type int

in y of type int

in width of type int

in height of type int

notify_update_image(x, y, width, height, image)[source]

Informs about an update and provides 32bpp bitmap.

in x of type int

in y of type int

in width of type int

in height of type int

in image of type str
Array with 32BPP image data.
notify_change(screen_id, x_origin, y_origin, width, height)[source]

Requests a size change.

in screen_id of type int
Logical guest screen number.
in x_origin of type int
Location of the screen in the guest.
in y_origin of type int
Location of the screen in the guest.
in width of type int
Width of the guest display, in pixels.
in height of type int
Height of the guest display, in pixels.
video_mode_supported(width, height, bpp)[source]

Returns whether the frame buffer implementation is willing to support a given video mode. In case it is not able to render the video mode (or for some reason not willing), it should return @c false. Usually this method is called when the guest asks the VMM device whether a given video mode is supported so the information returned is directly exposed to the guest. It is important that this method returns very quickly.

in width of type int

in height of type int

in bpp of type int

return supported of type bool

get_visible_region(rectangles, count)[source]

Returns the visible region of this frame buffer.

If the @a rectangles parameter is @c null then the value of the @a count parameter is ignored and the number of elements necessary to describe the current visible region is returned in @a countCopied.

If @a rectangles is not @c null but @a count is less than the required number of elements to store region data, the method will report a failure. If @a count is equal or greater than the required number of elements, then the actual number of elements copied to the provided array will be returned in @a countCopied.

The address of the provided array must be in the process space of this IFramebuffer object.

Method not yet implemented.

in rectangles of type str
Pointer to the @c RTRECT array to receive region data.
in count of type int
Number of @c RTRECT elements in the @a rectangles array.
return count_copied of type int
Number of elements copied to the @a rectangles array.
set_visible_region(rectangles, count)[source]

Suggests a new visible region to this frame buffer. This region represents the area of the VM display which is a union of regions of all top-level windows of the guest operating system running inside the VM (if the Guest Additions for this system support this functionality). This information may be used by the frontends to implement the seamless desktop integration feature.

The address of the provided array must be in the process space of this IFramebuffer object.

The IFramebuffer implementation must make a copy of the provided array of rectangles.

Method not yet implemented.

in rectangles of type str
Pointer to the @c RTRECT array.
in count of type int
Number of @c RTRECT elements in the @a rectangles array.
process_vhwa_command(command)[source]

Posts a Video HW Acceleration Command to the frame buffer for processing. The commands used for 2D video acceleration (DDraw surface creation/destroying, blitting, scaling, color conversion, overlaying, etc.) are posted from quest to the host to be processed by the host hardware.

The address of the provided command must be in the process space of this IFramebuffer object.

in command of type str
Pointer to VBOXVHWACMD containing the command to execute.
notify3_d_event(type_p, data)[source]

Notifies framebuffer about 3D backend event.

in type_p of type int
event type. Currently only VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA is supported.
in data of type str
event-specific data, depends on the supplied event type
class virtualbox.library.IFramebufferOverlay(interface=None)[source]

The IFramebufferOverlay interface represents an alpha blended overlay for displaying status icons above an IFramebuffer. It is always created not visible, so that it must be explicitly shown. It only covers a portion of the IFramebuffer, determined by its width, height and co-ordinates. It is always in packed pixel little-endian 32bit ARGB (in that order) format, and may be written to directly. Do re-read the width though, after setting it, as it may be adjusted (increased) to make it more suitable for the front end.

x

Get int value for ‘x’ X position of the overlay, relative to the frame buffer.

y

Get int value for ‘y’ Y position of the overlay, relative to the frame buffer.

visible

Get or set bool value for ‘visible’ Whether the overlay is currently visible.

alpha

Get or set int value for ‘alpha’ The global alpha value for the overlay. This may or may not be supported by a given front end.

move(x, y)[source]

Changes the overlay’s position relative to the IFramebuffer.

in x of type int

in y of type int

class virtualbox.library.IDisplay(interface=None)[source]

The IDisplay interface represents the virtual machine’s display.

The object implementing this interface is contained in each IConsole.display() attribute and represents the visual output of the virtual machine.

The virtual display supports pluggable output targets represented by the IFramebuffer interface. Examples of the output target are a window on the host computer or an RDP session’s display on a remote computer.

guest_screen_layout

Get IGuestScreenInfo value for ‘guestScreenLayout’ Layout of the guest screens.

get_screen_resolution(screen_id)[source]

Queries certain attributes such as display width, height, color depth and the X and Y origin for a given guest screen.

The parameters @a xOrigin and @a yOrigin return the X and Y coordinates of the framebuffer’s origin.

All return parameters are optional.

in screen_id of type int

out width of type int

out height of type int

out bits_per_pixel of type int

out x_origin of type int

out y_origin of type int

out guest_monitor_status of type GuestMonitorStatus

attach_framebuffer(screen_id, framebuffer)[source]

Sets the graphics update target for a screen.

in screen_id of type int

in framebuffer of type IFramebuffer

return id_p of type str

detach_framebuffer(screen_id, id_p)[source]

Removes the graphics updates target for a screen.

in screen_id of type int

in id_p of type str

query_framebuffer(screen_id)[source]

Queries the graphics updates targets for a screen.

in screen_id of type int

return framebuffer of type IFramebuffer

set_video_mode_hint(display, enabled, change_origin, origin_x, origin_y, width, height, bits_per_pixel)[source]

Asks VirtualBox to request the given video mode from the guest. This is just a hint and it cannot be guaranteed that the requested resolution will be used. Guest Additions are required for the request to be seen by guests. The caller should issue the request and wait for a resolution change and after a timeout retry.

Specifying @c 0 for either @a width, @a height or @a bitsPerPixel parameters means that the corresponding values should be taken from the current video mode (i.e. left unchanged).

If the guest OS supports multi-monitor configuration then the @a display parameter specifies the number of the guest display to send the hint to: @c 0 is the primary display, @c 1 is the first secondary and so on. If the multi-monitor configuration is not supported, @a display must be @c 0.

in display of type int
The number of the guest display to send the hint to.
in enabled of type bool
@c True, if this guest screen is enabled, @c False otherwise.
in change_origin of type bool
@c True, if the origin of the guest screen should be changed, @c False otherwise.
in origin_x of type int
The X origin of the guest screen.
in origin_y of type int
The Y origin of the guest screen.
in width of type int
The width of the guest screen.
in height of type int
The height of the guest screen.
in bits_per_pixel of type int
The number of bits per pixel of the guest screen.
raises OleErrorInvalidarg
The @a display is not associated with any monitor.
set_seamless_mode(enabled)[source]

Enables or disables seamless guest display rendering (seamless desktop integration) mode.

Calling this method has no effect if IGuest.get_facility_status() with facility @c Seamless does not return @c Active.

in enabled of type bool

take_screen_shot(screen_id, address, width, height, bitmap_format)[source]

Takes a screen shot of the requested size and format and copies it to the buffer allocated by the caller and pointed to by @a address. The buffer size must be enough for a 32 bits per pixel bitmap, i.e. width * height * 4 bytes.

This API can be used only locally by a VM process through the COM/XPCOM C++ API as it requires pointer support. It is not available for scripting languages, Java or any webservice clients. Unless you are writing a new VM frontend use take_screen_shot_to_array() .

in screen_id of type int

in address of type str

in width of type int

in height of type int

in bitmap_format of type BitmapFormat

take_screen_shot_to_array(screen_id, width, height, bitmap_format)[source]

Takes a guest screen shot of the requested size and format and returns it as an array of bytes.

in screen_id of type int
The guest monitor to take screenshot from.
in width of type int
Desired image width.
in height of type int
Desired image height.
in bitmap_format of type BitmapFormat
The requested format.
return screen_data of type str
Array with resulting screen data.
draw_to_screen(screen_id, address, x, y, width, height)[source]

Draws a 32-bpp image of the specified size from the given buffer to the given point on the VM display.

in screen_id of type int
Monitor to take the screenshot from.
in address of type str
Address to store the screenshot to
in x of type int
Relative to the screen top left corner.
in y of type int
Relative to the screen top left corner.
in width of type int
Desired image width.
in height of type int
Desired image height.
raises OleErrorNotimpl
Feature not implemented.
raises VBoxErrorIprtError
Could not draw to screen.
invalidate_and_update()[source]

Does a full invalidation of the VM display and instructs the VM to update it.

raises VBoxErrorIprtError
Could not invalidate and update screen.
invalidate_and_update_screen(screen_id)[source]

Redraw the specified VM screen.

in screen_id of type int
The guest screen to redraw.
complete_vhwa_command(command)[source]

Signals that the Video HW Acceleration command has completed.

in command of type str
Pointer to VBOXVHWACMD containing the completed command.
viewport_changed(screen_id, x, y, width, height)[source]

Signals that framebuffer window viewport has changed.

in screen_id of type int
Monitor to take the screenshot from.
in x of type int
Framebuffer x offset.
in y of type int
Framebuffer y offset.
in width of type int
Viewport width.
in height of type int
Viewport height.
raises OleErrorInvalidarg
The specified viewport data is invalid.
query_source_bitmap(screen_id)[source]

Obtains the guest screen bitmap parameters.

in screen_id of type int

out display_source_bitmap of type IDisplaySourceBitmap

notify_scale_factor_change(screen_id, u32_scale_factor_w_multiplied, u32_scale_factor_h_multiplied)[source]

Notify OpenGL HGCM host service about graphics content scaling factor change.

in screen_id of type int

in u32_scale_factor_w_multiplied of type int

in u32_scale_factor_h_multiplied of type int

notify_hi_dpi_output_policy_change(f_unscaled_hi_dpi)[source]

Notify OpenGL HGCM host service about HiDPI monitor scaling policy change.

in f_unscaled_hi_dpi of type bool

set_screen_layout(screen_layout_mode, guest_screen_info)[source]

Set video modes for the guest screens.

in screen_layout_mode of type ScreenLayoutMode

in guest_screen_info of type IGuestScreenInfo

class virtualbox.library.INetworkAdapter(interface=None)[source]

Represents a virtual network adapter that is attached to a virtual machine. Each virtual machine has a fixed number of network adapter slots with one instance of this attached to each of them. Call IMachine.get_network_adapter() to get the network adapter that is attached to a given slot in a given machine.

Each network adapter can be in one of five attachment modes, which are represented by the NetworkAttachmentType enumeration; see the attachment_type() attribute.

adapter_type

Get or set NetworkAdapterType value for ‘adapterType’ Type of the virtual network adapter. Depending on this value, VirtualBox will provide a different virtual network hardware to the guest.

slot

Get int value for ‘slot’ Slot number this adapter is plugged into. Corresponds to the value you pass to IMachine.get_network_adapter() to obtain this instance.

enabled

Get or set bool value for ‘enabled’ Flag whether the network adapter is present in the guest system. If disabled, the virtual guest hardware will not contain this network adapter. Can only be changed when the VM is not running.

mac_address

Get or set str value for ‘MACAddress’ Ethernet MAC address of the adapter, 12 hexadecimal characters. When setting it to @c null or an empty string for an enabled adapter, VirtualBox will generate a unique MAC address. Disabled adapters can have an empty MAC address.

attachment_type

Get or set NetworkAttachmentType value for ‘attachmentType’ Sets/Gets network attachment type of this network adapter.

bridged_interface

Get or set str value for ‘bridgedInterface’ Name of the network interface the VM should be bridged to.

host_only_interface

Get or set str value for ‘hostOnlyInterface’ Name of the host only network interface the VM is attached to.

internal_network

Get or set str value for ‘internalNetwork’ Name of the internal network the VM is attached to.

nat_network

Get or set str value for ‘NATNetwork’ Name of the NAT network the VM is attached to.

generic_driver

Get or set str value for ‘genericDriver’ Name of the driver to use for the “Generic” network attachment type.

cable_connected

Get or set bool value for ‘cableConnected’ Flag whether the adapter reports the cable as connected or not. It can be used to report offline situations to a VM.

line_speed

Get or set int value for ‘lineSpeed’ Line speed reported by custom drivers, in units of 1 kbps.

promisc_mode_policy

Get or set NetworkAdapterPromiscModePolicy value for ‘promiscModePolicy’ The promiscuous mode policy of the network adapter when attached to an internal network, host only network or a bridge.

trace_enabled

Get or set bool value for ‘traceEnabled’ Flag whether network traffic from/to the network card should be traced. Can only be toggled when the VM is turned off.

trace_file

Get or set str value for ‘traceFile’ Filename where a network trace will be stored. If not set, VBox-pid.pcap will be used.

nat_engine

Get INATEngine value for ‘NATEngine’ Points to the NAT engine which handles the network address translation for this interface. This is active only when the interface actually uses NAT.

boot_priority

Get or set int value for ‘bootPriority’ Network boot priority of the adapter. Priority 1 is highest. If not set, the priority is considered to be at the lowest possible setting.

bandwidth_group

Get or set IBandwidthGroup value for ‘bandwidthGroup’ The bandwidth group this network adapter is assigned to.

get_property(key)[source]

Returns the value of the network attachment property with the given name.

If the requested data @a key does not exist, this function will succeed and return an empty string in the @a value argument.

in key of type str
Name of the property to get.
return value of type str
Current property value.
raises OleErrorInvalidarg
@a name is @c null or empty.
set_property(key, value)[source]

Sets the value of the network attachment property with the given name.

Setting the property value to @c null or an empty string is equivalent to deleting the existing value.

in key of type str
Name of the property to set.
in value of type str
Property value to set.
raises OleErrorInvalidarg
@a name is @c null or empty.
get_properties(names)[source]

Returns values for a group of properties in one call.

The names of the properties to get are specified using the @a names argument which is a list of comma-separated property names or an empty string if all properties are to be returned. Currently the value of this argument is ignored and the method always returns all existing properties.

The method returns two arrays, the array of property names corresponding to the @a names argument and the current values of these properties. Both arrays have the same number of elements with each element at the given index in the first array corresponds to an element at the same index in the second array.

in names of type str
Names of properties to get.
out return_names of type str
Names of returned properties.
return return_values of type str
Values of returned properties.
class virtualbox.library.ISerialPort(interface=None)[source]

The ISerialPort interface represents the virtual serial port device.

The virtual serial port device acts like an ordinary serial port inside the virtual machine. This device communicates to the real serial port hardware in one of two modes: host pipe or host device.

In host pipe mode, the #path attribute specifies the path to the pipe on the host computer that represents a serial port. The #server attribute determines if this pipe is created by the virtual machine process at machine startup or it must already exist before starting machine execution.

In host device mode, the #path attribute specifies the name of the serial port device on the host computer.

There is also a third communication mode: the disconnected mode. In this mode, the guest OS running inside the virtual machine will be able to detect the serial port, but all port write operations will be discarded and all port read operations will return no data.

IMachine.get_serial_port()

slot

Get int value for ‘slot’ Slot number this serial port is plugged into. Corresponds to the value you pass to IMachine.get_serial_port() to obtain this instance.

enabled

Get or set bool value for ‘enabled’ Flag whether the serial port is enabled. If disabled, the serial port will not be reported to the guest OS.

io_base

Get or set int value for ‘IOBase’ Base I/O address of the serial port.

irq

Get or set int value for ‘IRQ’ IRQ number of the serial port.

host_mode

Get or set PortMode value for ‘hostMode’ How is this port connected to the host.

Changing this attribute may fail if the conditions for path() are not met.

server

Get or set bool value for ‘server’ Flag whether this serial port acts as a server (creates a new pipe on the host) or as a client (uses the existing pipe). This attribute is used only when host_mode() is PortMode_HostPipe or PortMode_TCP.

path

Get or set str value for ‘path’ Path to the serial port’s pipe on the host when ISerialPort.host_mode() is PortMode_HostPipe, the host serial device name when ISerialPort.host_mode() is PortMode_HostDevice or the TCP port (server) or hostname:port (client) when ISerialPort.host_mode() is PortMode_TCP. For those cases, setting a @c null or empty string as the attribute’s value is an error. Otherwise, the value of this property is ignored.

class virtualbox.library.IParallelPort(interface=None)[source]

The IParallelPort interface represents the virtual parallel port device.

The virtual parallel port device acts like an ordinary parallel port inside the virtual machine. This device communicates to the real parallel port hardware using the name of the parallel device on the host computer specified in the #path attribute.

Each virtual parallel port device is assigned a base I/O address and an IRQ number that will be reported to the guest operating system and used to operate the given parallel port from within the virtual machine.

IMachine.get_parallel_port()

slot

Get int value for ‘slot’ Slot number this parallel port is plugged into. Corresponds to the value you pass to IMachine.get_parallel_port() to obtain this instance.

enabled

Get or set bool value for ‘enabled’ Flag whether the parallel port is enabled. If disabled, the parallel port will not be reported to the guest OS.

io_base

Get or set int value for ‘IOBase’ Base I/O address of the parallel port.

irq

Get or set int value for ‘IRQ’ IRQ number of the parallel port.

path

Get or set str value for ‘path’ Host parallel device name. If this parallel port is enabled, setting a @c null or an empty string as this attribute’s value will result in the parallel port behaving as if not connected to any device.

class virtualbox.library.IMachineDebugger(interface=None)[source]

Takes a core dump of the guest.

See include/VBox/dbgfcorefmt.h for details on the file format.

dump_guest_core(filename, compression)[source]

Takes a core dump of the guest.

See include/VBox/dbgfcorefmt.h for details on the file format.

in filename of type str
The name of the output file. The file must not exist.
in compression of type str
Reserved for future compression method indicator.
dump_host_process_core(filename, compression)[source]

Takes a core dump of the VM process on the host.

This feature is not implemented in the 4.0.0 release but it may show up in a dot release.

in filename of type str
The name of the output file. The file must not exist.
in compression of type str
Reserved for future compression method indicator.
info(name, args)[source]

Interfaces with the info dumpers (DBGFInfo).

This feature is not implemented in the 4.0.0 release but it may show up in a dot release.

in name of type str
The name of the info item.
in args of type str
Arguments to the info dumper.
return info of type str
The into string.
inject_nmi()[source]

Inject an NMI into a running VT-x/AMD-V VM.

modify_log_groups(settings)[source]

Modifies the group settings of the debug or release logger.

in settings of type str
The group settings string. See iprt/log.h for details. To target the release logger, prefix the string with “release:”.
modify_log_flags(settings)[source]

Modifies the debug or release logger flags.

in settings of type str
The flags settings string. See iprt/log.h for details. To target the release logger, prefix the string with “release:”.
modify_log_destinations(settings)[source]

Modifies the debug or release logger destinations.

in settings of type str
The destination settings string. See iprt/log.h for details. To target the release logger, prefix the string with “release:”.
read_physical_memory(address, size)[source]

Reads guest physical memory, no side effects (MMIO++).

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

in address of type int
The guest physical address.
in size of type int
The number of bytes to read.
return bytes_p of type str
The bytes read.
write_physical_memory(address, size, bytes_p)[source]

Writes guest physical memory, access handles (MMIO++) are ignored.

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

in address of type int
The guest physical address.
in size of type int
The number of bytes to read.
in bytes_p of type str
The bytes to write.
read_virtual_memory(cpu_id, address, size)[source]

Reads guest virtual memory, no side effects (MMIO++).

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

in cpu_id of type int
The identifier of the Virtual CPU.
in address of type int
The guest virtual address.
in size of type int
The number of bytes to read.
return bytes_p of type str
The bytes read.
write_virtual_memory(cpu_id, address, size, bytes_p)[source]

Writes guest virtual memory, access handles (MMIO++) are ignored.

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

in cpu_id of type int
The identifier of the Virtual CPU.
in address of type int
The guest virtual address.
in size of type int
The number of bytes to read.
in bytes_p of type str
The bytes to write.
load_plug_in(name)[source]

Loads a DBGF plug-in.

in name of type str
The plug-in name or DLL. Special name ‘all’ loads all installed plug-ins.
return plug_in_name of type str
The name of the loaded plug-in.
unload_plug_in(name)[source]

Unloads a DBGF plug-in.

in name of type str
The plug-in name or DLL. Special name ‘all’ unloads all plug-ins.
detect_os()[source]

Tries to (re-)detect the guest OS kernel.

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

return os of type str
The detected OS kernel on success.
query_os_kernel_log(max_messages)[source]

Tries to get the kernel log (dmesg) of the guest OS.

in max_messages of type int
Max number of messages to return, counting from the end of the log. If 0, there is no limit.
return dmesg of type str
The kernel log.
get_register(cpu_id, name)[source]

Gets one register.

in cpu_id of type int
The identifier of the Virtual CPU.
in name of type str
The register name, case is ignored.
return value of type str
The register value. This is usually a hex value (always 0x prefixed) but other format may be used for floating point registers (TBD).
get_registers(cpu_id)[source]

Gets all the registers for the given CPU.

in cpu_id of type int
The identifier of the Virtual CPU.
out names of type str
Array containing the lowercase register names.
out values of type str
Array parallel to the names holding the register values as if the register was returned by IMachineDebugger.get_register() .
set_register(cpu_id, name, value)[source]

Gets one register.

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

in cpu_id of type int
The identifier of the Virtual CPU.
in name of type str
The register name, case is ignored.
in value of type str
The new register value. Hexadecimal, decimal and octal formattings are supported in addition to any special formattings returned by the getters.
set_registers(cpu_id, names, values)[source]

Sets zero or more registers atomically.

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

in cpu_id of type int
The identifier of the Virtual CPU.
in names of type str
Array containing the register names, case ignored.
in values of type str
Array paralell to the names holding the register values. See IMachineDebugger.set_register() for formatting guidelines.
dump_guest_stack(cpu_id)[source]

Produce a simple stack dump using the current guest state.

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

in cpu_id of type int
The identifier of the Virtual CPU.
return stack of type str
String containing the formatted stack dump.
reset_stats(pattern)[source]

Reset VM statistics.

in pattern of type str
The selection pattern. A bit similar to filename globbing.
dump_stats(pattern)[source]

Dumps VM statistics.

in pattern of type str
The selection pattern. A bit similar to filename globbing.
get_stats(pattern, with_descriptions)[source]

Get the VM statistics in a XMLish format.

in pattern of type str
The selection pattern. A bit similar to filename globbing.
in with_descriptions of type bool
Whether to include the descriptions.
return stats of type str
The XML document containing the statistics.
single_step

Get or set bool value for ‘singleStep’ Switch for enabling single-stepping.

recompile_user

Get or set bool value for ‘recompileUser’ Switch for forcing code recompilation for user mode code.

recompile_supervisor

Get or set bool value for ‘recompileSupervisor’ Switch for forcing code recompilation for supervisor mode code.

execute_all_in_iem

Get or set bool value for ‘executeAllInIEM’ Whether to execute all the code in the instruction interpreter. This is mainly for testing the interpreter and not an execution mode intended for general consumption.

patm_enabled

Get or set bool value for ‘PATMEnabled’ Switch for enabling and disabling the PATM component.

csam_enabled

Get or set bool value for ‘CSAMEnabled’ Switch for enabling and disabling the CSAM component.

log_enabled

Get or set bool value for ‘logEnabled’ Switch for enabling and disabling the debug logger.

log_dbg_flags

Get str value for ‘logDbgFlags’ The debug logger flags.

log_dbg_groups

Get str value for ‘logDbgGroups’ The debug logger’s group settings.

log_dbg_destinations

Get str value for ‘logDbgDestinations’ The debug logger’s destination settings.

log_rel_flags

Get str value for ‘logRelFlags’ The release logger flags.

log_rel_groups

Get str value for ‘logRelGroups’ The release logger’s group settings.

log_rel_destinations

Get str value for ‘logRelDestinations’ The relase logger’s destination settings.

hw_virt_ex_enabled

Get bool value for ‘HWVirtExEnabled’ Flag indicating whether the VM is currently making use of CPU hardware virtualization extensions.

hw_virt_ex_nested_paging_enabled

Get bool value for ‘HWVirtExNestedPagingEnabled’ Flag indicating whether the VM is currently making use of the nested paging CPU hardware virtualization extension.

hw_virt_ex_vpid_enabled

Get bool value for ‘HWVirtExVPIDEnabled’ Flag indicating whether the VM is currently making use of the VPID VT-x extension.

hw_virt_ex_ux_enabled

Get bool value for ‘HWVirtExUXEnabled’ Flag indicating whether the VM is currently making use of the unrestricted execution feature of VT-x.

os_name

Get str value for ‘OSName’ Query the guest OS kernel name as detected by the DBGF.

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

os_version

Get str value for ‘OSVersion’ Query the guest OS kernel version string as detected by the DBGF.

This feature is not implemented in the 4.0.0 release but may show up in a dot release.

pae_enabled

Get bool value for ‘PAEEnabled’ Flag indicating whether the VM is currently making use of the Physical Address Extension CPU feature.

virtual_time_rate

Get or set int value for ‘virtualTimeRate’ The rate at which the virtual time runs expressed as a percentage. The accepted range is 2% to 20000%.

vm

Get int value for ‘VM’ Gets the user-mode VM handle, with a reference. Must be passed to VMR3ReleaseUVM when done. This is only for internal use while we carve the details of this interface.

uptime

Get int value for ‘uptime’ VM uptime in milliseconds, i.e. time in which it could have been executing guest code. Excludes the time when the VM was paused.

class virtualbox.library.IUSBDeviceFilters(interface=None)[source]

List of USB device filters associated with the machine.

If the machine is currently running, these filters are activated every time a new (supported) USB device is attached to the host computer that was not ignored by global filters (IHost.usb_device_filters() ).

These filters are also activated when the machine is powered up. They are run against a list of all currently available USB devices (in states USBDeviceState.available , USBDeviceState.busy , USBDeviceState.held ) that were not previously ignored by global filters.

If at least one filter matches the USB device in question, this device is automatically captured (attached to) the virtual USB controller of this machine.

IUSBDeviceFilter , IUSBController

device_filters

Get IUSBDeviceFilter value for ‘deviceFilters’ List of USB device filters associated with the machine.

If the machine is currently running, these filters are activated every time a new (supported) USB device is attached to the host computer that was not ignored by global filters (IHost.usb_device_filters() ).

These filters are also activated when the machine is powered up. They are run against a list of all currently available USB devices (in states USBDeviceState.available , USBDeviceState.busy , USBDeviceState.held ) that were not previously ignored by global filters.

If at least one filter matches the USB device in question, this device is automatically captured (attached to) the virtual USB controller of this machine.

IUSBDeviceFilter , IUSBController

create_device_filter(name)[source]

Creates a new USB device filter. All attributes except the filter name are set to empty (any match), active is @c false (the filter is not active).

The created filter can then be added to the list of filters using insert_device_filter() .

device_filters()

in name of type str
Filter name. See IUSBDeviceFilter.name() for more info.
return filter_p of type IUSBDeviceFilter
Created filter object.
raises VBoxErrorInvalidVmState
The virtual machine is not mutable.
insert_device_filter(position, filter_p)[source]

Inserts the given USB device to the specified position in the list of filters.

Positions are numbered starting from 0. If the specified position is equal to or greater than the number of elements in the list, the filter is added to the end of the collection.

Duplicates are not allowed, so an attempt to insert a filter that is already in the collection, will return an error.

device_filters()

in position of type int
Position to insert the filter to.
in filter_p of type IUSBDeviceFilter
USB device filter to insert.
raises VBoxErrorInvalidVmState
Virtual machine is not mutable.
raises OleErrorInvalidarg
USB device filter not created within this VirtualBox instance.
raises VBoxErrorInvalidObjectState
USB device filter already in list.
remove_device_filter(position)[source]

Removes a USB device filter from the specified position in the list of filters.

Positions are numbered starting from 0. Specifying a position equal to or greater than the number of elements in the list will produce an error.

device_filters()

in position of type int
Position to remove the filter from.
return filter_p of type IUSBDeviceFilter
Removed USB device filter.
raises VBoxErrorInvalidVmState
Virtual machine is not mutable.
raises OleErrorInvalidarg
USB device filter list empty or invalid @a position.
class virtualbox.library.IUSBController(interface=None)[source]

The USB Controller name.

name

Get or set str value for ‘name’ The USB Controller name.

type_p

Get or set USBControllerType value for ‘type’ The USB Controller type.

usb_standard

Get int value for ‘USBStandard’ USB standard version which the controller implements. This is a BCD which means that the major version is in the high byte and minor version is in the low byte.

class virtualbox.library.IUSBDevice(interface=None)[source]

The IUSBDevice interface represents a virtual USB device attached to the virtual machine.

A collection of objects implementing this interface is stored in the IConsole.usb_devices() attribute which lists all USB devices attached to a running virtual machine’s USB controller.

id_p

Get str value for ‘id’ Unique USB device ID. This ID is built from #vendorId, #productId, #revision and #serialNumber.

vendor_id

Get int value for ‘vendorId’ Vendor ID.

product_id

Get int value for ‘productId’ Product ID.

revision

Get int value for ‘revision’ Product revision number. This is a packed BCD represented as unsigned short. The high byte is the integer part and the low byte is the decimal.

manufacturer

Get str value for ‘manufacturer’ Manufacturer string.

product

Get str value for ‘product’ Product string.

serial_number

Get str value for ‘serialNumber’ Serial number string.

address

Get str value for ‘address’ Host specific address of the device.

port

Get int value for ‘port’ Host USB port number the device is physically connected to.

version

Get int value for ‘version’ The major USB version of the device - 1, 2 or 3.

port_version

Get int value for ‘portVersion’ The major USB version of the host USB port the device is physically connected to - 1, 2 or 3. For devices not connected to anything this will have the same value as the version attribute.

speed

Get USBConnectionSpeed value for ‘speed’ The speed at which the device is currently communicating.

remote

Get bool value for ‘remote’ Whether the device is physically connected to a remote VRDE client or to a local host machine.

device_info

Get str value for ‘deviceInfo’ Array of device attributes as single strings.

So far the following are used: 0: The manufacturer string, if the device doesn’t expose the ID one is taken from an internal database or an empty string if none is found. 1: The product string, if the device doesn’t expose the ID one is taken from an internal database or an empty string if none is found.

backend

Get str value for ‘backend’ The backend which will be used to communicate with this device.

class virtualbox.library.IUSBDeviceFilter(interface=None)[source]

The IUSBDeviceFilter interface represents an USB device filter used to perform actions on a group of USB devices.

This type of filters is used by running virtual machines to automatically capture selected USB devices once they are physically attached to the host computer.

A USB device is matched to the given device filter if and only if all attributes of the device match the corresponding attributes of the filter (that is, attributes are joined together using the logical AND operation). On the other hand, all together, filters in the list of filters carry the semantics of the logical OR operation. So if it is desirable to create a match like “this vendor id OR this product id”, one needs to create two filters and specify “any match” (see below) for unused attributes.

All filter attributes used for matching are strings. Each string is an expression representing a set of values of the corresponding device attribute, that will match the given filter. Currently, the following filtering expressions are supported:

Interval filters. Used to specify valid intervals for integer device attributes (Vendor ID, Product ID and Revision). The format of the string is:

int:((m)|([m]-[n]))(,(m)|([m]-[n]))*

where m and n are integer numbers, either in octal (starting from 0), hexadecimal (starting from 0x) or decimal (otherwise) form, so that m < n. If m is omitted before a dash (-), the minimum possible integer is assumed; if n is omitted after a dash, the maximum possible integer is assumed.

Boolean filters. Used to specify acceptable values for boolean device attributes. The format of the string is:

true|false|yes|no|0|1

Exact match. Used to specify a single value for the given device attribute. Any string that doesn’t start with int: represents the exact match. String device attributes are compared to this string including case of symbols. Integer attributes are first converted to a string (see individual filter attributes) and then compared ignoring case.

Any match. Any value of the corresponding device attribute will match the given filter. An empty or @c null string is used to construct this type of filtering expressions.

On the Windows host platform, interval filters are not currently available. Also all string filter attributes (manufacturer() , product() , serial_number() ) are ignored, so they behave as any match no matter what string expression is specified.

IUSBDeviceFilters.device_filters() , IHostUSBDeviceFilter

name

Get or set str value for ‘name’ Visible name for this filter. This name is used to visually distinguish one filter from another, so it can neither be @c null nor an empty string.

active

Get or set bool value for ‘active’ Whether this filter active or has been temporarily disabled.

vendor_id

Get or set str value for ‘vendorId’ IUSBDevice.vendor_id() Vendor ID filter. The string representation for the exact matching has the form XXXX, where X is the hex digit (including leading zeroes).

product_id

Get or set str value for ‘productId’ IUSBDevice.product_id() Product ID filter. The string representation for the exact matching has the form XXXX, where X is the hex digit (including leading zeroes).

revision

Get or set str value for ‘revision’ IUSBDevice.product_id() Product revision number filter. The string representation for the exact matching has the form IIFF, where I is the decimal digit of the integer part of the revision, and F is the decimal digit of its fractional part (including leading and trailing zeros). Note that for interval filters, it’s best to use the hexadecimal form, because the revision is stored as a 16 bit packed BCD value; so the expression int:0x0100-0x0199 will match any revision from 1.0 to 1.99.

manufacturer

Get or set str value for ‘manufacturer’ IUSBDevice.manufacturer() Manufacturer filter.

product

Get or set str value for ‘product’ IUSBDevice.product() Product filter.

serial_number

Get or set str value for ‘serialNumber’ IUSBDevice.serial_number() Serial number filter.

port

Get or set str value for ‘port’ IUSBDevice.port() Host USB port filter.

remote

Get or set str value for ‘remote’ IUSBDevice.remote() Remote state filter.

This filter makes sense only for machine USB filters, i.e. it is ignored by IHostUSBDeviceFilter objects.

masked_interfaces

Get or set int value for ‘maskedInterfaces’ This is an advanced option for hiding one or more USB interfaces from the guest. The value is a bit mask where the bits that are set means the corresponding USB interface should be hidden, masked off if you like. This feature only works on Linux hosts.

class virtualbox.library.IHostUSBDevice(interface=None)[source]

The IHostUSBDevice interface represents a physical USB device attached to the host computer.

Besides properties inherited from IUSBDevice, this interface adds the state() property that holds the current state of the USB device.

IHost.usb_devices() , IHost.usb_device_filters()

state

Get USBDeviceState value for ‘state’ Current state of the device.

class virtualbox.library.IHostUSBDeviceFilter(interface=None)[source]

The IHostUSBDeviceFilter interface represents a global filter for a physical USB device used by the host computer. Used indirectly in IHost.usb_device_filters() .

Using filters of this type, the host computer determines the initial state of the USB device after it is physically attached to the host’s USB controller.

The IUSBDeviceFilter.remote() attribute is ignored by this type of filters, because it makes sense only for IUSBDeviceFilters.device_filters() machine USB filters.

IHost.usb_device_filters()

action

Get or set USBDeviceFilterAction value for ‘action’ Action performed by the host when an attached USB device matches this filter.

class virtualbox.library.IUSBProxyBackend(interface=None)[source]

The USBProxyBackend interface represents a source for USB devices available to the host for attaching to the VM.

name

Get str value for ‘name’ The unique name of the proxy backend.

type_p

Get str value for ‘type’ The type of the backend.

class virtualbox.library.IAudioAdapter(interface=None)[source]

The IAudioAdapter interface represents the virtual audio adapter of the virtual machine. Used in IMachine.audio_adapter() .

enabled

Get or set bool value for ‘enabled’ Flag whether the audio adapter is present in the guest system. If disabled, the virtual guest hardware will not contain any audio adapter. Can only be changed when the VM is not running.

enabled_in

Get or set bool value for ‘enabledIn’ Flag whether the audio adapter is enabled for audio input. Only relevant if the adapter is enabled.

enabled_out

Get or set bool value for ‘enabledOut’ Flag whether the audio adapter is enabled for audio output. Only relevant if the adapter is enabled.

audio_controller

Get or set AudioControllerType value for ‘audioController’ The emulated audio controller.

audio_codec

Get or set AudioCodecType value for ‘audioCodec’ The exact variant of audio codec hardware presented to the guest. For HDA and SB16, only one variant is available, but for AC‘97, there are several.

audio_driver

Get or set AudioDriverType value for ‘audioDriver’ Audio driver the adapter is connected to. This setting can only be changed when the VM is not running.

properties_list

Get str value for ‘propertiesList’ Array of names of tunable properties, which can be supported by audio driver.

set_property(key, value)[source]

Sets an audio specific property string.

If you pass @c null or empty string as a key @a value, the given @a key will be deleted.

in key of type str
Name of the key to set.
in value of type str
Value to assign to the key.
get_property(key)[source]

Returns an audio specific property string.

If the requested data @a key does not exist, this function will succeed and return an empty string in the @a value argument.

in key of type str
Name of the key to get.
return value of type str
Value of the requested key.
class virtualbox.library.IVRDEServer(interface=None)[source]

Flag if VRDE server is enabled.

enabled

Get or set bool value for ‘enabled’ Flag if VRDE server is enabled.

auth_type

Get or set AuthType value for ‘authType’ VRDE authentication method.

auth_timeout

Get or set int value for ‘authTimeout’ Timeout for guest authentication. Milliseconds.

allow_multi_connection

Get or set bool value for ‘allowMultiConnection’ Flag whether multiple simultaneous connections to the VM are permitted. Note that this will be replaced by a more powerful mechanism in the future.

reuse_single_connection

Get or set bool value for ‘reuseSingleConnection’ Flag whether the existing connection must be dropped and a new connection must be established by the VRDE server, when a new client connects in single connection mode.

vrde_ext_pack

Get or set str value for ‘VRDEExtPack’ The name of Extension Pack providing VRDE for this VM. Overrides ISystemProperties.default_vrde_ext_pack() .

auth_library

Get or set str value for ‘authLibrary’ Library used for authentication of RDP clients by this VM. Overrides ISystemProperties.vrde_auth_library() .

vrde_properties

Get str value for ‘VRDEProperties’ Array of names of properties, which are supported by this VRDE server.

set_vrde_property(key, value)[source]

Sets a VRDE specific property string.

If you pass @c null or empty string as a key @a value, the given @a key will be deleted.

in key of type str
Name of the key to set.
in value of type str
Value to assign to the key.
get_vrde_property(key)[source]

Returns a VRDE specific property string.

If the requested data @a key does not exist, this function will succeed and return an empty string in the @a value argument.

in key of type str
Name of the key to get.
return value of type str
Value of the requested key.
class virtualbox.library.ISharedFolder(interface=None)[source]

The ISharedFolder interface represents a folder in the host computer’s file system accessible from the guest OS running inside a virtual machine using an associated logical name.

There are three types of shared folders:

Global (IVirtualBox.shared_folders() ), shared folders available to all virtual machines. Permanent (IMachine.shared_folders() ), VM-specific shared folders available to the given virtual machine at startup. Transient (IConsole.shared_folders() ), VM-specific shared folders created in the session context (for example, when the virtual machine is running) and automatically discarded when the session is closed (the VM is powered off).

Logical names of shared folders must be unique within the given scope (global, permanent or transient). However, they do not need to be unique across scopes. In this case, the definition of the shared folder in a more specific scope takes precedence over definitions in all other scopes. The order of precedence is (more specific to more general):

Transient definitions Permanent definitions Global definitions

For example, if MyMachine has a shared folder named C_DRIVE (that points to C:), then creating a transient shared folder named C_DRIVE (that points to C:\WINDOWS) will change the definition of C_DRIVE in the guest OS so that \VBOXSVRC_DRIVE will give access to C:WINDOWS instead of C:on the host PC. Removing the transient shared folder C_DRIVE will restore the previous (permanent) definition of C_DRIVE that points to C:if it still exists.

Note that permanent and transient shared folders of different machines are in different name spaces, so they don’t overlap and don’t need to have unique logical names.

Global shared folders are not implemented in the current version of the product.

name

Get str value for ‘name’ Logical name of the shared folder.

host_path

Get str value for ‘hostPath’ Full path to the shared folder in the host file system.

accessible

Get bool value for ‘accessible’ Whether the folder defined by the host path is currently accessible or not. For example, the folder can be inaccessible if it is placed on the network share that is not available by the time this property is read.

writable

Get bool value for ‘writable’ Whether the folder defined by the host path is writable or not.

auto_mount

Get bool value for ‘autoMount’ Whether the folder gets automatically mounted by the guest or not.

last_access_error

Get str value for ‘lastAccessError’ Text message that represents the result of the last accessibility check.

Accessibility checks are performed each time the accessible() attribute is read. An empty string is returned if the last accessibility check was successful. A non-empty string indicates a failure and should normally describe a reason of the failure (for example, a file read error).

class virtualbox.library.IInternalSessionControl(interface=None)[source]

PID of the process that has created this Session object.

pid

Get int value for ‘PID’ PID of the process that has created this Session object.

remote_console

Get IConsole value for ‘remoteConsole’ Returns the console object suitable for remote control.

nominal_state

Get MachineState value for ‘nominalState’ Returns suitable machine state for the VM execution state. Useful for choosing a sensible machine state after a complex operation which failed or otherwise resulted in an unclear situation.

assign_machine(machine, lock_type, token)[source]

Assigns the machine object associated with this direct-type session or informs the session that it will be a remote one (if @a machine == @c null).

in machine of type IMachine

in lock_type of type LockType

in token of type IToken

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
assign_remote_machine(machine, console)[source]

Assigns the machine and the (remote) console object associated with this remote-type session.

in machine of type IMachine

in console of type IConsole

raises VBoxErrorInvalidVmState
Session state prevents operation.
update_machine_state(machine_state)[source]

Updates the machine state in the VM process. Must be called only in certain cases (see the method implementation).

in machine_state of type MachineState

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
uninitialize()[source]

Uninitializes (closes) this session. Used by VirtualBox to close the corresponding remote session when the direct session dies or gets closed.

raises VBoxErrorInvalidVmState
Session state prevents operation.
on_network_adapter_change(network_adapter, change_adapter)[source]

Triggered when settings of a network adapter of the associated virtual machine have changed.

in network_adapter of type INetworkAdapter

in change_adapter of type bool

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_serial_port_change(serial_port)[source]

Triggered when settings of a serial port of the associated virtual machine have changed.

in serial_port of type ISerialPort

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_parallel_port_change(parallel_port)[source]

Triggered when settings of a parallel port of the associated virtual machine have changed.

in parallel_port of type IParallelPort

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_storage_controller_change()[source]

Triggered when settings of a storage controller of the associated virtual machine have changed.

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_medium_change(medium_attachment, force)[source]

Triggered when attached media of the associated virtual machine have changed.

in medium_attachment of type IMediumAttachment
The medium attachment which changed.
in force of type bool
If the medium change was forced.
raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_storage_device_change(medium_attachment, remove, silent)[source]

Triggered when attached storage devices of the associated virtual machine have changed.

in medium_attachment of type IMediumAttachment
The medium attachment which changed.
in remove of type bool
TRUE if the device is removed, FALSE if it was added.
in silent of type bool
TRUE if the device is is silently reconfigured without notifying the guest about it.
raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_clipboard_mode_change(clipboard_mode)[source]

Notification when the shared clipboard mode changes.

in clipboard_mode of type ClipboardMode
The new shared clipboard mode.
on_dn_d_mode_change(dnd_mode)[source]

Notification when the drag’n drop mode changes.

in dnd_mode of type DnDMode
The new mode for drag’n drop.
on_cpu_change(cpu, add)[source]

Notification when a CPU changes.

in cpu of type int
The CPU which changed
in add of type bool
Flag whether the CPU was added or removed
on_cpu_execution_cap_change(execution_cap)[source]

Notification when the CPU execution cap changes.

in execution_cap of type int
The new CPU execution cap value. (1-100)
on_vrde_server_change(restart)[source]

Triggered when settings of the VRDE server object of the associated virtual machine have changed.

in restart of type bool
Flag whether the server must be restarted
raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_video_capture_change()[source]

Triggered when video capture settings have changed.

on_usb_controller_change()[source]

Triggered when settings of the USB controller object of the associated virtual machine have changed.

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_shared_folder_change(global_p)[source]

Triggered when a permanent (global or machine) shared folder has been created or removed.

We don’t pass shared folder parameters in this notification because the order in which parallel notifications are delivered is not defined, therefore it could happen that these parameters were outdated by the time of processing this notification.

in global_p of type bool

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_usb_device_attach(device, error, masked_interfaces, capture_filename)[source]

Triggered when a request to capture a USB device (as a result of matched USB filters or direct call to IConsole.attach_usb_device() ) has completed. A @c null @a error object means success, otherwise it describes a failure.

in device of type IUSBDevice

in error of type IVirtualBoxErrorInfo

in masked_interfaces of type int

in capture_filename of type str

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_usb_device_detach(id_p, error)[source]

Triggered when a request to release the USB device (as a result of machine termination or direct call to IConsole.detach_usb_device() ) has completed. A @c null @a error object means success, otherwise it describes a failure.

in id_p of type str

in error of type IVirtualBoxErrorInfo

raises VBoxErrorInvalidVmState
Session state prevents operation.
raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_show_window(check)[source]

Called by IMachine.can_show_console_window() and by IMachine.show_console_window() in order to notify console listeners ICanShowWindowEvent and IShowWindowEvent .

in check of type bool

out can_show of type bool

out win_id of type int

raises VBoxErrorInvalidObjectState
Session type prevents operation.
on_bandwidth_group_change(bandwidth_group)[source]

Notification when one of the bandwidth groups change.

in bandwidth_group of type IBandwidthGroup
The bandwidth group which changed.
access_guest_property(name, value, flags, access_mode)[source]

Called by IMachine.get_guest_property() and by IMachine.set_guest_property() in order to read and modify guest properties.

in name of type str

in value of type str

in flags of type str

in access_mode of type int
0 = get, 1 = set, 2 = delete.

out ret_value of type str

out ret_timestamp of type int

out ret_flags of type str

raises VBoxErrorInvalidVmState
Machine session is not open.
raises VBoxErrorInvalidObjectState
Session type is not direct.
enumerate_guest_properties(patterns)[source]

Return a list of the guest properties matching a set of patterns along with their values, time stamps and flags.

in patterns of type str
The patterns to match the properties against as a comma-separated string. If this is empty, all properties currently set will be returned.
out keys of type str
The key names of the properties returned.
out values of type str
The values of the properties returned. The array entries match the corresponding entries in the @a key array.
out timestamps of type int
The time stamps of the properties returned. The array entries match the corresponding entries in the @a key array.
out flags of type str
The flags of the properties returned. The array entries match the corresponding entries in the @a key array.
raises VBoxErrorInvalidVmState
Machine session is not open.
raises VBoxErrorInvalidObjectState
Session type is not direct.
online_merge_medium(medium_attachment, source_idx, target_idx, progress)[source]

Triggers online merging of a hard disk. Used internally when deleting a snapshot while a VM referring to the same hard disk chain is running.

in medium_attachment of type IMediumAttachment
The medium attachment to identify the medium chain.
in source_idx of type int
The index of the source image in the chain. Redundant, but drastically reduces IPC.
in target_idx of type int
The index of the target image in the chain. Redundant, but drastically reduces IPC.
in progress of type IProgress
Progress object for this operation.
raises VBoxErrorInvalidVmState
Machine session is not open.
raises VBoxErrorInvalidObjectState
Session type is not direct.
reconfigure_medium_attachments(attachments)[source]

Reconfigure all specified medium attachments in one go, making sure the current state corresponds to the specified medium.

in attachments of type IMediumAttachment
Array containing the medium attachments which need to be reconfigured.
raises VBoxErrorInvalidVmState
Machine session is not open.
raises VBoxErrorInvalidObjectState
Session type is not direct.
enable_vmm_statistics(enable)[source]

Enables or disables collection of VMM RAM statistics.

in enable of type bool
True enables statistics collection.
raises VBoxErrorInvalidVmState
Machine session is not open.
raises VBoxErrorInvalidObjectState
Session type is not direct.
pause_with_reason(reason)[source]

Internal method for triggering a VM pause with a specified reason code. The reason code can be interpreted by device/drivers and thus it might behave slightly differently than a normal VM pause.

IConsole.pause()

in reason of type Reason
Specify the best matching reason code please.
raises VBoxErrorInvalidVmState
Virtual machine not in Running state.
raises VBoxErrorVmError
Virtual machine error in suspend operation.
resume_with_reason(reason)[source]

Internal method for triggering a VM resume with a specified reason code. The reason code can be interpreted by device/drivers and thus it might behave slightly differently than a normal VM resume.

IConsole.resume()

in reason of type Reason
Specify the best matching reason code please.
raises VBoxErrorInvalidVmState
Virtual machine not in Paused state.
raises VBoxErrorVmError
Virtual machine error in resume operation.
save_state_with_reason(reason, progress, state_file_path, pause_vm)[source]

Internal method for triggering a VM save state with a specified reason code. The reason code can be interpreted by device/drivers and thus it might behave slightly differently than a normal VM save state.

This call is fully synchronous, and the caller is expected to have set the machine state appropriately (and has to set the follow-up machine state if this call failed).

IMachine.save_state()

in reason of type Reason
Specify the best matching reason code please.
in progress of type IProgress
Progress object to track the operation completion.
in state_file_path of type str
File path the VM process must save the execution state to.
in pause_vm of type bool
The VM should be paused before saving state. It is automatically unpaused on error in the “vanilla save state” case.
return left_paused of type bool
Returns if the VM was left in paused state, which is necessary in many situations (snapshots, teleportation).
raises VBoxErrorInvalidVmState
Virtual machine state is not one of the expected values.
raises VBoxErrorFileError
Failed to create directory for saved state file.
cancel_save_state_with_reason()[source]

Internal method for cancelling a VM save state. IInternalSessionControl.save_state_with_reason()

class virtualbox.library.IStorageController(interface=None)[source]

Represents a storage controller that is attached to a virtual machine (IMachine ). Just as drives (hard disks, DVDs, FDs) are attached to storage controllers in a real computer, virtual drives (represented by IMediumAttachment ) are attached to virtual storage controllers, represented by this interface.

As opposed to physical hardware, VirtualBox has a very generic concept of a storage controller, and for purposes of the Main API, all virtual storage is attached to virtual machines via instances of this interface. There are five types of such virtual storage controllers: IDE, SCSI, SATA, SAS and Floppy (see bus() ). Depending on which of these four is used, certain sub-types may be available and can be selected in controller_type() .

Depending on these settings, the guest operating system might see significantly different virtual hardware.

name

Get or set str value for ‘name’ Name of the storage controller, as originally specified with IMachine.add_storage_controller() . This then uniquely identifies this controller with other method calls such as IMachine.attach_device() and IMachine.mount_medium() .

max_devices_per_port_count

Get int value for ‘maxDevicesPerPortCount’ Maximum number of devices which can be attached to one port.

min_port_count

Get int value for ‘minPortCount’ Minimum number of ports that IStorageController.port_count() can be set to.

max_port_count

Get int value for ‘maxPortCount’ Maximum number of ports that IStorageController.port_count() can be set to.

instance

Get or set int value for ‘instance’ The instance number of the device in the running VM.

port_count

Get or set int value for ‘portCount’ The number of currently usable ports on the controller. The minimum and maximum number of ports for one controller are stored in IStorageController.min_port_count() and IStorageController.max_port_count() .

bus

Get StorageBus value for ‘bus’ The bus type of the storage controller (IDE, SATA, SCSI, SAS or Floppy).

controller_type

Get or set StorageControllerType value for ‘controllerType’ The exact variant of storage controller hardware presented to the guest. Depending on this value, VirtualBox will provide a different virtual storage controller hardware to the guest. For SATA, SAS and floppy controllers, only one variant is available, but for IDE and SCSI, there are several.

For SCSI controllers, the default type is LsiLogic.

use_host_io_cache

Get or set bool value for ‘useHostIOCache’ If true, the storage controller emulation will use a dedicated I/O thread, enable the host I/O caches and use synchronous file APIs on the host. This was the only option in the API before VirtualBox 3.2 and is still the default for IDE controllers.

If false, the host I/O cache will be disabled for image files attached to this storage controller. Instead, the storage controller emulation will use asynchronous I/O APIs on the host. This makes it possible to turn off the host I/O caches because the emulation can handle unaligned access to the file. This should be used on OS X and Linux hosts if a high I/O load is expected or many virtual machines are running at the same time to prevent I/O cache related hangs. This option new with the API of VirtualBox 3.2 and is now the default for non-IDE storage controllers.

bootable

Get bool value for ‘bootable’ Returns whether it is possible to boot from disks attached to this controller.

class virtualbox.library.IPerformanceMetric(interface=None)[source]

The IPerformanceMetric interface represents parameters of the given performance metric.

metric_name

Get str value for ‘metricName’ Name of the metric.

object_p

Get Interface value for ‘object’ Object this metric belongs to.

description

Get str value for ‘description’ Textual description of the metric.

period

Get int value for ‘period’ Time interval between samples, measured in seconds.

count

Get int value for ‘count’ Number of recent samples retained by the performance collector for this metric.

When the collected sample count exceeds this number, older samples are discarded.

unit

Get str value for ‘unit’ Unit of measurement.

minimum_value

Get int value for ‘minimumValue’ Minimum possible value of this metric.

maximum_value

Get int value for ‘maximumValue’ Maximum possible value of this metric.

class virtualbox.library.IPerformanceCollector(interface=None)[source]

The IPerformanceCollector interface represents a service that collects and stores performance metrics data.

Performance metrics are associated with objects of interfaces like IHost and IMachine. Each object has a distinct set of performance metrics. The set can be obtained with IPerformanceCollector.get_metrics() .

Metric data is collected at the specified intervals and is retained internally. The interval and the number of retained samples can be set with IPerformanceCollector.setup_metrics() . Both metric data and collection settings are not persistent, they are discarded as soon as VBoxSVC process terminates. Moreover, metric settings and data associated with a particular VM only exist while VM is running. They disappear as soon as VM shuts down. It is not possible to set up metrics for machines that are powered off. One needs to start VM first, then set up metric collection parameters.

Metrics are organized hierarchically, with each level separated by a slash (/) character. Generally, the scheme for metric names is like this:

Category/Metric[/SubMetric][:aggregation]

“Category/Metric” together form the base metric name. A base metric is the smallest unit for which a sampling interval and the number of retained samples can be set. Only base metrics can be enabled and disabled. All sub-metrics are collected when their base metric is collected. Collected values for any set of sub-metrics can be queried with IPerformanceCollector.query_metrics_data() .

For example “CPU/Load/User:avg” metric name stands for the “CPU” category, “Load” metric, “User” submetric, “average” aggregate. An aggregate function is computed over all retained data. Valid aggregate functions are:

avg – average min – minimum max – maximum

When setting up metric parameters, querying metric data, enabling or disabling metrics wildcards can be used in metric names to specify a subset of metrics. For example, to select all CPU-related metrics use CPU/*, all averages can be queried using *:avg and so on. To query metric values without aggregates *: can be used.

The valid names for base metrics are:

CPU/Load CPU/MHz RAM/Usage RAM/VMM

The general sequence for collecting and retrieving the metrics is:

Obtain an instance of IPerformanceCollector with IVirtualBox.performance_collector()

Allocate and populate an array with references to objects the metrics will be collected for. Use references to IHost and IMachine objects.

Allocate and populate an array with base metric names the data will be collected for.

Call IPerformanceCollector.setup_metrics() . From now on the metric data will be collected and stored.

Wait for the data to get collected.

Allocate and populate an array with references to objects the metric values will be queried for. You can re-use the object array used for setting base metrics.

Allocate and populate an array with metric names the data will be collected for. Note that metric names differ from base metric names.

Call IPerformanceCollector.query_metrics_data() . The data that have been collected so far are returned. Note that the values are still retained internally and data collection continues.

For an example of usage refer to the following files in VirtualBox SDK:

Java: bindings/webservice/java/jax-ws/samples/metrictest.java

Python: bindings/xpcom/python/sample/shellcommon.py

metric_names

Get str value for ‘metricNames’ Array of unique names of metrics.

This array represents all metrics supported by the performance collector. Individual objects do not necessarily support all of them. IPerformanceCollector.get_metrics() can be used to get the list of supported metrics for a particular object.

get_metrics(metric_names, objects)[source]

Returns parameters of specified metrics for a set of objects.

@c Null metrics array means all metrics. @c Null object array means all existing objects.

in metric_names of type str
Metric name filter. Currently, only a comma-separated list of metrics is supported.
in objects of type Interface
Set of objects to return metric parameters for.
return metrics of type IPerformanceMetric
Array of returned metric parameters.
setup_metrics(metric_names, objects, period, count)[source]

Sets parameters of specified base metrics for a set of objects. Returns an array of IPerformanceMetric describing the metrics have been affected.

@c Null or empty metric name array means all metrics. @c Null or empty object array means all existing objects. If metric name array contains a single element and object array contains many, the single metric name array element is applied to each object array element to form metric/object pairs.

in metric_names of type str
Metric name filter. Comma-separated list of metrics with wildcard support.
in objects of type Interface
Set of objects to setup metric parameters for.
in period of type int
Time interval in seconds between two consecutive samples of performance data.
in count of type int
Number of samples to retain in performance data history. Older samples get discarded.
return affected_metrics of type IPerformanceMetric
Array of metrics that have been modified by the call to this method.
enable_metrics(metric_names, objects)[source]

Turns on collecting specified base metrics. Returns an array of IPerformanceMetric describing the metrics have been affected.

@c Null or empty metric name array means all metrics. @c Null or empty object array means all existing objects. If metric name array contains a single element and object array contains many, the single metric name array element is applied to each object array element to form metric/object pairs.

in metric_names of type str
Metric name filter. Comma-separated list of metrics with wildcard support.
in objects of type Interface
Set of objects to enable metrics for.
return affected_metrics of type IPerformanceMetric
Array of metrics that have been modified by the call to this method.
disable_metrics(metric_names, objects)[source]

Turns off collecting specified base metrics. Returns an array of IPerformanceMetric describing the metrics have been affected.

@c Null or empty metric name array means all metrics. @c Null or empty object array means all existing objects. If metric name array contains a single element and object array contains many, the single metric name array element is applied to each object array element to form metric/object pairs.

in metric_names of type str
Metric name filter. Comma-separated list of metrics with wildcard support.
in objects of type Interface
Set of objects to disable metrics for.
return affected_metrics of type IPerformanceMetric
Array of metrics that have been modified by the call to this method.
query_metrics_data(metric_names, objects)[source]

Queries collected metrics data for a set of objects.

The data itself and related metric information are returned in seven parallel and one flattened array of arrays. Elements of returnMetricNames, returnObjects, returnUnits, returnScales, returnSequenceNumbers, returnDataIndices and returnDataLengths with the same index describe one set of values corresponding to a single metric.

The returnData parameter is a flattened array of arrays. Each start and length of a sub-array is indicated by returnDataIndices and returnDataLengths. The first value for metric metricNames[i] is at returnData[returnIndices[i]].

@c Null or empty metric name array means all metrics. @c Null or empty object array means all existing objects. If metric name array contains a single element and object array contains many, the single metric name array element is applied to each object array element to form metric/object pairs.

Data collection continues behind the scenes after call to @c queryMetricsData. The return data can be seen as the snapshot of the current state at the time of @c queryMetricsData call. The internally kept metric values are not cleared by the call. This allows querying different subsets of metrics or aggregates with subsequent calls. If periodic querying is needed it is highly suggested to query the values with @c interval*count period to avoid confusion. This way a completely new set of data values will be provided by each query.

in metric_names of type str
Metric name filter. Comma-separated list of metrics with wildcard support.
in objects of type Interface
Set of objects to query metrics for.
out return_metric_names of type str
Names of metrics returned in @c returnData.
out return_objects of type Interface
Objects associated with metrics returned in @c returnData.
out return_units of type str
Units of measurement for each returned metric.
out return_scales of type int
Divisor that should be applied to return values in order to get floating point values. For example: (double)returnData[returnDataIndices[0]+i] / returnScales[0] will retrieve the floating point value of i-th sample of the first metric.
out return_sequence_numbers of type int
Sequence numbers of the first elements of value sequences of particular metrics returned in @c returnData. For aggregate metrics it is the sequence number of the sample the aggregate started calculation from.
out return_data_indices of type int
Indices of the first elements of value sequences of particular metrics returned in @c returnData.
out return_data_lengths of type int
Lengths of value sequences of particular metrics.
return return_data of type int
Flattened array of all metric data containing sequences of values for each metric.
class virtualbox.library.INATEngine(interface=None)[source]

Interface for managing a NAT engine which is used with a virtual machine. This allows for changing NAT behavior such as port-forwarding rules. This interface is used in the INetworkAdapter.nat_engine() attribute.

network

Get or set str value for ‘network’ The network attribute of the NAT engine (the same value is used with built-in DHCP server to fill corresponding fields of DHCP leases).

host_ip

Get or set str value for ‘hostIP’ IP of host interface to bind all opened sockets to. Changing this does not change binding of port forwarding.

tftp_prefix

Get or set str value for ‘TFTPPrefix’ TFTP prefix attribute which is used with the built-in DHCP server to fill the corresponding fields of DHCP leases.

tftp_boot_file

Get or set str value for ‘TFTPBootFile’ TFTP boot file attribute which is used with the built-in DHCP server to fill the corresponding fields of DHCP leases.

tftp_next_server

Get or set str value for ‘TFTPNextServer’ TFTP server attribute which is used with the built-in DHCP server to fill the corresponding fields of DHCP leases. The preferred form is IPv4 addresses.

alias_mode

Get or set int value for ‘aliasMode’

dns_pass_domain

Get or set bool value for ‘DNSPassDomain’ Whether the DHCP server should pass the DNS domain used by the host.

dns_proxy

Get or set bool value for ‘DNSProxy’ Whether the DHCP server (and the DNS traffic by NAT) should pass the address of the DNS proxy and process traffic using DNS servers registered on the host.

dns_use_host_resolver

Get or set bool value for ‘DNSUseHostResolver’ Whether the DHCP server (and the DNS traffic by NAT) should pass the address of the DNS proxy and process traffic using the host resolver mechanism.

redirects

Get str value for ‘redirects’ Array of NAT port-forwarding rules in string representation, in the following format: “name,protocol id,host ip,host port,guest ip,guest port”.

set_network_settings(mtu, sock_snd, sock_rcv, tcp_wnd_snd, tcp_wnd_rcv)[source]

Sets network configuration of the NAT engine.

in mtu of type int
MTU (maximum transmission unit) of the NAT engine in bytes.
in sock_snd of type int
Capacity of the socket send buffer in bytes when creating a new socket.
in sock_rcv of type int
Capacity of the socket receive buffer in bytes when creating a new socket.
in tcp_wnd_snd of type int
Initial size of the NAT engine’s sending TCP window in bytes when establishing a new TCP connection.
in tcp_wnd_rcv of type int
Initial size of the NAT engine’s receiving TCP window in bytes when establishing a new TCP connection.
get_network_settings()[source]

Returns network configuration of NAT engine. See set_network_settings() for parameter descriptions.

out mtu of type int

out sock_snd of type int

out sock_rcv of type int

out tcp_wnd_snd of type int

out tcp_wnd_rcv of type int

add_redirect(name, proto, host_ip, host_port, guest_ip, guest_port)[source]

Adds a new NAT port-forwarding rule.

in name of type str
The name of the rule. An empty name is acceptable, in which case the NAT engine auto-generates one using the other parameters.
in proto of type NATProtocol
Protocol handled with the rule.
in host_ip of type str
IP of the host interface to which the rule should apply. An empty ip address is acceptable, in which case the NAT engine binds the handling socket to any interface.
in host_port of type int
The port number to listen on.
in guest_ip of type str
The IP address of the guest which the NAT engine will forward matching packets to. An empty IP address is acceptable, in which case the NAT engine will forward packets to the first DHCP lease (x.x.x.15).
in guest_port of type int
The port number to forward.
remove_redirect(name)[source]

Removes a port-forwarding rule that was previously registered.

in name of type str
The name of the rule to delete.
class virtualbox.library.IExtPackPlugIn(interface=None)[source]

Interface for keeping information about a plug-in that ships with an extension pack.

name

Get str value for ‘name’ The plug-in name.

description

Get str value for ‘description’ The plug-in description.

frontend

Get str value for ‘frontend’ The name of the frontend or component name this plug-in plugs into.

module_path

Get str value for ‘modulePath’ The module path.

class virtualbox.library.IExtPackBase(interface=None)[source]

Interface for querying information about an extension pack as well as accessing COM objects within it.

name

Get str value for ‘name’ The extension pack name. This is unique.

description

Get str value for ‘description’ The extension pack description.

version

Get str value for ‘version’ The extension pack version string. This is restricted to the dotted version number and optionally a build indicator. No tree revision or tag will be included in the string as those things are available as separate properties. An optional publisher tag may be present like for IVirtualBox.version() .

Examples: “1.2.3”, “1.2.3_BETA1” and “1.2.3_RC2”.

revision

Get int value for ‘revision’ The extension pack internal revision number.

edition

Get str value for ‘edition’ Edition indicator. This is usually empty.

Can for instance be used to help distinguishing between two editions of the same extension pack where only the license, service contract or something differs.

vrde_module

Get str value for ‘VRDEModule’ The name of the VRDE module if the extension pack sports one.

plug_ins

Get IExtPackPlugIn value for ‘plugIns’ Plug-ins provided by this extension pack.

usable

Get bool value for ‘usable’ Indicates whether the extension pack is usable or not.

There are a number of reasons why an extension pack might be unusable, typical examples would be broken installation/file or that it is incompatible with the current VirtualBox version.

why_unusable

Get str value for ‘whyUnusable’ String indicating why the extension pack is not usable. This is an empty string if usable and always a non-empty string if not usable.

show_license

Get bool value for ‘showLicense’ Whether to show the license before installation

license_p

Get str value for ‘license’ The default HTML license text for the extension pack. Same as calling query_license() queryLicense with preferredLocale and preferredLanguage as empty strings and format set to html.

query_license(preferred_locale, preferred_language, format_p)[source]

Full feature version of the license attribute.

in preferred_locale of type str
The preferred license locale. Pass an empty string to get the default license.
in preferred_language of type str
The preferred license language. Pass an empty string to get the default language for the locale.
in format_p of type str
The license format: html, rtf or txt. If a license is present there will always be an HTML of it, the rich text format (RTF) and plain text (txt) versions are optional. If
return license_text of type str
The license text.
class virtualbox.library.IExtPack(interface=None)[source]

Interface for querying information about an extension pack as well as accessing COM objects within it.

query_object(obj_uuid)[source]

Queries the IUnknown interface to an object in the extension pack main module. This allows plug-ins and others to talk directly to an extension pack.

in obj_uuid of type str
The object ID. What exactly this is
return return_interface of type Interface
The queried interface.
class virtualbox.library.IExtPackFile(interface=None)[source]

Extension pack file (aka tarball, .vbox-extpack) representation returned by IExtPackManager.open_ext_pack_file() . This provides the base extension pack information with the addition of the file name.

file_path

Get str value for ‘filePath’ The path to the extension pack file.

install(replace, display_info)[source]

Install the extension pack.

in replace of type bool
Set this to automatically uninstall any existing extension pack with the same name as the one being installed.
in display_info of type str
Platform specific display information. Reserved for future hacks.
return progess of type IProgress
Progress object for the operation.
class virtualbox.library.IExtPackManager(interface=None)[source]

Interface for managing VirtualBox Extension Packs.

@todo Describe extension packs, how they are managed and how to create one.

installed_ext_packs

Get IExtPack value for ‘installedExtPacks’ List of the installed extension packs.

find(name)[source]

Returns the extension pack with the specified name if found.

in name of type str
The name of the extension pack to locate.
return return_data of type IExtPack
The extension pack if found.
raises VBoxErrorObjectNotFound
No extension pack matching @a name was found.
open_ext_pack_file(path)[source]

Attempts to open an extension pack file in preparation for installation.

in path of type str
The path of the extension pack tarball. This can optionally be followed by a “::SHA-256=hex-digit” of the tarball.
return file_p of type IExtPackFile
The interface of the extension pack file object.
uninstall(name, forced_removal, display_info)[source]

Uninstalls an extension pack, removing all related files.

in name of type str
The name of the extension pack to uninstall.
in forced_removal of type bool
Forced removal of the extension pack. This means that the uninstall hook will not be called.
in display_info of type str
Platform specific display information. Reserved for future hacks.
return progess of type IProgress
Progress object for the operation.
cleanup()[source]

Cleans up failed installs and uninstalls

query_all_plug_ins_for_frontend(frontend_name)[source]

Gets the path to all the plug-in modules for a given frontend.

This is a convenience method that is intended to simplify the plug-in loading process for a frontend.

in frontend_name of type str
The name of the frontend or component.
return plug_in_modules of type str
Array containing the plug-in modules (full paths).
is_ext_pack_usable(name)[source]

Check if the given extension pack is loaded and usable.

in name of type str
The name of the extension pack to check for.
return usable of type bool
Is the given extension pack loaded and usable.
class virtualbox.library.IBandwidthGroup(interface=None)[source]

Represents one bandwidth group.

name

Get str value for ‘name’ Name of the group.

type_p

Get BandwidthGroupType value for ‘type’ Type of the group.

reference

Get int value for ‘reference’ How many devices/medium attachments use this group.

max_bytes_per_sec

Get or set int value for ‘maxBytesPerSec’ The maximum number of bytes which can be transfered by all entities attached to this group during one second.

class virtualbox.library.IBandwidthControl(interface=None)[source]

Controls the bandwidth groups of one machine used to cap I/O done by a VM. This includes network and disk I/O.

num_groups

Get int value for ‘numGroups’ The current number of existing bandwidth groups managed.

create_bandwidth_group(name, type_p, max_bytes_per_sec)[source]

Creates a new bandwidth group.

in name of type str
Name of the bandwidth group.
in type_p of type BandwidthGroupType
The type of the bandwidth group (network or disk).
in max_bytes_per_sec of type int
The maximum number of bytes which can be transfered by all entities attached to this group during one second.
delete_bandwidth_group(name)[source]

Deletes a new bandwidth group.

in name of type str
Name of the bandwidth group to delete.
get_bandwidth_group(name)[source]

Get a bandwidth group by name.

in name of type str
Name of the bandwidth group to get.
return bandwidth_group of type IBandwidthGroup
Where to store the bandwidth group on success.
get_all_bandwidth_groups()[source]

Get all managed bandwidth groups.

return bandwidth_groups of type IBandwidthGroup
The array of managed bandwidth groups.
class virtualbox.library.IVirtualBoxClient(interface=None)[source]

Convenience interface for client applications. Treat this as a singleton, i.e. never create more than one instance of this interface.

At the moment only available for clients of the local API (not usable via the webservice). Once the session logic is redesigned this might change.

Error information handling is a bit special with IVirtualBoxClient: creating an instance will always succeed. The return of the actual error code/information is postponed to any attribute or method call. The reason for this is that COM likes to mutilate the error code and lose the detailed error information returned by instance creation.

virtual_box

Get IVirtualBox value for ‘virtualBox’ Reference to the server-side API root object.

session

Get ISession value for ‘session’ Create a new session object and return the reference to it.

event_source

Get IEventSource value for ‘eventSource’ Event source for VirtualBoxClient events.

check_machine_error(machine)[source]

Perform error checking before using an IMachine object. Generally useful before starting a VM and all other uses. If anything is not as it should be then this method will return an appropriate error.

in machine of type IMachine
The machine object to check.
class virtualbox.library.IEventListener(interface=None)[source]

Event listener. An event listener can work in either active or passive mode, depending on the way it was registered. See IEvent for an introduction to VirtualBox event handling.

handle_event(event)[source]

Handle event callback for active listeners. It is not called for passive listeners. After calling handle_event() on all active listeners and having received acknowledgement from all passive listeners via IEventSource.event_processed() , the event is marked as processed and IEvent.wait_processed() will return immediately.

in event of type IEvent
Event available.
class virtualbox.library.IEvent(interface=None)[source]

Abstract parent interface for VirtualBox events. Actual events will typically implement a more specific interface which derives from this (see below).

Introduction to VirtualBox events

Generally speaking, an event (represented by this interface) signals that something happened, while an event listener (see IEventListener ) represents an entity that is interested in certain events. In order for this to work with unidirectional protocols (i.e. web services), the concepts of passive and active listener are used.

Event consumers can register themselves as listeners, providing an array of events they are interested in (see IEventSource.register_listener() ). When an event triggers, the listener is notified about the event. The exact mechanism of the notification depends on whether the listener was registered as an active or passive listener:

An active listener is very similar to a callback: it is a function invoked by the API. As opposed to the callbacks that were used in the API before VirtualBox 4.0 however, events are now objects with an interface hierarchy.

Passive listeners are somewhat trickier to implement, but do not require a client function to be callable, which is not an option with scripting languages or web service clients. Internally the IEventSource implementation maintains an event queue for each passive listener, and newly arrived events are put in this queue. When the listener calls IEventSource.get_event() , first element from its internal event queue is returned. When the client completes processing of an event, the IEventSource.event_processed() function must be called, acknowledging that the event was processed. It supports implementing waitable events. On passive listener unregistration, all events from its queue are auto-acknowledged.

Waitable events are useful in situations where the event generator wants to track delivery or a party wants to wait until all listeners have completed the event. A typical example would be a vetoable event (see IVetoEvent ) where a listeners might veto a certain action, and thus the event producer has to make sure that all listeners have processed the event and not vetoed before taking the action.

A given event may have both passive and active listeners at the same time.

Using events

Any VirtualBox object capable of producing externally visible events provides an @c eventSource read-only attribute, which is of the type IEventSource . This event source object is notified by VirtualBox once something has happened, so consumers may register event listeners with this event source. To register a listener, an object implementing the IEventListener interface must be provided. For active listeners, such an object is typically created by the consumer, while for passive listeners IEventSource.create_listener() should be used. Please note that a listener created with IEventSource.create_listener() must not be used as an active listener.

Once created, the listener must be registered to listen for the desired events (see IEventSource.register_listener() ), providing an array of VBoxEventType enums. Those elements can either be the individual event IDs or wildcards matching multiple event IDs.

After registration, the callback’s IEventListener.handle_event() method is called automatically when the event is triggered, while passive listeners have to call IEventSource.get_event() and IEventSource.event_processed() in an event processing loop.

The IEvent interface is an abstract parent interface for all such VirtualBox events coming in. As a result, the standard use pattern inside IEventListener.handle_event() or the event processing loop is to check the type_p() attribute of the event and then cast to the appropriate specific interface using @c QueryInterface().

type_p

Get VBoxEventType value for ‘type’ Event type.

source

Get IEventSource value for ‘source’ Source of this event.

waitable

Get bool value for ‘waitable’ If we can wait for this event being processed. If false, wait_processed() returns immediately, and set_processed() doesn’t make sense. Non-waitable events are generally better performing, as no additional overhead associated with waitability imposed. Waitable events are needed when one need to be able to wait for particular event processed, for example for vetoable changes, or if event refers to some resource which need to be kept immutable until all consumers confirmed events.

set_processed()[source]

Internal method called by the system when all listeners of a particular event have called IEventSource.event_processed() . This should not be called by client code.

wait_processed(timeout)[source]

Wait until time outs, or this event is processed. Event must be waitable for this operation to have described semantics, for non-waitable returns true immediately.

in timeout of type int
Maximum time to wait for event processing, in ms; 0 = no wait, -1 = indefinite wait.
return result of type bool
If this event was processed before timeout.
class virtualbox.library.IReusableEvent(interface=None)[source]

Base abstract interface for all reusable events.

generation

Get int value for ‘generation’ Current generation of event, incremented on reuse.

reuse()[source]

Marks an event as reused, increments ‘generation’, fields shall no longer be considered valid.

class virtualbox.library.IMachineEvent(interface=None)[source]

Base abstract interface for all machine events.

id = VBoxEventType(3)
machine_id

Get str value for ‘machineId’ ID of the machine this event relates to.

class virtualbox.library.IMachineStateChangedEvent(interface=None)[source]

Machine state change event.

id = VBoxEventType(32)
state

Get MachineState value for ‘state’ New execution state.

class virtualbox.library.IMachineDataChangedEvent(interface=None)[source]

Any of the settings of the given machine has changed.

id = VBoxEventType(33)
temporary

Get bool value for ‘temporary’ @c true if the settings change is temporary. All permanent settings changes will trigger an event, and only temporary settings changes for running VMs will trigger an event. Note: sending events for temporary changes is NOT IMPLEMENTED.

class virtualbox.library.IMediumRegisteredEvent(interface=None)[source]

The given medium was registered or unregistered within this VirtualBox installation. This event is not yet implemented.

id = VBoxEventType(36)
medium_id

Get str value for ‘mediumId’ ID of the medium this event relates to.

medium_type

Get DeviceType value for ‘mediumType’ Type of the medium this event relates to.

registered

Get bool value for ‘registered’ If @c true, the medium was registered, otherwise it was unregistered.

class virtualbox.library.IMediumConfigChangedEvent(interface=None)[source]

The configuration of the given medium was changed (location, properties, child/parent or anything else). This event is not yet implemented.

id = VBoxEventType(96)
medium

Get IMedium value for ‘medium’ ID of the medium this event relates to.

class virtualbox.library.IMachineRegisteredEvent(interface=None)[source]

The given machine was registered or unregistered within this VirtualBox installation.

id = VBoxEventType(37)
registered

Get bool value for ‘registered’ If @c true, the machine was registered, otherwise it was unregistered.

class virtualbox.library.ISessionStateChangedEvent(interface=None)[source]

The state of the session for the given machine was changed. IMachine.session_state()

id = VBoxEventType(38)
state

Get SessionState value for ‘state’ New session state.

class virtualbox.library.IGuestPropertyChangedEvent(interface=None)[source]

Notification when a guest property has changed.

id = VBoxEventType(42)
name

Get str value for ‘name’ The name of the property that has changed.

value

Get str value for ‘value’ The new property value.

flags

Get str value for ‘flags’ The new property flags.

class virtualbox.library.ISnapshotEvent(interface=None)[source]

Base interface for all snapshot events.

id = VBoxEventType(4)
snapshot_id

Get str value for ‘snapshotId’ ID of the snapshot this event relates to.

class virtualbox.library.ISnapshotTakenEvent(interface=None)[source]

A new snapshot of the machine has been taken. ISnapshot

id = VBoxEventType(39)
midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.ISnapshotDeletedEvent(interface=None)[source]

Snapshot of the given machine has been deleted.

This notification is delivered after the snapshot object has been uninitialized on the server (so that any attempt to call its methods will return an error).

ISnapshot

id = VBoxEventType(40)
midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.ISnapshotRestoredEvent(interface=None)[source]

Snapshot of the given machine has been restored. ISnapshot

id = VBoxEventType(95)
midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.ISnapshotChangedEvent(interface=None)[source]

Snapshot properties (name and/or description) have been changed. ISnapshot

id = VBoxEventType(41)
midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.IMousePointerShapeChangedEvent(interface=None)[source]

Notification when the guest mouse pointer shape has changed. The new shape data is given.

id = VBoxEventType(43)
visible

Get bool value for ‘visible’ Flag whether the pointer is visible.

alpha

Get bool value for ‘alpha’ Flag whether the pointer has an alpha channel.

xhot

Get int value for ‘xhot’ The pointer hot spot X coordinate.

yhot

Get int value for ‘yhot’ The pointer hot spot Y coordinate.

width

Get int value for ‘width’ Width of the pointer shape in pixels.

height

Get int value for ‘height’ Height of the pointer shape in pixels.

shape

Get str value for ‘shape’ Shape buffer arrays.

The @a shape buffer contains a 1-bpp (bits per pixel) AND mask followed by a 32-bpp XOR (color) mask.

For pointers without alpha channel the XOR mask pixels are 32-bit values: (lsb)BGR0(msb). For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32-bit values.

An AND mask is used for pointers with alpha channel, so if the callback does not support alpha, the pointer could be displayed as a normal color pointer.

The AND mask is a 1-bpp bitmap with byte aligned scanlines. The size of the AND mask therefore is cbAnd = (width + 7) / 8 * height. The padding bits at the end of each scanline are undefined.

The XOR mask follows the AND mask on the next 4-byte aligned offset: uint8_t *pXor = pAnd + (cbAnd + 3) & ~3. Bytes in the gap between the AND and the XOR mask are undefined. The XOR mask scanlines have no gap between them and the size of the XOR mask is: cXor = width * 4 * height.

If @a shape is 0, only the pointer visibility is changed.

class virtualbox.library.IMouseCapabilityChangedEvent(interface=None)[source]

Notification when the mouse capabilities reported by the guest have changed. The new capabilities are passed.

id = VBoxEventType(44)
supports_absolute

Get bool value for ‘supportsAbsolute’ Supports absolute coordinates.

supports_relative

Get bool value for ‘supportsRelative’ Supports relative coordinates.

supports_multi_touch

Get bool value for ‘supportsMultiTouch’ Supports multi-touch events coordinates.

needs_host_cursor

Get bool value for ‘needsHostCursor’ If host cursor is needed.

class virtualbox.library.IKeyboardLedsChangedEvent(interface=None)[source]

Notification when the guest OS executes the KBD_CMD_SET_LEDS command to alter the state of the keyboard LEDs.

id = VBoxEventType(45)
num_lock

Get bool value for ‘numLock’ NumLock status.

caps_lock

Get bool value for ‘capsLock’ CapsLock status.

scroll_lock

Get bool value for ‘scrollLock’ ScrollLock status.

class virtualbox.library.IStateChangedEvent(interface=None)[source]

Notification when the execution state of the machine has changed. The new state is given.

id = VBoxEventType(46)
state

Get MachineState value for ‘state’ New machine state.

class virtualbox.library.IAdditionsStateChangedEvent(interface=None)[source]

Notification when a Guest Additions property changes. Interested callees should query IGuest attributes to find out what has changed.

id = VBoxEventType(47)
midl_does_not_like_empty_interfaces

Get bool value for ‘midlDoesNotLikeEmptyInterfaces’

class virtualbox.library.INetworkAdapterChangedEvent(interface=None)[source]

Notification when a property of one of the virtual IMachine.get_network_adapter() network adapters changes. Interested callees should use INetworkAdapter methods and attributes to find out what has changed.

id = VBoxEventType(48)
network_adapter

Get INetworkAdapter value for ‘networkAdapter’ Network adapter that is subject to change.

class virtualbox.library.ISerialPortChangedEvent(interface=None)[source]

Notification when a property of one of the virtual IMachine.get_serial_port() serial ports changes. Interested callees should use ISerialPort methods and attributes to find out what has changed.

id = VBoxEventType(49)
serial_port

Get ISerialPort value for ‘serialPort’ Serial port that is subject to change.

class virtualbox.library.IParallelPortChangedEvent(interface=None)[source]

Notification when a property of one of the virtual IMachine.get_parallel_port() parallel ports changes. Interested callees should use ISerialPort methods and attributes to find out what has changed.

id = VBoxEventType(50)
parallel_port

Get IParallelPort value for ‘parallelPort’ Parallel port that is subject to change.

class virtualbox.library.IStorageControllerChangedEvent(interface=None)[source]

Notification when a