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, the VBoxManage command-line interface and the VBoxVRDP server) 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: %VirtualBox.VirtualBox and %VirtualBox.Session, 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 %VirtualBox.VirtualBox 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 VirtualBox.VirtualBox, 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 %VirtualBox.Session 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. /* currently, nsISupportsImpl.h lacks the below-like macros */ #define NS_IMPL_THREADSAFE_QUERY_INTERFACE1_CI NS_IMPL_QUERY_INTERFACE1_CI #define NS_IMPL_THREADSAFE_QUERY_INTERFACE2_CI NS_IMPL_QUERY_INTERFACE2_CI #define NS_IMPL_THREADSAFE_QUERY_INTERFACE3_CI NS_IMPL_QUERY_INTERFACE3_CI #ifndef NS_IMPL_THREADSAFE_ISUPPORTS1_CI # define NS_IMPL_THREADSAFE_ISUPPORTS1_CI(_class, _interface) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE1_CI(_class, _interface) \ NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface) #endif #ifndef NS_IMPL_THREADSAFE_ISUPPORTS2_CI # define NS_IMPL_THREADSAFE_ISUPPORTS2_CI(_class, _i1, _i2) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE2_CI(_class, _i1, _i2) \ NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2) #endif #ifndef NS_IMPL_THREADSAFE_ISUPPORTS3_CI # define NS_IMPL_THREADSAFE_ISUPPORTS3_CI(_class, _i1, _i2, _i3) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE3_CI(_class, _i1, _i2, _i3) \ NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3) #endif #ifndef NS_IMPL_QUERY_INTERFACE1_AMBIGUOUS_CI # define NS_IMPL_QUERY_INTERFACE1_AMBIGUOUS_CI(_class, _i1, _ic1) \ NS_INTERFACE_MAP_BEGIN(_class) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_i1, _ic1) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _ic1) \ NS_IMPL_QUERY_CLASSINFO(_class) \ NS_INTERFACE_MAP_END #endif #ifndef NS_IMPL_QUERY_INTERFACE2_AMBIGUOUS_CI # define NS_IMPL_QUERY_INTERFACE2_AMBIGUOUS_CI(_class, _i1, _ic1, \ _i2, _ic2) \ NS_INTERFACE_MAP_BEGIN(_class) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_i1, _ic1) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_i2, _ic2) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _ic1) \ NS_IMPL_QUERY_CLASSINFO(_class) \ NS_INTERFACE_MAP_END #endif #ifndef NS_IMPL_QUERY_INTERFACE3_AMBIGUOUS_CI # define NS_IMPL_QUERY_INTERFACE3_AMBIGUOUS_CI(_class, _i1, _ic1, \ _i2, _ic2, _i3, _ic3) \ NS_INTERFACE_MAP_BEGIN(_class) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_i1, _ic1) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_i2, _ic2) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_i3, _ic3) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _ic1) \ NS_IMPL_QUERY_CLASSINFO(_class) \ NS_INTERFACE_MAP_END #endif #define NS_IMPL_THREADSAFE_QUERY_INTERFACE1_AMBIGUOUS_CI NS_IMPL_QUERY_INTERFACE1_AMBIGUOUS_CI #define NS_IMPL_THREADSAFE_QUERY_INTERFACE2_AMBIGUOUS_CI NS_IMPL_QUERY_INTERFACE2_AMBIGUOUS_CI #define NS_IMPL_THREADSAFE_QUERY_INTERFACE3_AMBIGUOUS_CI NS_IMPL_QUERY_INTERFACE3_AMBIGUOUS_CI #ifndef NS_IMPL_THREADSAFE_ISUPPORTS1_AMBIGUOUS_CI # define NS_IMPL_THREADSAFE_ISUPPORTS1_AMBIGUOUS_CI(_class, _i1, _ic1) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE1_AMBIGUOUS_CI(_class, _i1, _ic1) \ NS_IMPL_CI_INTERFACE_GETTER1(_class, _i1) #endif #ifndef NS_IMPL_THREADSAFE_ISUPPORTS2_AMBIGUOUS_CI # define NS_IMPL_THREADSAFE_ISUPPORTS2_AMBIGUOUS_CI(_class, _i1, _ic1, \ _i2, _ic2) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE2_AMBIGUOUS_CI(_class, _i1, _ic1, \ _i2, _ic2) \ NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2) #endif #ifndef NS_IMPL_THREADSAFE_ISUPPORTS3_AMBIGUOUS_CI # define NS_IMPL_THREADSAFE_ISUPPORTS3_AMBIGUOUS_CI(_class, _i1, _ic1, \ _i2, _ic2, _i3, _ic3) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE3_AMBIGUOUS_CI(_class, _i1, _ic1, \ _i2, _ic2, _i3, _ic3) \ NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3) #endif This section describes all VirtualBox-specific COM result codes that may be returned by methods of VirtualBox COM interfaces in addition to standard COM result codes. Note that along with the result code, every VirtualBox method returns extended error information through the IVirtualBoxErrorInfo interface on failure. This interface is a preferred way to present the error to the end user because it contains a human readable description of the error. Raw result codes, both standard and described in this section, are intended to be used by programs to analyze the reason of a failure and select an appropriate course of action without involving the end user (for example, retry the operation later or make a different call). The standard COM result codes that may originate from our methods include:
E_INVALIDARG Returned when the value of the method's argument is not within the range of valid values. This should not be confused with situations when the value is within the range but simply doesn't suit the current object state and there is a possibility that it will be accepted later (in such cases VirtualBox-specific codes are returned, for example, ).
E_POINTER Returned if a memory pointer for the output argument is invalid (for example, @c null). Note that when pointers representing input arguments (such as strings) are invalid, E_INVALIDARG is returned.
E_ACCESSDENIED Returned when the called object is not ready. Since the lifetime of a public COM object cannot be fully controlled by the implementation, VirtualBox maintains the readiness state for all objects it creates and returns this code in response to any method call on the object that was deactivated by VirtualBox and is not functioning any more.
E_OUTOFMEMORY Returned when a memory allocation operation fails.
Object corresponding to the supplied arguments does not exist. Current virtual machine state prevents the operation. Virtual machine error occurred attempting the operation. File not accessible or erroneous file contents. Runtime subsystem error. Pluggable Device Manager error. Current object state prohibits operation. Host operating system related error. Requested operation is not supported. Invalid XML found. Current session state prohibits operation. Object being in use prohibits operation. 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 value, indicates invalid version. Legacy settings version, not currently supported. Legacy settings version, not currently supported. Legacy settings version, not currently supported. Legacy settings version, not currently supported. Settings version "1.3", written by VirtualBox 2.0.12. Intermediate settings version, understood by VirtualBox 2.1.x. Intermediate settings version, understood by VirtualBox 2.1.x. Settings version "1.6", written by VirtualBox 2.1.4 (at least). Settings version "1.7", written by VirtualBox 2.2.x and 3.0.x. Intermediate settings version "1.8", understood by VirtualBox 3.1.x. Settings version "1.9", written by VirtualBox 3.1.x. Settings version "1.10", written by VirtualBox 3.2.x. Settings version greater than "1.10", written by a future VirtualBox version. Access mode for opening files. Virtual machine execution state. This enumeration represents possible values of the 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 interface that performs the given state transition.
            +---------[powerDown()] <- Stuck <--[failure]-+
            V                                             |
    +-> PoweredOff --+-->[powerUp()]--> Starting --+      | +-----[resume()]-----+
    |                |                             |      | V                    |
    |   Aborted -----+                             +--> Running --[pause()]--> Paused
    |                                              |      ^ |                   ^ |
    |   Saved -----------[powerUp()]--> Restoring -+      | |                   | |
    |     ^                                               | |                   | |
    |     |     +-----------------------------------------+-|-------------------+ +
    |     |     |                                           |                     |
    |     |     +-- Saving <--------[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 oter setting or perform a modifying operation during this time will result in the 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 ).
    +----------------------------------(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 and performing one of the "discard..." operations, respectively.
    +----------------------------------(same state as before the call)------+
    |                                                                       |
    +-> PoweredOff --+                                                      |
    |                +-->[takeSnapshot()] -------------------> Saving ------+
    +-> Aborted -----+

    +-> PoweredOff --+
    |                |
    |   Aborted -----+-->[restoreSnapshot()    ]-------> RestoringSnapshot -+
    |                |   [deleteSnapshot()     ]-------> DeletingSnapshot --+
    +-> Saved -------+                                                      |
    |                                                                       |
    +---(Saved if restored from an online snapshot, PoweredOff otherwise)---+
      
Note that the Saving state is present in both the offline state group and online state group. Currently, the only way to determine what group is assumed in a particular case is to remember the previous machine state: if it was Running or Paused, then Saving is an online state, otherwise it is an offline state. This inconsistency may be removed in one of the future versions of VirtualBox by adding a new state. 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 value (never used by the API). The machine is not running and has no saved execution state; it has either never been started or been shut down successfully. 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. 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). 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. 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. 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. 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? 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 state and it will not be possible to resume it again unless the teleportation fails. 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 and it will not be resume the execution until the snapshot operation has completed. Machine is being started after powering it on from a zero execution state. Machine is being normally stopped powering it off, or after the guest OS has initiated a shutdown sequence. Machine is saving its execution state to a file, or an online snapshot of the machine is being taken. Execution state of the machine is being restored from a file after powering it on from the saved execution state. The machine is being teleported to another host or process, but it is not running. This is the paused variant of the state. Teleporting the machine state in from another host or process. A machine snapshot is being restored; this typically does not take long. A machine snapshot is being deleted; this can take a long time since this may require merging differencing media. Lengthy setup operation is in progress. Pseudo-state: first online state (for use in relational expressions). Pseudo-state: last online state (for use in relational expressions). Pseudo-state: first transient state (for use in relational expressions). Pseudo-state: last transient state (for use in relational expressions).
Session state. This enumeration represents possible values of and attributes. See individual enumerator descriptions for the meaning for every value. Null value (never used by the API). The machine has no open sessions (); the session is closed () The machine has an open direct session (); the session is open () A new (direct) session is being opened for the machine as a result of call ( or ). This state also occurs as a short transient state when a new direct session is opened by calling . The direct session is being closed (); the session is being closed () Virtual CPU property type. This enumeration represents possible values of the IMachine get- and setCpuProperty methods. Null value (never used by the API). 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. This setting determines whether VirtualBox will expose a synthetic CPU to the guest to allow teleporting between host systems that differ significantly. Hardware virtualization property type. This enumeration represents possible values for the and methods. Null value (never used by the API). Whether hardware virtualization (VT-x/AMD-V) is enabled at all. If such extensions are not available, they will not be used. Whether hardware virtualization is used exclusively by VirtualBox. When enabled, VirtualBox assumes it can acquire full and exclusive access to the VT-x or AMD-V feature of the host. To share these with other hypervisors, you must disable this property. Whether VT-x VPID is enabled. If this extension is not available, it will not be used. Whether Nested Paging is enabled. If this extension is not available, it will not be used. Session type. This enumeration represents possible values of the attribute. Null value (never used by the API). Direct session (opened by ) Remote session (opened by ) Existing session (opened by ) Device type. Null value, may also mean "no device" (not allowed for ). Floppy device. CD/DVD-ROM device. Hard disk device. Network device. USB device. Shared folder device. Device activity for . Host-Guest clipboard interchange mode. Scope of the operation. A generic enumeration used in various methods to define the action or argument scope. Statistics type for . Idle CPU load (0-100%) for last interval. Kernel CPU load (0-100%) for last interval. User CPU load (0-100%) for last interval. Total number of threads in the system. Total number of processes in the system. Total number of handles in the system. Memory load (0-100%). Total physical memory in megabytes. Free physical memory in megabytes. Ballooned physical memory in megabytes. Total amount of memory in the committed state in megabytes. Total amount of memory used by the guest OS's kernel in megabytes. Total amount of paged memory used by the guest OS's kernel in megabytes. Total amount of non-paged memory used by the guest OS's kernel in megabytes. Total amount of memory used by the guest OS's system cache in megabytes. Pagefile size in megabytes. Statistics sample number BIOS boot menu mode. CPU features. Firmware type. BIOS Firmware. EFI Firmware, bitness detetced basing on OS type. Efi firmware, 32-bit. Efi firmware, 64-bit. Efi firmware, combined 32 and 64-bit. Type of pointing device used in a virtual machine. No mouse. PS/2 auxillary device, a.k.a. mouse. USB mouse (relative pointer). USB tablet (absolute pointer). Combined device, working as PS/2 or USB mouse, depending on guest behavior. Using of such device can have negative performance implications. Type of keyboard device used in a virtual machine. No keyboard. PS/2 keyboard. USB keyboard. Combined device, working as PS/2 or USB keyboard, depending on guest behavior. Using of such device can have negative performance implications. 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 attribute is intended specifically for this purpose and allows to represent a chain of errors through a single IVirtualBoxErrorInfo object set after method invocation. Note that 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 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. 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. 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 description of the error. In MS COM, it is the same as IErrorInfo::GetDescription. In XPCOM, it is the same as nsIException::message. 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. The ILocalOwner interface allows to register local objects (created without COM calls, but with new()). Once registered, calls to methods of such objects can be made from remote COM processes. The main usecase is the event callback implementation where API clients provide callback objects. Set local object. Local object to forward requests to. If null, clears currently set local object. The execution state of the given machine has changed. IMachine::state ID of the machine this event relates to. New execution state. Any of the settings of the given machine has changed. ID of the machine this event relates to. Notification when someone tries to change extra data for either the given machine or (if @c null) global extra data. This gives the chance to veto against changes. ID of the machine this event relates to (@c null ID for global extra data change requests). Extra data key for the attempted write. Extra data value for the given key. Optional error message describing the reason of the veto (ignored if this notification returns @c true). Flag to indicate whether the callee agrees (@c true) or vetoes against the change (@c false). Notification when machine specific or global extra data has changed. ID of the machine this event relates to. Null for global extra data changes. Extra data key that has changed. Extra data value for the given key. The given medium was registered or unregistered within this VirtualBox installation. The @a mediumType parameter describes what type of medium the specified @a mediumId refers to. Possible values are:
  • : the medium is a hard disk that, if registered, can be obtained using the call.
  • : the medium is a CD/DVD image that, if registered, can be obtained using the call.
  • : the medium is a Floppy image that, if registered, can be obtained using the call.
Note that if this is a deregistration notification, there is no way to access the object representing the unregistered medium. It is supposed that the application will do required cleanup based on the @a mediumId value.
ID of the medium this event relates to. Type of the medium this event relates to. If @c true, the medium was registered, otherwise it was unregistered.
The given machine was registered or unregistered within this VirtualBox installation. ID of the machine this event relates to. If @c true, the machine was registered, otherwise it was unregistered. The state of the session for the given machine was changed. IMachine::sessionState ID of the machine this event relates to. New session state. A new snapshot of the machine has been taken. ISnapshot ID of the machine this event relates to. ID of the new snapshot. Snapshot of the given machine has been discarded. 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 of the machine this event relates to. ID of the discarded snapshot. @c null means the current machine state has been discarded (restored from the current snapshot). Snapshot properties (name and/or description) have been changed. ISnapshot ID of the machine this event relates to. ID of the changed snapshot. Notification when a guest property has changed. ID of the machine this event relates to. The name of the property that has changed. The new property value. The new property flags.
The IDHCPServer interface represents the vbox dhcp server configuration. To enumerate all the dhcp servers on the host, use the attribute. specifies if the dhcp server is enabled specifies server IP specifies server network mask specifies internal network name the server is used for specifies from IP adrres in server address range specifies to IP adrres in server address range configures the server invalid configuration supplied server IP address server network mask server From IP address for address range server To IP address for address range Starts DHCP server process. Failed to start the process. Name of internal network DHCP server should attach to. Name of internal network trunk. Type of internal network trunk. Stops DHCP server process. Failed to stop the process. The IVirtualBox interface represents the main interface exposed by the product that provides virtual machine management. An instance of IVirtualBox is required for the product to do anything useful. Even though the interface does not expose this, internally, IVirtualBox is implemented as a singleton and actually lives in the process of the VirtualBox server (VBoxSVC.exe). This makes sure that IVirtualBox can track the state of all virtual machines on a particular host, regardless of which frontend started them. To enumerate all the virtual machines on the host, use the attribute. A string representing the version number of the product. The format is 3 integer numbers divided by dots (e.g. 1.0.1). The last number represents the build number and will frequently change. The internal build revision number of the product. A string representing the package type of this product. The format is OS_ARCH_DIST where OS is either WINDOWS, LINUX, SOLARIS, DARWIN. ARCH is either 32BITS or 64BITS. DIST is either GENERIC, UBUNTU_606, UBUNTU_710, or something like this. Full path to the directory where the global settings file, VirtualBox.xml, is stored. In this version of VirtualBox, the value of this property is always <user_dir>/.VirtualBox (where <user_dir> is the path to the user directory, as determined by the host OS), and cannot be changed. This path is also used as the base to resolve relative paths in places where relative paths are allowed (unless otherwise expressly indicated). Full name of the global settings file. The value of this property corresponds to the value of plus /VirtualBox.xml. Associated host object. Associated system information object. Array of machine objects registered within this VirtualBox instance. Array of medium objects known to this VirtualBox installation. This array contains only base media. All differencing media of the given base medium can be enumerated using . Array of CD/DVD image objects registered with this VirtualBox instance. Array of floppy image objects registered with this VirtualBox instance. Collection of global shared folders. Global shared folders are available to all virtual machines. New shared folders are added to the collection using . Existing shared folders can be removed using . In the current version of the product, global shared folders are not implemented and therefore this collection is always empty. Associated performance collector object. dhcp server settings. Creates a new virtual machine. The new machine is created unregistered, with the initial configuration set according to the specified guest OS type. A typical sequence of actions to create a new virtual machine is as follows:
  1. Call this method to have a new machine created. The returned machine object will be "mutable" allowing to change any machine property.
  2. Configure the machine using the appropriate attributes and methods.
  3. Call to write the settings to the machine's XML settings file. The configuration of the newly created machine will not be saved to disk until this method is called.
  4. Call to add the machine to the list of machines known to VirtualBox.
You should specify valid name for the newly created machine when calling this method. See the attribute description for more details about the machine name. The specified guest OS type identifier must match an ID of one of known guest OS types listed in the array. Every machine has a settings file that is used to store the machine configuration. This file is stored in a directory called the machine settings subfolder. Both the settings subfolder and file will have a name that corresponds to the name of the virtual machine. You can specify where to create the machine setting subfolder using the @a baseFolder argument. The base folder can be absolute (full path) or relative to the VirtualBox home directory. If @a baseFolder is a @c null or empty string (which is recommended), the default machine settings folder will be used as a base folder for the created machine. Otherwise the given base folder will be used. In either case, the full path to the resulting settings file has the following structure:
          <base_folder>/<machine_name>/<machine_name>.xml
        
Note that if the resulting settings file already exists, this method will fail with . Optionally, you may specify an UUID of to assign to the created machine. However, this is not recommended and you should normally pass an empty (@c null) UUID to this method so that a new UUID will be automatically generated for every created machine. You can use UUID 00000000-0000-0000-0000-000000000000 as @c null value. There is no way to change the name of the settings file or subfolder of the created machine directly. @a osTypeId is invalid. Resulting settings file name is invalid or the settings file already exists or could not be created due to an I/O error. @a name is empty or @c null.
Machine name. Guest OS Type ID. Base machine folder (optional). Machine UUID (optional). Created machine object.
Creates a new virtual machine in "legacy" mode, using the specified settings file to store machine settings. As opposed to machines created by , the settings file of the machine created in "legacy" mode is not automatically renamed when the machine name is changed -- it will always remain the same as specified in this method call. The specified settings file name can be absolute (full path) or relative to the VirtualBox home directory. If the file name doesn't contain an extension, the default extension (.xml) will be appended. Note that the configuration of the newly created machine is not saved to disk (and therefore no settings file is created) until is called. If the specified settings file already exists, this method will fail with . See for more information. @deprecated This method may be removed later. Use instead. There is no way to change the name of the settings file of the machine created in "legacy" mode. @a osTypeId is invalid. @a settingsFile is invalid or the settings file already exists or could not be created due to an I/O error. @a name or @a settingsFile is empty or @c null. Machine name. Machine OS Type ID. Name of the machine settings file. Machine UUID (optional). Created machine object. Opens a virtual machine from the existing settings file. The opened machine remains unregistered until you call . The specified settings file name can be absolute (full path) or relative to the VirtualBox home directory. This file must exist and must be a valid machine settings file whose contents will be used to construct the machine object. @deprecated Will be removed soon. Settings file name invalid, not found or sharing violation. Name of the machine settings file. Opened machine object. will return @c false for the created machine, until any of machine settings are changed. Registers the machine previously created using or opened using within this VirtualBox installation. After successful method invocation, the signal is sent to all registered callbacks. This method implicitly calls to save all current machine settings before registering it. No matching virtual machine found. Virtual machine was not created within this VirtualBox instance. Attempts to find a virtual machine given its UUID. To look up a machine by name, use instead. Could not find registered machine matching @a id. Attempts to find a virtual machine given its name. To look up a machine by UUID, use instead. Could not find registered machine matching @a name. Unregisters the machine previously registered using . After successful method invocation, the signal is sent to all registered callbacks. The specified machine must not be in the Saved state, have an open (or a spawning) direct session associated with it, have snapshots or have any medium attached. This method implicitly calls to save all current machine settings before unregistering it. If the given machine is inaccessible (see ), it will be unregistered and fully uninitialized right afterwards. As a result, the returned machine object will be unusable and an attempt to call any method will return the "Object not ready" error. Could not find registered machine matching @a id. Machine is in Saved state. Machine has snapshot or open session or medium attached. UUID of the machine to unregister. Unregistered machine object. Creates a new appliance object, which represents an appliance in the Open Virtual Machine Format (OVF). This can then be used to import an OVF appliance into VirtualBox or to export machines as an OVF appliance; see the documentation for for details. New appliance. Creates a new base medium object that will use the given storage format and location for medium data. Note that the actual storage unit is not created by this method. In order to do it, and before you are able to attach the created medium to virtual machines, you must call one of the following methods to allocate a format-specific storage unit at the specified location:
Some medium attributes, such as , may remain uninitialized until the medium storage unit is successfully created by one of the above methods. After the storage unit is successfully created, the medium gets remembered by this VirtualBox installation and will be accessible through and methods. Remembered base medium are also returned as part of the array. See IMedium for more details. The list of all storage formats supported by this VirtualBox installation can be obtained using . If the @a format attribute is empty or @c null then the default storage format specified by will be used for creating a storage unit of the medium. Note that the format of the location string is storage format specific. See , IMedium and for more details. @a format identifier is invalid. See . @a location is a not valid file name (for file-based formats only).
Identifier of the storage format to use for the new medium. Location of the storage unit for the new medium. Created medium object.
Opens a medium from an existing location, optionally replacing the image UUID and/or parent UUID. After the medium is successfully opened by this method, it gets remembered by (known to) this VirtualBox installation and will be accessible through and methods. Remembered base media are also returned as part of the array and can be attached to virtual machines. See IMedium for more details. If a differencing medium is to be opened by this method, the operation will succeed only if its parent medium and all ancestors, if any, are already known to this VirtualBox installation (for example, were opened by this method before). This method tries to guess the storage format of the specified medium by reading medium data at the specified location. If @a write is ReadWrite (which it should be), the image is opened for read/write access and must have according permissions, as VirtualBox may actually write status information into the disk's metadata sections. Note that write access is required for all typical image usage in VirtualBox, since VirtualBox may need to write metadata such as a UUID into the image. The only exception is opening a source image temporarily for copying and cloning when the image will quickly be closed again. Note that the format of the location string is storage format specific. See , IMedium and for more details. Invalid medium storage file location or could not find the medium at the specified location. Could not get medium storage format. Invalid medium storage format. Location of the storage unit that contains medium data in one of the supported storage formats. Determines whether to open the image in read/write or read-only mode. Select whether a new image UUID is set or not. New UUID for the image. If an empty string is passed, then a new UUID is automatically created. Specifying a zero UUIDs is not valid. Select whether a new parent UUID is set or not. 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. Opened medium object. Returns a medium with the given UUID. The medium with the given UUID must be known to this VirtualBox installation, i.e. it must be previously created by or opened by , or attached to some known virtual machine. No medium object matching @a id found. UUID of the medium to look for. Found medium object. Returns a medium that uses the given location to store medium data. The given medium must be known to this VirtualBox installation, i.e. it must be previously created by or opened by , or attached to some known virtual machine. The search is done by comparing the value of the @a location argument to the attribute of each known medium. For locations represented by file names in the host's file system, the requested location can be a path relative to the VirtualBox home folder. If only a file name without any path is given, the default medium folder will be prepended to the file name before searching. Note that on case sensitive file systems, a case sensitive comparison is performed, otherwise the case of symbols in the file path is ignored. No medium object matching @a location found. Location string to search for. Found medium object. Opens a CD/DVD image contained in the specified file of the supported format and assigns it the given UUID. After the image is successfully opened by this method, it gets remembered by (known to) this VirtualBox installation and will be accessible through and methods. Remembered images are also returned as part of the array and can be mounted to virtual machines. See IMedium for more details. See to get more details about the format of the location string. Currently only ISO 9960 CD/DVD images are supported by VirtualBox. Invalid CD/DVD image file location or could not find the CD/DVD image at the specified location. CD/DVD image already exists in the media registry. Full path to the file that contains a valid CD/DVD image. UUID to assign to the given image within this VirtualBox installation. If an empty (@c null) UUID is specified, the system will randomly generate a new UUID. Opened CD/DVD image object. Returns a CD/DVD image with the given UUID. The image with the given UUID must be known to this VirtualBox installation, i.e. it must be previously opened by , or mounted to some known virtual machine. No matching DVD image found in the media registry. UUID of the image to look for. Found CD/DVD image object. Returns a CD/DVD image with the given image location. The image with the given UUID must be known to this VirtualBox installation, i.e. it must be previously opened by , or mounted to some known virtual machine. The search is done by comparing the value of the @a location argument to the attribute of each known CD/DVD image. The requested location can be a path relative to the VirtualBox home folder. If only a file name without any path is given, the default hard disk folder will be prepended to the file name before searching. Note that on case sensitive file systems, a case sensitive comparison is performed, otherwise the case in the file path is ignored. Invalid image file location. No matching DVD image found in the media registry. CD/DVD image file path to look for. Found CD/DVD image object. Opens a floppy image contained in the specified file of the supported format and assigns it the given UUID. After the image is successfully opened by this method, it gets remembered by (known to) this VirtualBox installation and will be accessible through and methods. Remembered images are also returned as part of the array and can be mounted to virtual machines. See IMedium for more details. See to get more details about the format of the location string. Invalid floppy image file location or could not find the floppy image at the specified location. Floppy image already exists in the media registry. Currently, only raw floppy images are supported by VirtualBox. Full path to the file that contains a valid floppy image. UUID to assign to the given image file within this VirtualBox installation. If an empty (@c null) UUID is specified, the system will randomly generate a new UUID. Opened floppy image object. Returns a floppy image with the given UUID. The image with the given UUID must be known to this VirtualBox installation, i.e. it must be previously opened by , or mounted to some known virtual machine. No matching floppy image found in the media registry. UUID of the image to look for. Found floppy image object. Returns a floppy image with the given image location. The image with the given UUID must be known to this VirtualBox installation, i.e. it must be previously opened by , or mounted to some known virtual machine. The search is done by comparing the value of the @a location argument to the attribute of each known floppy image. The requested location can be a path relative to the VirtualBox home folder. If only a file name without any path is given, the default hard disk folder will be prepended to the file name before searching. Note that on case sensitive file systems, a case sensitive comparison is performed, otherwise the case of symbols in the file path is ignored. Invalid image file location. No matching floppy image found in the media registry. Floppy image file path to look for. Found floppy image object. Returns an object describing the specified guest OS type. The requested guest OS type is specified using a string which is a mnemonic identifier of the guest operating system, such as "win31" or "ubuntu". The guest OS type ID of a particular virtual machine can be read or set using the attribute. The collection contains all available guest OS type objects. Each object has an attribute which contains an identifier of the guest OS this object describes. @a id is not a valid Guest OS type. Guest OS type ID string. Guest OS type object. Creates a new global shared folder by associating the given logical name with the given host path, adds it to the collection of shared folders and starts sharing it. Refer to the description of to read more about logical names. In the current implementation, this operation is not implemented. Unique logical name of the shared folder. Full path to the shared folder in the host file system. Whether the share is writable or readonly Removes the global shared folder with the given name previously created by from the collection of shared folders and stops sharing it. In the current implementation, this operation is not implemented. Logical name of the shared folder to remove. Returns an array representing the global extra data keys which currently have values defined. Array of extra data keys. Returns associated global extra data. If the requested data @a key does not exist, this function will succeed and return an empty string in the @a value argument. Settings file not accessible. Could not parse the settings file. Name of the data key to get. Value of the requested data key. Sets associated global extra data. If you pass @c null or empty string as a key @a value, the given @a key will be deleted. Before performing the actual data change, this method will ask all registered callbacks using the notification for a permission. If one of the callbacks refuses the new value, the change will not be performed. On success, the notification is called to inform all registered callbacks about a successful data change. Settings file not accessible. Could not parse the settings file. Modification request refused. Name of the data key to set. Value to assign to the key. Opens a new direct session with the given virtual machine. A direct session acts as a local lock on the given VM. There can be only one direct session open at a time for every virtual machine, protecting the VM from being manipulated by conflicting actions from different processes. Only after a direct session has been opened, one can change all VM settings and execute the VM in the process space of the session object. Sessions therefore can be compared to mutex semaphores that lock a given VM for modification and execution. See ISession for details. Unless you are writing a new VM frontend, you will not want to execute a VM in the current process. To spawn a new process that executes a VM, use instead. Upon successful return, the session object can be used to get access to the machine and to the VM console. In VirtualBox terminology, the machine becomes "mutable" after a session has been opened. Note that the "mutable" machine object, on which you may invoke IMachine methods to change its settings, will be a different object from the immutable IMachine objects returned by various IVirtualBox methods. To obtain a mutable IMachine object (upon which you can invoke settings methods), use the attribute. One must always call to release the lock on the machine, or the machine's state will eventually be set to "Aborted". In other words, to change settings on a machine, the following sequence is typically performed:
  1. Call this method (openSession) to have a machine locked for the current session.
  2. Obtain a mutable IMachine object from .
  3. Change the settings of the machine.
  4. Call .
  5. Close the session by calling .
Virtual machine not registered. Process not started by OpenRemoteSession. No matching virtual machine found. Session already open or being opened. Failed to assign machine to session.
Session object that will represent the opened session after successful method invocation. This object must not represent the already open session. This session will be automatically closed if the VirtualBox server is terminated for some reason. ID of the virtual machine to open a session with.
Spawns a new process that executes a virtual machine (called a "remote session"). Opening a remote session causes the VirtualBox server to start a new process that opens a direct session with the given VM. As a result, the VM is locked by that direct session in the new process, preventing conflicting changes from other processes. Since sessions act as locks that prevent conflicting changes, one cannot open a remote session for a VM that already has another open session (direct or remote), or is currently in the process of opening one (see ). While the remote session still provides some level of control over the VM execution to the caller (using the interface), not all VM settings are available for modification within the remote session context. This operation can take some time (a new VM is started in a new process, for which memory and other resources need to be set up). Because of this, an is returned to allow the caller to wait for this asynchronous operation to be completed. Until then, the remote session object remains in the closed state, and accessing the machine or its console through it is invalid. It is recommended to use or similar calls to wait for completion. Completion is signalled when the VM is powered on. Error messages etc. can be queried via the progress object, if available. As with all objects, it is recommended to call on the local session object once openRemoteSession() has been called. However, the session's state (see ) will not return to "Closed" until the remote session has also closed (i.e. until the VM is no longer running). In that case, however, the state of the session will automatically change back to "Closed". Currently supported session types (values of the @a type argument) are:
  • "gui": VirtualBox Qt GUI session
  • "vrdp": VirtualBox VRDP Server session
  • "sdl": VirtualBox SDL GUI session
The @a environment argument is a string containing definitions of environment variables in the following format: @code NAME[=VALUE]\n NAME[=VALUE]\n ... @endcode where \\n is the new line character. These environment variables will be appended to the environment of the VirtualBox server process. If an environment variable exists both in the server process and in this list, the value from this list takes precedence over the server's variable. If the value of the environment variable is omitted, this variable will be removed from the resulting environment. If the environment string is @c null or empty, the server environment is inherited by the started process as is. openExistingSession Virtual machine not registered. Invalid session type @a type. No machine matching @a machineId found. Session already open or being opened. Launching process for machine failed. Failed to assign machine to session.
Session object that will represent the opened remote session after successful method invocation (this object must not represent an already open session). ID of the virtual machine to open a session with. Type of the remote session (case sensitive). Environment to pass to the opened session. Progress object to track the operation completion.
Opens a new remote session with the virtual machine for which a direct session is already open. The remote session provides some level of control over the VM execution (using the IConsole interface) to the caller; however, within the remote session context, not all VM settings are available for modification. As opposed to , the number of remote sessions opened this way is not limited by the API It is an error to open a remote session with the machine that doesn't have an open direct session. Virtual machine not registered. No machine matching @a machineId found. Session already open or being opened. Direct session state not Open. Failed to get console object from direct session or assign machine to session. openRemoteSession Session object that will represent the open remote session after successful method invocation. This object must not represent an already open session. This session will be automatically closed when the peer (direct) session dies or gets closed. ID of the virtual machine to open a session with. Registers a new global VirtualBox callback. The methods of the given callback object will be called by VirtualBox when an appropriate event occurs. A @c null callback cannot be registered. Callback object to register. Unregisters the previously registered global VirtualBox callback. Specified @a callback not registered. Callback object to unregister. Blocks the caller until any of the properties represented by the @a what argument changes the value or until the given timeout interval expires. The @a what argument is a comma separated list of property masks that describe properties the caller is interested in. The property mask is a string in the following format:
        [[group.]subgroup.]name
        
where @c name is the property name and @c group, @c subgroup are zero or more property group specifiers. Each element (group or name) in the property mask may be either a Latin string or an asterisk symbol (@c "*") which is used to match any string for the given element. A property mask that doesn't contain asterisk symbols represents a single fully qualified property name. Groups in the fully qualified property name go from more generic (the left-most part) to more specific (the right-most part). The first element is usually a name of the object the property belongs to. The second element may be either a property name, or a child object name, or an index if the preceding element names an object which is one of many objects of the same type. This way, property names form a hierarchy of properties. Here are some examples of property names:
VirtualBox.version property
Machine.<UUID>.name property of the machine with the given UUID
Most property names directly correspond to the properties of objects (components) provided by the VirtualBox library and may be used to track changes to these properties. However, there may be pseudo-property names that don't correspond to any existing object's property directly, as well as there may be object properties that don't have a corresponding property name that is understood by this method, and therefore changes to such properties cannot be tracked. See individual object's property descriptions to get a fully qualified property name that can be used with this method (if any). There is a special property mask @c "*" (i.e. a string consisting of a single asterisk symbol) that can be used to match all properties. Below are more examples of property masks:
VirtualBox.* Track all properties of the VirtualBox object
Machine.*.name Track changes to the property of all registered virtual machines
This function is not implemented in the current version of the product.
Comma separated list of property masks. Wait timeout in milliseconds. Specify -1 for an indefinite wait. Comma separated list of properties that have been changed and caused this method to return to the caller. Reserved, not currently used.
Creates a dhcp server settings to be used for the given internal network name Host network interface @a name already exists. server name Dhcp server settings Searches a dhcp server settings to be used for the given internal network name Host network interface @a name already exists. server name Dhcp server settings Removes the dhcp server settings Host network interface @a name already exists. Dhcp server settings to be removed Check if this VirtualBox installation has a firmware of the given type available, either system-wide or per-user. Optionally, this may return a hint where this firmware can be downloaded from. Type of firmware to check. Expected version number, usually empty string (presently ignored). Suggested URL to download this firmware from. Filename of firmware, only valid if result == TRUE. If firmware of this type and version is available.
Virtual file systems supported by VFSExplorer. File types known by VFSExplorer. 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 . An instance of this is returned by . Returns the current path in the virtual file system. Returns the file system type which is currently in use. Updates the internal list of files/directories from the current directory level. Use to get the full list after a call to this method. Progress object to track the operation completion. Change the current directory level. The name of the directory to go in. Progress object to track the operation completion. Go one directory upwards from the current directory level. Progress object to track the operation completion. Returns a list of files/directories after a call to . The user is responsible for keeping this internal list up do date. The list of names for the entries. The list of types for the entries. Checks if the given file list exists in the current directory level. The names to check. The names which exist. Deletes the given files in the current directory level. The names to remove. Progress object to track the operation completion. Represents a platform-independent appliance in OVF format. An instance of this is returned by , which can then be used to import and export appliances with VirtualBox. The OVF standard suggests two different physical file formats:
  1. If the OVF is distributed as a set of files, then @a file must be a fully qualified path name to an existing OVF descriptor file with an .ovf file extension. If this descriptor file references other files, as OVF appliances distributed as a set of files most likely do, those files must be in the same directory as the descriptor file.
  2. If the OVF is distributed as a single file, it must be in TAR format and have the .ova file extension. This TAR file must then contain at least the OVF descriptor files and optionally other files. At this time, VirtualBox does not not yet support the packed (TAR) variant; support will be added with a later version.
Importing an OVF appliance into VirtualBox as instances of involves the following sequence of API calls:
  1. Call . This will create an empty IAppliance object.
  2. On the new object, call with the full path of the OVF file you would like to import. So long as this file is syntactically valid, this will succeed and return an instance of IAppliance that contains the parsed data from the OVF file.
  3. Next, call , which analyzes the OVF data and sets up the contents of the IAppliance attributes accordingly. These can be inspected by a VirtualBox front-end such as the GUI, and the suggestions can be displayed to the user. In particular, the array contains instances of which represent the virtual systems in the OVF, which in turn describe the virtual hardware prescribed by the OVF (network and hardware adapters, virtual disk images, memory size and so on). The GUI can then give the user the option to confirm and/or change these suggestions.
  4. If desired, call for each virtual system to override the suggestions made by the interpret() routine.
  5. Finally, call to create virtual machines in VirtualBox as instances of that match the information in the virtual system descriptions.
Exporting VirtualBox machines into an OVF appliance involves the following steps:
  1. As with importing, first call to create an empty IAppliance object.
  2. For each machine you would like to export, call with the IAppliance object you just created. This creates an instance of inside the appliance.
  3. If desired, call for each virtual system to override the suggestions made by the export() routine.
  4. Finally, call with a path specification to have the OVF file written.
Path to the main file of the OVF appliance, which is either the .ovf or the .ova file passed to (for import) or (for export). This attribute is empty until one of these methods has been called. Array of virtual disk definitions. One such description exists for each disk definition in the OVF; each string array item represents one such piece of disk information, with the information fields separated by tab (\\t) characters. The caller should be prepared for additional fields being appended to this string in future versions of VirtualBox and therefore check for the number of tabs in the strings returned. In the current version, the following eight fields are returned per string in the array:
  1. Disk ID (unique string identifier given to disk)
  2. Capacity (unsigned integer indicating the maximum capacity of the disk)
  3. Populated size (optional unsigned integer indicating the current size of the disk; can be approximate; -1 if unspecified)
  4. Format (string identifying the disk format, typically "http://www.vmware.com/specifications/vmdk.html#sparse")
  5. Reference (where to find the disk image, typically a file name; if empty, then the disk should be created on import)
  6. Image size (optional unsigned integer indicating the size of the image, which need not necessarily be the same as the values specified above, since the image may be compressed or sparse; -1 if not specified)
  7. Chunk size (optional unsigned integer if the image is split into chunks; presently unsupported and always -1)
  8. Compression (optional string equalling "gzip" if the image is gzip-compressed)
Array of virtual system descriptions. One such description is created for each virtual system found in the OVF. This array is empty until either (for import) or (for export) has been called. Reads an OVF file into the appliance object. This method succeeds if the OVF is syntactically valid and, by itself, without errors. The mere fact that this method returns successfully does not mean that VirtualBox supports all features requested by the appliance; this can only be examined after a call to . Name of appliance file to open (either with an .ovf or .ova extension, depending on whether the appliance is distributed as a set of files or as a single file, respectively). Interprets the OVF data that was read when the appliance was constructed. After calling this method, one can inspect the array attribute, which will then contain one for each virtual machine found in the appliance. Calling this method is the second step of importing an appliance into VirtualBox; see for an overview. After calling this method, one should call to find out if problems were encountered during the processing which might later lead to errors. Imports the appliance into VirtualBox by creating instances of and other interfaces that match the information contained in the appliance as closely as possible, as represented by the import instructions in the array. Calling this method is the final step of importing an appliance into VirtualBox; see for an overview. Since importing the appliance will most probably involve copying and converting disk images, which can take a long time, this method operates asynchronously and returns an IProgress object to allow the caller to monitor the progress. Returns a object for the given URI. The URI describing the file system to use. Writes the contents of the appliance exports into a new OVF file. Calling this method is the final step of exporting an appliance from VirtualBox; see for an overview. Since exporting the appliance will most probably involve copying and converting disk images, which can take a long time, this method operates asynchronously and returns an IProgress object to allow the caller to monitor the progress. Output format, as a string. Currently supported formats are "ovf-0.9" and "ovf-1.0"; future versions of VirtualBox may support additional formats. Name of appliance file to open (either with an .ovf or .ova extension, depending on whether the appliance is distributed as a set of files or as a single file, respectively). Progress object to track the operation completion. Returns textual warnings which occured during execution of .
Used with to describe the type of a configuration value. Used with to describe the value type to fetch. This interface is used in the array. After has been called, that array contains information about how the virtual systems described in the OVF should best be imported into VirtualBox virtual machines. See for the steps required to import an OVF into VirtualBox. Return the number of virtual system description entries. Returns information about the virtual system as arrays of instruction items. In each array, the items with the same indices correspond and jointly represent an import instruction for VirtualBox. The list below identifies the value sets that are possible depending on the enum value in the array item in aTypes[]. In each case, the array item with the same index in aOvfValues[] will contain the original value as contained in the OVF file (just for informational purposes), and the corresponding item in aVBoxValues[] will contain a suggested value to be used for VirtualBox. Depending on the description type, the aExtraConfigValues[] array item may also be used.
  • "OS": the guest operating system type. There must be exactly one such array item on import. The corresponding item in aVBoxValues[] contains the suggested guest operating system for VirtualBox. This will be one of the values listed in . The corresponding item in aOvfValues[] will contain a numerical value that described the operating system in the OVF.
  • "Name": the name to give to the new virtual machine. There can be at most one such array item; if none is present on import, then an automatic name will be created from the operating system type. The correponding item im aOvfValues[] will contain the suggested virtual machine name from the OVF file, and aVBoxValues[] will contain a suggestion for a unique VirtualBox name that does not exist yet.
  • "Description": an arbitrary description.
  • "License": the EULA section from the OVF, if present. It is the responsibility of the calling code to display such a license for agreement; the Main API does not enforce any such policy.
  • Miscellaneous: reserved for future use.
  • "CPU": the number of CPUs. There can be at most one such item, which will presently be ignored.
  • "Memory": the amount of guest RAM, in bytes. There can be at most one such array item; if none is present on import, then VirtualBox will set a meaningful default based on the operating system type.
  • "HarddiskControllerIDE": an IDE hard disk controller. There can be at most one such item. This has no value in aOvfValues[] or aVBoxValues[]. The matching item in the aRefs[] array will contain an integer that items of the "Harddisk" type can use to specify which hard disk controller a virtual disk should be connected to.
  • "HarddiskControllerSATA": an SATA hard disk controller. There can be at most one such item. This has no value in aOvfValues[] or aVBoxValues[]. The matching item in the aRefs[] array will be used as with IDE controllers (see above).
  • "HarddiskControllerSCSI": a SCSI hard disk controller. There can be at most one such item. The items in aOvfValues[] and aVBoxValues[] will either be "LsiLogic" or "BusLogic". The matching item in the aRefs[] array will be used as with IDE controllers (see above).
  • "HardDiskImage": a virtual hard disk, most probably as a reference to an image file. There can be an arbitrary number of these items, one for each virtual disk image that accompanies the OVF. The array item in aOvfValues[] will contain the file specification from the OVF file (without a path since the image file should be in the same location as the OVF file itself), whereas the item in aVBoxValues[] will contain a qualified path specification to where VirtualBox uses the hard disk image. This means that on import the image will be copied and converted from the "ovf" location to the "vbox" location; on export, this will be handled the other way round. On import, the target image will also be registered with VirtualBox. The matching item in the aExtraConfigValues[] array must contain a string of the following format: "controller=<index>;channel=<c>" In this string, <index> must be an integer specifying the hard disk controller to connect the image to. That number must be the index of an array item with one of the hard disk controller types (HarddiskControllerSCSI, HarddiskControllerSATA, HarddiskControllerIDE). In addition, <c> must specify the channel to use on that controller. For IDE controllers, this can range from 0-3 (which VirtualBox will interpret as primary master, primary slave, secondary master and secondary slave. For SATA and SCSI controllers, the channel can range from 0-29.
  • "CDROM": a virtual CD-ROM drive. The matching item in aExtraConfigValue[] contains the same attachment information as with "HardDiskImage" items.
  • "CDROM": a virtual floppy drive. The matching item in aExtraConfigValue[] contains the same attachment information as with "HardDiskImage" items.
  • "NetworkAdapter": a network adapter. The array item in aVBoxValues[] will specify the hardware for the network adapter, whereas the array item in aExtraConfigValues[] will have a string of the "type=<X>" format, where <X> must be either "NAT" or "Bridged".
  • "USBController": a USB controller. There can be at most one such item. If and only if such an item ispresent, USB support will be enabled for the new virtual machine.
  • "SoundCard": a sound card. There can be at most one such item. If and only if such an item is present, sound support will be enabled for the new virtual machine. Note that the virtual machine in VirtualBox will always be presented with the standard VirtualBox soundcard, which may be different from the virtual soundcard expected by the appliance.
This is the same as except that you can specify which types should be returned. This is the same as except that you can specify which value types should be returned. See for possible values. This method allows the appliance's user to change the configuration for the virtual system descriptions. For each array item returned from , you must pass in one boolean value and one configuration value. Each item in the boolean array determines whether the particular configuration item should be enabled. You can only disable items of the types HardDiskControllerIDE, HardDiskControllerSATA, HardDiskControllerSCSI, HardDiskImage, CDROM, Floppy, NetworkAdapter, USBController and SoundCard. For the "vbox" and "extra configuration" values, if you pass in the same arrays as returned in the aVBoxValues and aExtraConfigValues arrays from getDescription(), the configuration remains unchanged. Please see the documentation for getDescription() for valid configuration values for the individual array item types. If the corresponding item in the aEnabled array is @c false, the configuration value is ignored. This method adds an additional description entry to the stack of already available descriptions for this virtual system. This is handy for writing values which aren't directly supported by VirtualBox. One example would be the License type of .
Updates the flag whether saved state is removed on a machine state change from Saved to PoweredOff. 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. Transfers success (@c null) or error information for this session. This method updates the progress object to signal completion of the method if appropriate, which means that the progress object returned by . 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). Requests a capture of the given host USB device. When the request is completed, the VM process will get a notification. 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 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. Requests a capture all matching USB devices attached to the host. When the request is completed, the VM process will get a notification per every captured device. 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. Triggered by the given session object when the session is about to close normally. Session that is being closed 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. Called by the VM process to inform the server it wants to save the current state and stop the VM execution. Progress object created by the VM process to wait until the state is saved. File path the VM process must save the execution state to. Called by the VM process to inform the server that saving the state previously requested by #beginSavingState is either successfully finished or there was a failure. Settings file not accessible. Could not parse the settings file. @c true to indicate success and @c false otherwise. Gets called by IConsole::adoptSavedState. Invalid saved state file path. Path to the saved state file to adopt. Called from the VM process to request from the server to perform the server-side actions of creating a snapshot (creating differencing images and the snapshot object). Settings file not accessible. Could not parse the settings file. The console object that initiated this call. Snapshot name. Snapshot description. Progress object created by the VM process tracking the snapshot's progress. This has the following sub-operations:
  • setting up (weight 1);
  • one for each medium attachment that needs a differencing image (weight 1 each);
  • another one to copy the VM state (if offline with saved state, weight is VM memory size in MB);
  • another one to save the VM state (if online, weight is VM memory size in MB);
  • finishing up (weight 1)
Whether this is an online snapshot (i.e. the machine is running). File path the VM process must save the execution state to.
Called by the VM process to inform the server that the snapshot previously requested by #beginTakingSnapshot is either successfully taken or there was a failure. @c true to indicate success and @c false otherwise Gets called by IConsole::deleteSnapshot. Snapshot has more than one child snapshot. The console object that initiated this call. UUID of the snapshot to discard. New machine state after this operation is started. Progress object to track the operation completion. Gets called by IConsole::RestoreSnapshot. The console object that initiated this call. The snapshot to restore the VM state from. New machine state after this operation is started. Progress object to track the operation completion. 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. The names of the properties returned. The values of the properties returned. The array entries match the corresponding entries in the @a name array. The time stamps of the properties returned. The array entries match the corresponding entries in the @a name array. The flags of the properties returned. The array entries match the corresponding entries in the @a name array. Set the list of the guest properties matching a set of patterns along with their values, time stamps and flags and return responsibility for managing properties to IMachine. The names of the properties. The values of the properties. The array entries match the corresponding entries in the @a name array. The time stamps of the properties. The array entries match the corresponding entries in the @a name array. The flags of the properties. The array entries match the corresponding entries in the @a name array. Update a single guest property in IMachine. The name of the property to be updated. The value of the property. The timestamp of the property. The flags of the property. 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. Unlocks all media previously locked using . This method is intended to be used with teleportation so that it is possible to teleport between processes on the same machine.
The IBIOSSettings interface represents BIOS settings of the virtual machine. This is used only in the attribute. Fade in flag for BIOS logo animation. Fade out flag for BIOS logo animation. BIOS logo display time in milliseconds (0 = default). Local file system path for external BIOS splash image. Empty string means the default image is shown on boot. Mode of the BIOS boot device menu. ACPI support flag. IO APIC support flag. If set, VirtualBox will provide an IO APIC and support IRQs above 15. 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 logging flag. If set, VirtualBox will write extensive PXE trace information to the release log. The IMachine interface represents a virtual machine, or guest, created in VirtualBox. This interface is used in two contexts. First of all, a collection of objects implementing this interface is stored in the attribute which lists all the virtual machines that are currently registered with this VirtualBox installation. Also, once a session has been opened for the given virtual machine (e.g. the virtual machine is running), the machine object associated with the open session can be queried from the session object; see for details. The main role of this interface is to expose the settings of the virtual machine and provide methods to change various aspects of the virtual machine's configuration. For machine objects stored in the collection, all attributes are read-only unless explicitly stated otherwise in individual attribute and method descriptions. In order to change a machine setting, a session for this machine must be opened using one of , or methods. After the session has been successfully opened, a mutable machine object needs to be queried from the session object and then the desired settings changes can be applied to the returned object using IMachine attributes and methods. See the interface description for more information about sessions. Note that IMachine does not provide methods to control virtual machine execution (such as start the machine, or power it down) -- these methods are grouped in a separate interface called . ISession, IConsole Associated parent object. Whether this virtual machine is currently accessible or not. A machine is always deemed accessible unless it is registered and its settings file cannot be read or parsed (either because the file itself is unavailable or has invalid XML contents). Every time this property is read, the accessibility state of this machine is re-evaluated. If the returned value is @c false, the property may be used to get the detailed error information describing the reason of inaccessibility, including XML error messages. When the machine is inaccessible, only the following properties can be used on it:
An attempt to access any other property or method will return an error. The only possible action you can perform on an inaccessible machine is to unregister it using the call (or, to check for the accessibility state once more by querying this property). In the current implementation, once this property returns @c true, the machine will never become inaccessible later, even if its settings file cannot be successfully read/written any more (at least, until the VirtualBox server is restarted). This limitation may be removed in future releases.
Error information describing the reason of machine inaccessibility. Reading this property is only valid after the last call to returned @c false (i.e. the machine is currently unaccessible). Otherwise, a @c null IVirtualBoxErrorInfo object will be returned. Name of the virtual machine. Besides being used for human-readable identification purposes everywhere in VirtualBox, the virtual machine name is also used as a name of the machine's settings file and as a name of the subdirectory this settings file resides in. Thus, every time you change the value of this property, the settings file will be renamed once you call to confirm the change. The containing subdirectory will be also renamed, but only if it has exactly the same name as the settings file itself prior to changing this property (for backward compatibility with previous API releases). The above implies the following limitations:
  • The machine name cannot be empty.
  • The machine name can contain only characters that are valid file name characters according to the rules of the file system used to store VirtualBox configuration.
  • You cannot have two or more machines with the same name if they use the same subdirectory for storing the machine settings files.
  • You cannot change the name of the machine if it is running, or if any file in the directory containing the settings file is being used by another running machine or by any other process in the host operating system at a time when is called.
If any of the above limitations are hit, will return an appropriate error message explaining the exact reason and the changes you made to this machine will not be saved. For "legacy" machines created using the call, the above naming limitations do not apply because the machine name does not affect the settings file name. The settings file name remains the same as it was specified during machine creation and never changes.
Description of the virtual machine. The description attribute can contain any text and is typically used to describe the hardware and software configuration of the virtual machine in detail (i.e. network settings, versions of the installed software and so on). UUID of the virtual machine. User-defined identifier of the Guest OS type. You may use to obtain an IGuestOSType object representing details about the given Guest OS type. This value may differ from the value returned by if Guest Additions are installed to the guest OS. Hardware version identifier. Internal use only for now. The UUID presented to the guest via memory tables, hardware and guest properties. For most VMs this is the same as the @a id, but for VMs which have been cloned or teleported it may be the same as the source VM. This latter is because the guest shouldn't notice that it was cloned or teleported. Number of virtual CPUs in the VM. This setting determines whether VirtualBox allows CPU hotplugging for this machine. System memory size in megabytes. Initial memory balloon size in megabytes. Initial interval to update guest statistics in seconds. Video memory size in megabytes. This setting determines whether VirtualBox allows this machine to make use of the 3D graphics support available on the host. This setting determines whether VirtualBox allows this machine to make use of the 2D video acceleration support available on the host. Number of virtual monitors. Only effective on Windows XP and later guests with Guest Additions installed. Object containing all BIOS settings. Type of firmware (such as legacy BIOS or EFI), used for initial bootstrap in this VM. Type of pointing HID (such as mouse or tablet) used in this VM. The default is typically "PS2Mouse" but can vary depending on the requirements of the guest operating system. Type of keyboard HID used in this VM. The default is typically "PS2Keyboard" but can vary depending on the requirements of the guest operating system. This attribute controls if High Precision Event Timer (HPET) is enabled in this VM. Use this property if you want to provide guests with additional time source, or if guest requires HPET to function correctly. Default is false. Full path to the directory used to store snapshot data (differencing media and saved state files) of this machine. The initial value of this property is < path_to_settings_file>/< machine_uuid >. Currently, it is an error to try to change this property on a machine that has snapshots (because this would require to move possibly large files to a different location). A separate method will be available for this purpose later. Setting this property to @c null or to an empty string will restore the initial value. When setting this property, the specified path can be absolute (full path) or relative to the directory where the machine settings file is located. When reading this property, a full path is always returned. The specified path may not exist, it will be created when necessary. VRDP server object. Array of media attached to this machine. Associated USB controller object. If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. Associated audio adapter, always present. Array of storage controllers attached to this machine. Full name of the file containing machine settings data. Whether the settings of this machine have been modified (but neither yet saved nor discarded). Reading this property is only valid on instances returned by and on new machines created by or opened by but not yet registered, or on unregistered machines after calling . For all other cases, the settings can never be modified. For newly created unregistered machines, the value of this property is always @c true until is called (no matter if any machine settings have been changed after the creation or not). For opened machines the value is set to @c false (and then follows to normal rules). Current session state for this machine. Type of the session. If is SessionSpawning or SessionOpen, this attribute contains the same value as passed to the method in the @a type parameter. If the session was opened directly using , or if is SessionClosed, the value of this attribute is an empty string. Identifier of the session process. This attribute contains the platform-dependent identifier of the process that has opened a direct session for this machine using the call. The returned value is only valid if is SessionOpen or SessionClosing (i.e. a session is currently open or being closed) by the time this property is read. Current execution state of this machine. Time stamp of the last execution state change, in milliseconds since 1970-01-01 UTC. Full path to the file that stores the execution state of the machine when it is in the state. When the machine is not in the Saved state, this attribute is an empty string. Full path to the folder that stores a set of rotated log files recorded during machine execution. The most recent log file is named VBox.log, the previous log file is named VBox.log.1 and so on (up to VBox.log.3 in the current version). Current snapshot of this machine. This is @c null if the machine currently has no snapshots. If it is not @c null, then it was set by one of , or , depending on which was called last. See for details. Number of snapshots taken on this machine. Zero means the machine doesn't have any snapshots. Returns @c true if the current state of the machine is not identical to the state stored in the current snapshot. The current state is identical to the current snapshot only directly after one of the following calls are made:
  • (issued on a "powered off" or "saved" machine, for which returns @c false)
The current state remains identical until one of the following happens:
  • settings of the machine are changed
  • the saved state is discarded
  • the current snapshot is discarded
  • an attempt to execute the machine is made
For machines that don't have snapshots, this property is always @c false.
Collection of shared folders for this machine (permanent shared folders). These folders are shared automatically at machine startup and available only to the guest OS installed within this machine. New shared folders are added to the collection using . Existing shared folders can be removed using . Synchronization mode between the host OS clipboard and the guest OS clipboard. A comma-separated list of simple glob patterns. Changes to guest properties whose name matches one of the patterns will generate an signal. When set to @a true, the virtual machine becomes a target teleporter the next time it is powered on. This can only set to @a true when the VM is in the @a PoweredOff or @a Aborted state. The TCP port the target teleporter will listen for incoming teleportations on. 0 means the port is automatically selected upon power on. The actual value can be read from this property while the machine is waiting for incoming teleportations. The address the target teleporter will listen on. If set to an empty string, it will listen on all addresses. The password the to check for on the target teleporter. This is just a very basic measure to prevent simple hacks and operators accidentally beaming a virtual machine to the wrong place. When set to @a true, the RTC device of the virtual machine will run in UTC time, otherwise in local time. Especially Unix guests prefer the time in UTC. Puts the given device to the specified position in the boot order. To indicate that no device is associated with the given position, should be used. @todo setHardDiskBootOrder(), setNetworkBootOrder() Boot @a position out of range. Booting from USB @a device currently not supported. Position in the boot order (@c 1 to the total number of devices the machine can boot from, as returned by ). The type of the device used to boot at the given position. Returns the device type that occupies the specified position in the boot order. @todo [remove?] If the machine can have more than one device of the returned type (such as hard disks), then a separate method should be used to retrieve the individual device that occupies the given position. If here are no devices at the given position, then is returned. @todo getHardDiskBootOrder(), getNetworkBootOrder() Boot @a position out of range. Position in the boot order (@c 1 to the total number of devices the machine can boot from, as returned by ). Device at the given position. Attaches a device and optionally mounts a medium to the given storage controller (, identified by @a name), at the indicated port and device. This method is intended for managing storage devices in general (it works for both fixed and removable media). For storage devices supporting removable media (such as DVDs and floppies), you can also use for changing the media while the machine is running. For the IDE bus, the @a controllerPort parameter can be either @c 0 or @c 1, to specify the primary or secondary IDE controller, respectively. For each of these, @a device can then be either @c 0 or @c 1, to specify the master or the slave device, respectively. (In the default configuration of virtual machines, the secondary master is used for a CD/DVD drive.) For an SATA controller, @a controllerPort must be a number ranging from @c 0 to @c 29. For a SCSI controller, @a controllerPort must be a number ranging from @c 0 to @c 15. For both SCSI and SATA, the @a device parameter is unused and must be @c 0. For fixed media such as hard disks, the given medium identifier cannot be a zero UUID. It may be a zero UUID for removable media such as DVDs and floppies. After calling this returns successfully, a new instance of will appear in the machine's list of medium attachments (). The specified device slot must not have a device attached to it, or this method will fail. See and for more information about attaching media. You cannot attach a device to a running machine. Also, you cannot attach a device to a newly created machine until this machine's settings are saved to disk using . If the medium is being attached indirectly, a new differencing medium will implicitly be created for it and attached instead. If the changes made to the machine settings (including this indirect attachment) are later cancelled using , this implicitly created differencing medium will implicitly be deleted. SATA device, SATA port, IDE port or IDE slot out of range. Attempt to attach medium to an unregistered virtual machine. Invalid machine state. Hard disk already attached to this or another virtual machine. Name of the storage controller to attach the device to. Port to attach the device to. Device slot in the given port to attach the device to. Device type of the attached device. UUID of the medium to mount. Zero UUID means do not mount any medium. Detaches the device attached to a device slot of the specified bus. Detaching the device from the virtual machine is deferred. This means that the medium remains associated with the machine when this method returns and gets actually de-associated only after a successful call. See for more detailed information about attaching media. You cannot detach a device from a running machine. Detaching differencing media implicitly created by for the indirect attachment using this method will not implicitly delete them. The operation should be explicitly performed by the caller after the medium is successfully detached and the settings are saved with , if it is the desired action. Attempt to detach medium from a running virtual machine. No medium attached to given slot/bus. Medium format does not support storage deletion. Name of the storage controller to detach the medium from. Port number to detach the medium from. Device slot number to detach the medium from. Sets the passthrough mode of an existing DVD device. Changing the setting while the VM is running is forbidden. The setting is only used if at VM start the device is configured as a host DVD drive, in all other cases it is ignored. The device must already exist; see for how to attach a new device. The @a controllerPort and @a device parameters specify the device slot and have have the same meaning as with . SATA device, SATA port, IDE port or IDE slot out of range. Attempt to modify an unregistered virtual machine. Invalid machine state. Name of the storage controller. Storage controller port. Device slot in the given port. New value for the passthrough setting. Mounts a medium (, identified by the given UUID @a id) to the given storage controller (, identified by @a name), at the indicated port and device. The device must already exist; see for how to attach a new device. This method is intended only for managing removable media, where the device is fixed but media is changeable at runtime (such as DVDs and floppies). It cannot be used for fixed media such as hard disks. The @a controllerPort and @a device parameters specify the device slot and have have the same meaning as with . The specified device slot can have a medium mounted, which will be unmounted first. Specifying a zero UUID (or an empty string) for @a medium does just an unmount. See for more detailed information about attaching media. SATA device, SATA port, IDE port or IDE slot out of range. Attempt to attach medium to an unregistered virtual machine. Invalid machine state. Medium already attached to this or another virtual machine. Name of the storage controller to attach the medium to. Port to attach the medium to. Device slot in the given port to attach the medium to. UUID of the medium to attach. A zero UUID means unmount the currently mounted medium. Allows to force unmount/mount of a medium which is locked by theDevice slot in the given port to attach the medium to. Returns the virtual medium attached to a device slot of the specified bus. Note that if the medium was indirectly attached by to the given device slot then this method will return not the same object as passed to the call. See for more detailed information about mounting a medium. No medium attached to given slot/bus. Name of the storage controller the medium is attached to. Port to query. Device slot in the given port to query. Attached medium object. Returns an array of medium attachments which are attached to the the controller with the given name. A storage controller with given name doesn't exist. Returns a medium attachment which corresponds to the controller with the given name, on the given port and device slot. No attachment exists for the given controller/port/device combination. Returns the network adapter associated with the given slot. Slots are numbered sequentially, starting with zero. The total number of adapters per machine is defined by the property, so the maximum slot number is one less than that property's value. Invalid @a slot number. Adds a new storage controller (SCSI or SATA controller) to the machine and returns it as an instance of . @a name identifies the controller for subsequent calls such as , , , or . After the controller has been added, you can set its exact type by setting the . A storage controller with given name exists already. Invalid @a controllerType. Returns a storage controller with the given name. A storage controller with given name doesn't exist. Returns a storage controller with the given instance number. A storage controller with given instance number doesn't exist. Removes a storage controller from the machine. A storage controller with given name doesn't exist. Returns the serial port associated with the given slot. Slots are numbered sequentially, starting with zero. The total number of serial ports per machine is defined by the property, so the maximum slot number is one less than that property's value. Invalid @a slot number. Returns the parallel port associated with the given slot. Slots are numbered sequentially, starting with zero. The total number of parallel ports per machine is defined by the property, so the maximum slot number is one less than that property's value. Invalid @a slot number. Returns an array representing the machine-specific extra data keys which currently have values defined. Array of extra data keys. Returns associated machine-specific extra data. If the requested data @a key does not exist, this function will succeed and return an empty string in the @a value argument. Settings file not accessible. Could not parse the settings file. Name of the data key to get. Value of the requested data key. Sets associated machine-specific extra data. If you pass @c null or an empty string as a key @a value, the given @a key will be deleted. Before performing the actual data change, this method will ask all registered callbacks using the notification for a permission. If one of the callbacks refuses the new value, the change will not be performed. On success, the notification is called to inform all registered callbacks about a successful data change. This method can be called outside the machine session and therefore it's a caller's responsibility to handle possible race conditions when several clients change the same key at the same time. Settings file not accessible. Could not parse the settings file. Name of the data key to set. Value to assign to the key. Returns the virtual CPU boolean value of the specified property. Invalid property. Property type to query. Property value. Sets the virtual CPU boolean value of the specified property. Invalid property. Property type to query. Property value. Returns the virtual CPU cpuid information for the specified leaf. Currently supported index values for cpuid: Standard CPUID leafs: 0 - 0xA Extended CPUID leafs: 0x80000000 - 0x8000000A See the Intel and AMD programmer's manuals for detailed information about the cpuid instruction and its leafs. Invalid id. Cpuid leaf index. Cpuid leaf value for register eax. Cpuid leaf value for register ebx. Cpuid leaf value for register ecx. Cpuid leaf value for register edx. Sets the virtual CPU cpuid information for the specified leaf. Note that these values are not passed unmodified. VirtualBox clears features that it doesn't support. Currently supported index values for cpuid: Standard CPUID leafs: 0 - 0xA Extended CPUID leafs: 0x80000000 - 0x8000000A See the Intel and AMD programmer's manuals for detailed information about the cpuid instruction and its leafs. Do not use this method unless you know exactly what you're doing. Misuse can lead to random crashes inside VMs. Invalid id. Cpuid leaf index. Cpuid leaf value for register eax. Cpuid leaf value for register ebx. Cpuid leaf value for register ecx. Cpuid leaf value for register edx. Removes the virtual CPU cpuid leaf for the specified index Invalid id. Cpuid leaf index. Removes all the virtual CPU cpuid leafs Returns the value of the specified hardware virtualization boolean property. Invalid property. Property type to query. Property value. Sets a new value for the specified hardware virtualization boolean property. Invalid property. Property type to set. New property value. Saves any changes to machine settings made since the session has been opened or a new machine has been created, or since the last call to or . For registered machines, new settings become visible to all other VirtualBox clients after successful invocation of this method. The method sends notification event after the configuration has been successfully saved (only for registered machines). Calling this method is only valid on instances returned by and on new machines created by but not yet registered, or on unregistered machines after calling . Settings file not accessible. Could not parse the settings file. Modification request refused. Discards any changes to the machine settings made since the session has been opened or since the last call to or . Calling this method is only valid on instances returned by and on new machines created by or opened by but not yet registered, or on unregistered machines after calling . Virtual machine is not mutable. Deletes the settings file of this machine from disk. The machine must not be registered in order for this operation to succeed. will return @c true after this method successfully returns. Calling this method is only valid on instances returned by and on new machines created by or opened by but not yet registered, or on unregistered machines after calling . The deleted machine settings file can be restored (saved again) by calling . Cannot delete settings of a registered machine or machine not mutable. Could not delete the settings file. Exports the machine to an OVF appliance. See for the steps required to export VirtualBox machines to OVF. Appliance to export this machine to. VirtualSystemDescription object which is created for this machine. Returns a snapshot of this machine with the given UUID. A @c null UUID can be used to obtain the first snapshot taken on this machine. This is useful if you want to traverse the whole tree of snapshots starting from the root. Virtual machine has no snapshots or snapshot not found. UUID of the snapshot to get Snapshot object with the given UUID. Returns a snapshot of this machine with the given name. Virtual machine has no snapshots or snapshot not found. Name of the snapshot to find Snapshot object with the given name. Sets the current snapshot of this machine. In the current implementation, this operation is not implemented. UUID of the snapshot to set as the current snapshot. Creates a new permanent shared folder by associating the given logical name with the given host path, adds it to the collection of shared folders and starts sharing it. Refer to the description of to read more about logical names. Shared folder already exists. Shared folder @a hostPath not accessible. Unique logical name of the shared folder. Full path to the shared folder in the host file system. Whether the share is writable or readonly Removes the permanent shared folder with the given name previously created by from the collection of shared folders and stops sharing it. Virtual machine is not mutable. Shared folder @a name does not exist. Logical name of the shared folder to remove. Returns @c true if the VM console process can activate the console window and bring it to foreground on the desktop of the host PC. This method will fail if a session for this machine is not currently open. Machine session is not open. @c true if the console window can be shown and @c false otherwise. Activates the console window and brings it to foreground on the desktop of the host PC. Many modern window managers on many platforms implement some sort of focus stealing prevention logic, so that it may be impossible to activate a window without the help of the currently active application. In this case, this method will return a non-zero identifier that represents the top-level window of the VM console process. The caller, if it represents a currently active process, is responsible to use this identifier (in a platform-dependent manner) to perform actual window activation. This method will fail if a session for this machine is not currently open. Machine session is not open. Platform-dependent identifier of the top-level VM console window, or zero if this method has performed all actions necessary to implement the show window semantics for the given platform and/or VirtualBox front-end. Reads an entry from the machine's guest property store. Machine session is not open. The name of the property to read. The value of the property. If the property does not exist then this will be empty. The time at which the property was last modified, as seen by the server process. Additional property parameters, passed as a comma-separated list of "name=value" type entries. Reads a value from the machine's guest property store. Machine session is not open. The name of the property to read. The value of the property. If the property does not exist then this will be empty. Reads a property timestamp from the machine's guest property store. Machine session is not open. The name of the property to read. The timestamp. If the property does not exist then this will be empty. Sets, changes or deletes an entry in the machine's guest property store. Property cannot be changed. Invalid @a flags. Virtual machine is not mutable or session not open. Cannot set transient property when machine not running. The name of the property to set, change or delete. The new value of the property to set, change or delete. If the property does not yet exist and value is non-empty, it will be created. If the value is @c null or empty, the property will be deleted if it exists. Additional property parameters, passed as a comma-separated list of "name=value" type entries. Sets, changes or deletes a value in the machine's guest property store. The flags field will be left unchanged or created empty for a new property. Property cannot be changed. Virtual machine is not mutable or session not open. Cannot set transient property when machine not running. The name of the property to set, change or delete. The new value of the property to set, change or delete. If the property does not yet exist and value is non-empty, it will be created. If the value is @c null or empty, the property will be deleted if it exists. Return a list of the guest properties matching a set of patterns along with their values, time stamps and flags. The patterns to match the properties against, separated by '|' characters. If this is empty or @c null, all properties will match. The names of the properties returned. The values of the properties returned. The array entries match the corresponding entries in the @a name array. The time stamps of the properties returned. The array entries match the corresponding entries in the @a name array. The flags of the properties returned. The array entries match the corresponding entries in the @a name array. Returns size in bytes and dimensions in pixels of a saved thumbnail bitmap from saved state. Size of buffer required to store the bitmap. Bitmap width. Bitmap height. Thumbnail is retrieved to an array of bytes in uncompressed 32-bit BGRA or RGBA format. How to order bytes in the pixel. A pixel consists of 4 bytes. If this parameter is true, then bytes order is: B, G, R, 0xFF. If this parameter is false, then bytes order is: R, G, B, 0xFF. Bitmap width. Bitmap height. Array with resulting bitmap data. Returns size in bytes and dimensions of a saved PNG image of screenshot from saved state. Size of buffer required to store the PNG binary data. Image width. Image height. Screenshot in PNG format is retrieved to an array of bytes. Image width. Image height. Array with resulting PNG data. Plugs a CPU into the machine. The CPU id to insert. Removes a CPU from the machine. The CPU id to remove. Plugs a CPU into the machine. The CPU id to check for. Status of the CPU.
This interface is used by a client of the Main API that need to be notified of events. For example, a graphical user interface can use this to learn about machine state changes so they can update the list of virtual machines without having to rely on polling. Whenever relevant events occur in VirtualBox, the callbacks in objects of this interface are called. In order for this to be useful, a client needs to create its own subclass that implements this interface in which the methods for the relevant callbacks are overridden. An instance of this subclass interface can then be passed to . Notification when the guest mouse pointer shape has changed. The new shape data is given. Flag whether the pointer is visible. Flag whether the pointer has an alpha channel. The pointer hot spot x coordinate. The pointer hot spot y coordinate. Width of the pointer shape in pixels. Height of the pointer shape in pixels. Address of the shape buffer. 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. Notification when the mouse capabilities reported by the guest have changed. The new capabilities are passed. Notification when the guest OS executes the KBD_CMD_SET_LEDS command to alter the state of the keyboard LEDs. Notification when the execution state of the machine has changed. The new state will be given. Notification when a Guest Additions property changes. Interested callees should query IGuest attributes to find out what has changed. Notification when a property of one of the virtual network adapters changes. Interested callees should use INetworkAdapter methods and attributes to find out what has changed. Network adapter that is subject to change. Notification when a property of one of the virtual serial ports changes. Interested callees should use ISerialPort methods and attributes to find out what has changed. Serial port that is subject to change. Notification when a property of one of the virtual parallel ports changes. Interested callees should use ISerialPort methods and attributes to find out what has changed. Parallel port that is subject to change. Notification when a property of one of the virtual storage controllers changes. Interested callees should query the corresponding collections to find out what has changed. Notification when a medium attachment changes. Medium attachment that is subject to change. Notification when a CPU changes. The CPU which changed Flag whether the CPU was added or removed Notification when a property of the VRDP server changes. Interested callees should use IVRDPServer methods and attributes to find out what has changed. Notification when the status of the VRDP server changes. Interested callees should use IRemoteDisplayInfo attributes to find out what is the current status. Notification when a property of the virtual USB controller changes. Interested callees should use IUSBController methods and attributes to find out what has changed. Notification when a USB device is attached to or detached from the virtual USB controller. This notification is sent as a result of the indirect request to attach the device because it matches one of the machine USB filters, or as a result of the direct request issued by or . This notification is sent in case of both a succeeded and a failed request completion. When the request succeeds, the @a error parameter is @c null, and the given device has been already added to (when @a attached is @c true) or removed from (when @a attached is @c false) the collection represented by . On failure, the collection doesn't change and the @a error parameter represents the error message describing the failure. Device that is subject to state change. @c true if the device was attached and @c false otherwise. @c null on success or an error message object on failure. Notification when a shared folder is added or removed. The @a scope argument defines one of three scopes: global shared folders (Global), permanent shared folders of the machine (Machine) or transient shared folders of the machine (Session). Interested callees should use query the corresponding collections to find out what has changed. Scope of the notification. Notification when an error happens during the virtual machine execution. There are three kinds of runtime errors:
  • fatal
  • non-fatal with retry
  • non-fatal warnings
Fatal errors are indicated by the @a fatal parameter set to @c true. In case of fatal errors, the virtual machine execution is always paused before calling this notification, and the notification handler is supposed either to immediately save the virtual machine state using or power it off using . Resuming the execution can lead to unpredictable results. Non-fatal errors and warnings are indicated by the @a fatal parameter set to @c false. If the virtual machine is in the Paused state by the time the error notification is received, it means that the user can try to resume the machine execution after attempting to solve the problem that caused the error. In this case, the notification handler is supposed to show an appropriate message to the user (depending on the value of the @a id parameter) that offers several actions such as Retry, Save or Power Off. If the user wants to retry, the notification handler should continue the machine execution using the call. If the machine execution is not Paused during this notification, then it means this notification is a warning (for example, about a fatal condition that can happen very soon); no immediate action is required from the user, the machine continues its normal execution. Note that in either case the notification handler must not perform any action directly on a thread where this notification is called. Everything it is allowed to do is to post a message to another thread that will then talk to the user and take the corresponding action. Currently, the following error identifiers are known:
  • "HostMemoryLow"
  • "HostAudioNotResponding"
  • "VDIStorageFull"
  • "3DSupportIncompatibleAdditions"
This notification is not designed to be implemented by more than one callback at a time. If you have multiple IConsoleCallback instances registered on the given IConsole object, make sure you simply do nothing but return @c S_OK from all but one of them that does actual user notification and performs necessary actions.
Whether the error is fatal or not Error identifier Optional error message
Notification when a call to is made by a front-end to check if a subsequent call to can succeed. The callee should give an answer appropriate to the current machine state in the @a canShow argument. This answer must remain valid at least until the next machine state change. This notification is not designed to be implemented by more than one callback at a time. If you have multiple IConsoleCallback instances registered on the given IConsole object, make sure you simply do nothing but return @c true and @c S_OK from all but one of them that actually manages console window activation. @c true if the console window can be shown and @c false otherwise. Notification when a call to requests the console window to be activated and brought to foreground on the desktop of the host PC. This notification should cause the VM console process to perform the requested action as described above. If it is impossible to do it at a time of this notification, this method should return a failure. Note that many modern window managers on many platforms implement some sort of focus stealing prevention logic, so that it may be impossible to activate a window without the help of the currently active application (which is supposedly an initiator of this notification). In this case, this method must return a non-zero identifier that represents the top-level window of the VM console process. The caller, if it represents a currently active process, is responsible to use this identifier (in a platform-dependent manner) to perform actual window activation. This method must set @a winId to zero if it has performed all actions necessary to complete the request and the console window is now active and in foreground, to indicate that no further action is required on the caller's side. This notification is not designed to be implemented by more than one callback at a time. If you have multiple IConsoleCallback instances registered on the given IConsole object, make sure you simply do nothing but return @c S_OK from all but one of them that actually manages console window activation. Platform-dependent identifier of the top-level VM console window, or zero if this method has performed all actions necessary to implement the show window semantics for the given platform and/or this VirtualBox front-end.
Contains information about the remote display (VRDP) capabilities and status. This is used in the attribute. Whether the remote display connection is active. VRDP server port number. If this property is equal to 0, then the VRDP server failed to start, usually because there are no free TCP ports to bind to. If this property is equal to -1, then the VRDP server has not yet been started. How many times a client connected. When the last connection was established, in milliseconds since 1970-01-01 UTC. When the last connection was terminated or the current time, if connection is still active, in milliseconds since 1970-01-01 UTC. How many bytes were sent in last or current, if still active, connection. How many bytes were sent in all connections. How many bytes were received in last or current, if still active, connection. How many bytes were received in all connections. Login user name supplied by the client. Login domain name supplied by the client. The client name supplied by the client. The IP address of the client. The client software version number. Public key exchange method used when connection was established. Values: 0 - RDP4 public key exchange scheme. 1 - X509 certificates were sent to client. The IConsole interface represents an interface to control virtual machine execution. The console object that implements the IConsole interface is obtained from a session object after the session for the given machine has been opened using one of , or methods. Methods of the IConsole interface allow the caller to query the current virtual machine execution state, pause the machine or power it down, save the machine state or take a snapshot, attach and detach removable media and so on. ISession Machine object this console is sessioned with. This is a convenience property, it has the same value as of the corresponding session object. Current execution state of the machine. This property always returns the same value as the corresponding property of the IMachine object this console is sessioned with. For the process that owns (executes) the VM, this is the preferable way of querying the VM state, because no IPC calls are made. Guest object. Virtual keyboard object. If the machine is not running, any attempt to use the returned object will result in an error. Virtual mouse object. If the machine is not running, any attempt to use the returned object will result in an error. Virtual display object. If the machine is not running, any attempt to use the returned object will result in an error. Debugging interface. Collection of USB devices currently attached to the virtual USB controller. The collection is empty if the machine is not running. List of USB devices currently attached to the remote VRDP client. Once a new device is physically attached to the remote host computer, it appears in this list and remains there until detached. Collection of shared folders for the current session. These folders are called transient shared folders because they are available to the guest OS running inside the associated virtual machine only for the duration of the session (as opposed to which represent permanent shared folders). When the session is closed (e.g. the machine is powered down), these folders are automatically discarded. New shared folders are added to the collection using . Existing shared folders can be removed using . Interface that provides information on Remote Display (VRDP) connection. Starts the virtual machine execution using the current machine state (that is, its current execution state, current settings and current storage devices). If the machine is powered off or aborted, the execution will start from the beginning (as if the real hardware were just powered on). If the machine is in the state, it will continue its execution the point where the state has been saved. Unless you are trying to write a new VirtualBox front-end that performs direct machine execution (like the VirtualBox or VBoxSDL front-ends), don't call in a direct session opened by and use this session only to change virtual machine settings. If you simply want to start virtual machine execution using one of the existing front-ends (for example the VirtualBox GUI or headless server), simply use ; these front-ends will power up the machine automatically for you. #saveState Virtual machine already running. Host interface does not exist or name not set. Invalid saved state file. Progress object to track the operation completion. Identical to powerUp except that the VM will enter the state, instead of . #powerUp Virtual machine already running. Host interface does not exist or name not set. Invalid saved state file. Progress object to track the operation completion. Initiates the power down procedure to stop the virtual machine execution. The completion of the power down procedure is tracked using the returned IProgress object. After the operation is complete, the machine will go to the PoweredOff state. Virtual machine must be Running, Paused or Stuck to be powered down. Progress object to track the operation completion. Resets the virtual machine. Virtual machine not in Running state. Virtual machine error in reset operation. Pauses the virtual machine execution. Virtual machine not in Running state. Virtual machine error in suspend operation. Resumes the virtual machine execution. Virtual machine not in Paused state. Virtual machine error in resume operation. Sends the ACPI power button event to the guest. Virtual machine not in Running state. Controlled power off failed. Sends the ACPI sleep button event to the guest. Virtual machine not in Running state. Sending sleep button event failed. Checks if the last power button event was handled by guest. Checking if the event was handled by the guest OS failed. Checks if the guest entered the ACPI mode G0 (working) or G1 (sleeping). If this method returns @c false, the guest will most likely not respond to external ACPI events. Virtual machine not in Running state. Saves the current execution state of a running virtual machine and stops its execution. After this operation completes, the machine will go to the Saved state. Next time it is powered up, this state will be restored and the machine will continue its execution from the place where it was saved. This operation differs from taking a snapshot to the effect that it doesn't create new differencing media. Also, once the machine is powered up from the state saved using this method, the saved state is deleted, so it will be impossible to return to this state later. On success, this method implicitly calls to save all current machine settings (including runtime changes to the DVD medium, etc.). Together with the impossibility to change any VM settings when it is in the Saved state, this guarantees adequate hardware configuration of the machine when it is restored from the saved state file. The machine must be in the Running or Paused state, otherwise the operation will fail. Virtual machine state neither Running nor Paused. Failed to create directory for saved state file. Progress object to track the operation completion. Associates the given saved state file to the virtual machine. On success, the machine will go to the Saved state. Next time it is powered up, it will be restored from the adopted saved state and continue execution from the place where the saved state file was created. The specified saved state file path may be absolute or relative to the folder the VM normally saves the state to (usually, ). It's a caller's responsibility to make sure the given saved state file is compatible with the settings of this virtual machine that represent its virtual hardware (memory size, storage disk configuration etc.). If there is a mismatch, the behavior of the virtual machine is undefined. Virtual machine state neither PoweredOff nor Aborted. Path to the saved state file to adopt. Forgets the saved state of the virtual machine previously created by . Next time the machine is powered up, a clean boot will occur. If @a remove is @c true the saved state file is deleted. This operation is equivalent to resetting or powering off the machine without doing a proper shutdown in the guest OS. Virtual machine not in state Saved. If @c true remove the saved state file. Gets the current activity type of a given device or device group. Invalid device type. Attaches a host USB device with the given UUID to the USB controller of the virtual machine. The device needs to be in one of the following states: , or , otherwise an error is immediately returned. When the device state is Busy, an error may also be returned if the host computer refuses to release it for some reason. IUSBController::deviceFilters, USBDeviceState Virtual machine state neither Running nor Paused. Virtual machine does not have a USB controller. UUID of the host USB device to attach. Detaches an USB device with the given UUID from the USB controller of the virtual machine. After this method succeeds, the VirtualBox server re-initiates all USB filters as if the device were just physically attached to the host, but filters of this machine are ignored to avoid a possible automatic re-attachment. IUSBController::deviceFilters, USBDeviceState Virtual machine does not have a USB controller. USB device not attached to this virtual machine. UUID of the USB device to detach. Detached USB device. Searches for a USB device with the given host address. Given @c name does not correspond to any USB device. IUSBDevice::address Address of the USB device (as assigned by the host) to search for. Found USB device object. Searches for a USB device with the given UUID. Given @c id does not correspond to any USB device. IUSBDevice::id UUID of the USB device to search for. Found USB device object. Creates a transient new shared folder by associating the given logical name with the given host path, adds it to the collection of shared folders and starts sharing it. Refer to the description of to read more about logical names. Virtual machine in Saved state or currently changing state. Shared folder already exists or not accessible. Unique logical name of the shared folder. Full path to the shared folder in the host file system. Whether the share is writable or readonly Removes a transient shared folder with the given name previously created by from the collection of shared folders and stops sharing it. Virtual machine in Saved state or currently changing state. Shared folder does not exists. Logical name of the shared folder to remove. Saves the current execution state and all settings of the machine and creates differencing images for all normal (non-independent) media. See for an introduction to snapshots. This method can be called for a PoweredOff, Saved (see ), Running or Paused virtual machine. When the machine is PoweredOff, an offline snapshot is created. When the machine is Running a live snapshot is created, and an online snapshot is is created when Paused. The taken snapshot is always based on the current snapshot of the associated virtual machine and becomes a new current snapshot. This method implicitly calls to save all current machine settings before taking an offline snapshot. Virtual machine currently changing state. Short name for the snapshot. Optional description of the snapshot. Progress object to track the operation completion. Starts deleting the specified snapshot asynchronously. See for an introduction to snapshots. The execution state and settings of the associated machine stored in the snapshot will be deleted. The contents of all differencing media of this snapshot will be merged with the contents of their dependent child media to keep the medium chain valid (in other words, all changes represented by media being discarded will be propagated to their child medium). After that, this snapshot's differencing medium will be deleted. The parent of this snapshot will become a new parent for all its child snapshots. If the deleted snapshot is the current one, its parent snapshot will become a new current snapshot. The current machine state is not directly affected in this case, except that currently attached differencing media based on media of the discarded snapshot will be also merged as described above. If the deleted snapshot is the first or current snapshot, then the respective IMachine attributes will be adjusted. Deleting the current snapshot will also implicitly call to make all current machine settings permanent. Deleting a snapshot has the following preconditions:
  • Child media of all normal media of the discarded snapshot must be accessible (see ) for this operation to succeed. In particular, this means that all virtual machines, whose media are directly or indirectly based on the media of discarded snapshot, must be powered off.
  • You cannot delete the snapshot if a medium attached to it has more than once child medium (differencing images) because otherwise merging would be impossible. This might be the case if there is more than one child snapshot or differencing images were created for other reason (e.g. implicitly because of multiple machine attachments).
The virtual machine's state is changed to "DeletingSnapshot" while this operation is in progress. Merging medium contents can be very time and disk space consuming, if these media are big in size and have many children. However, if the snapshot being discarded is the last (head) snapshot on the branch, the operation will be rather quick. Virtual machine is running.
UUID of the snapshot to discard. Progress object to track the operation completion.
Starts resetting the machine's current state to the state contained in the given snapshot, asynchronously. All current settings of the machine will be reset and changes stored in differencing media will be lost. See for an introduction to snapshots. After this operation is successfully completed, new empty differencing media are created for all normal media of the machine. If the given snapshot is an online snapshot, the machine will go to the saved state, so that the next time it is powered on, the execution state will be restored from the state of the snapshot. The machine must not be running, otherwise the operation will fail. If the machine state is Saved prior to this operation, the saved state file will be implicitly discarded (as if were called). Virtual machine is running. The snapshot to restore the VM state from. Progress object to track the operation completion. Teleport the VM to a different host machine or process. TODO explain the details. Virtual machine not running or paused. The name or IP of the host to teleport to. The TCP port to connect to (1..65535). The password. The maximum allowed downtime given as milliseconds. 0 is not a valid value. Recommended value: 250 ms. The higher the value is, the greater the chance for a successful teleportation. A small value may easily result in the teleportation process taking hours and eventually fail. The current implementation treats this a guideline, not as an absolute rule. Progress object to track the operation completion. Registers a new console callback on this instance. The methods of the callback interface will be called by this instance when the appropriate event occurs. Unregisters the console callback previously registered using . Given @a callback handler is not registered.
Type of encapsulation. Ethernet encapsulation includes both wired and wireless Ethernet connections. IHostNetworkInterface The type of interface cannot be determined. Ethernet frame encapsulation. Point-to-point protocol encapsulation. Serial line IP encapsulation. Current status of the interface. IHostNetworkInterface The state of interface cannot be determined. The interface is fully operational. The interface is not functioning. Network interface type. Represents one of host's network interfaces. IP V6 address and network mask are strings of 32 hexdecimal digits grouped by four. Groups are separated by colons. For example, fe80:0000:0000:0000:021e:c2ff:fed2:b030. Returns the host network interface name. Returns the interface UUID. Returns the name of a virtual network the interface gets attached to. Specifies whether the DHCP is enabled for the interface. Returns the IP V4 address of the interface. Returns the network mask of the interface. Specifies whether the IP V6 is supported/enabled for the interface. Returns the IP V6 address of the interface. Returns the length IP V6 network mask prefix of the interface. Returns the hardware address. For Ethernet it is MAC address. Type of protocol encapsulation used. Status of the interface. specifies the host interface type. sets and enables the static IP V4 configuration for the given interface. IP address. network mask. sets and enables the static IP V6 configuration for the given interface. IP address. network mask. enables the dynamic IP configuration. refreshes the IP configuration for dhcp-enabled interface. The IHost interface represents the physical machine that this VirtualBox installation runs on. An object implementing this interface is returned by the attribute. This interface contains read-only information about the host's physical hardware (such as what processors and disks are available, what the host operating system is, and so on) and also allows for manipulating some of the host's hardware, such as global USB device filters and host interface networking. List of DVD drives available on the host. List of floppy drives available on the host. List of USB devices currently attached to the host. Once a new device is physically attached to the host computer, it appears in this list and remains there until detached. If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. List of USB device filters in action. When a new device is physically attached to the host computer, filters from this list are applied to it (in order they are stored in the list). The first matched filter will determine the action performed on the device. Unless the device is ignored by these filters, filters of all currently running virtual machines () are applied to it. If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. IHostUSBDeviceFilter, USBDeviceState List of host network interfaces currently defined on the host. Number of (logical) CPUs installed in the host system. Number of (logical) CPUs online in the host system. Query the (approximate) maximum speed of a specified host CPU in Megahertz. Identifier of the CPU. Speed value. 0 is returned if value is not known or @a cpuId is invalid. Query whether a CPU feature is supported or not. CPU Feature identifier. Feature is supported or not. Query the model string of a specified host CPU. Identifier of the CPU. The current implementation might not necessarily return the description for this exact CPU. Model string. An empty string is returned if value is not known or @a cpuId is invalid. Returns the CPU cpuid information for the specified leaf. Identifier of the CPU. The CPU most be online. The current implementation might not necessarily return the description for this exact CPU. Cpuid leaf index (eax). Cpuid leaf sub index (ecx). This currently only applies to cache information on Intel CPUs. Use 0 if retriving values for . Cpuid leaf value for register eax. Cpuid leaf value for register ebx. Cpuid leaf value for register ecx. Cpuid leaf value for register edx. Amount of system memory in megabytes installed in the host system. Available system memory in the host system. Name of the host system's operating system. Host operating system's version string. Returns the current host time in milliseconds since 1970-01-01 UTC. Returns @c true when the host supports 3D hardware acceleration. Creates a new adapter for Host Only Networking. Host network interface @a name already exists. Created host interface object. Progress object to track the operation completion. Removes the given Host Only Networking interface. No host network interface matching @a id found. Adapter GUID. Progress object to track the operation completion. 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 be added to the list of filters using . #USBDeviceFilters Filter name. See for more info. Created filter object. Inserts the given USB device to the specified position in the list of filters. Positions are numbered starting from @c 0. If the specified position is equal to or greater than the number of elements in the list, the filter is added at the end of the collection. Duplicates are not allowed, so an attempt to insert a filter already in the list is an error. If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. #USBDeviceFilters USB device filter is not created within this VirtualBox instance. USB device filter already in list. Position to insert the filter to. USB device filter to insert. Removes a USB device filter from the specified position in the list of filters. Positions are numbered starting from @c 0. Specifying a position equal to or greater than the number of elements in the list will produce an error. If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. #USBDeviceFilters USB device filter list empty or invalid @a position. Position to remove the filter from. Searches for a host DVD drive with the given @c name. Given @c name does not correspond to any host drive. Name of the host drive to search for Found host drive object Searches for a host floppy drive with the given @c name. Given @c name does not correspond to any host floppy drive. Name of the host floppy drive to search for Found host floppy drive object Searches through all host network interfaces for an interface with the given @c name. The method returns an error if the given @c name does not correspond to any host network interface. Name of the host network interface to search for. Found host network interface object. Searches through all host network interfaces for an interface with the given GUID. The method returns an error if the given GUID does not correspond to any host network interface. GUID of the host network interface to search for. Found host network interface object. Searches through all host network interfaces and returns a list of interfaces of the specified type type of the host network interfaces to search for. Found host network interface objects. Searches for a USB device with the given UUID. Given @c id does not correspond to any USB device. IHostUSBDevice::id UUID of the USB device to search for. Found USB device object. Searches for a USB device with the given host address. Given @c name does not correspond to any USB device. IHostUSBDevice::address Address of the USB device (as assigned by the host) to search for. Found USB device object. 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. Minimum guest system memory in Megabytes. Maximum guest system memory in Megabytes. Minimum guest video memory in Megabytes. Maximum guest video memory in Megabytes. Minimum CPU count. Maximum CPU count. Maximum of monitors which could be connected. Maximum size of a virtual disk image in Megabytes. Number of network adapters associated with every instance. Number of serial ports associated with every instance. Number of parallel ports associated with every instance. 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. Full path to the default directory used to create new or open existing machines when a settings file name contains no path. The initial value of this property is < VirtualBox_home>/Machines. Setting this property to @c null or an empty string will restore the initial value. When settings this property, the specified path can be absolute (full path) or relative to the VirtualBox home directory. When reading this property, a full path is always returned. The specified path may not exist, it will be created when necessary. , Full path to the default directory used to create new or open existing virtual disks. This path is used when the storage unit of a hard disk is a regular file in the host's file system and only a file name that contains no path is given. The initial value of this property is < VirtualBox_home >/HardDisks. Setting this property to @c null or empty string will restore the initial value. When settings this property, the specified path can be relative to the VirtualBox home directory or absolute. When reading this property, a full path is always returned. The specified path may not exist, it will be created when necessary. IMedium, , , List of all medium storage formats supported by this VirtualBox installation. Keep in mind that the medium format identifier () used in other API calls like 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. ,
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 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 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. , , Library that provides authentication for VRDP 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 "VRDPAuth". 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. 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 implementation. As opposed to , 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 will always succeed, no matter what user name and password are supplied. The initial value of this property is "VRDPAuth", meaning that the webservice will use the same authentication library that is used by default for VBoxVRDP (again, see ). The format and calling convention of authentication libraries is the same for the webservice as it is for VBoxVRDP. Setting this property to @c null or empty string will restore the initial value. This value specifies how many old release log files are kept. This value hold the default audio driver for the current system. Returns the maximum number of devices which can be attached to a port for the given storage bus. The storage bus type to get the value for. The maximum number of devices which can eb attached to the port for the given storage bus. Returns the minimum number of ports the given storage bus supports. The storage bus type to get the value for. The minimum number of ports for the given storage bus. Returns the maximum number of ports the given storage bus supports. The storage bus type to get the value for. The maximum number of ports for the given storage bus. 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. The storage bus type to get the value for. The maximum number of instances for the given storage bus. Returns list of all the supported device types () for the given type of storage bus. The storage bus type to get the value for. The list of all supported device types for the given storage bus.
Guest OS family identifier string. Human readable description of the guest OS family. Guest OS identifier string. Human readable description of the guest OS. Returns @c true if the given OS is 64-bit Returns @c true if IO APIC recommended for this OS type. Returns @c true if VT-x or AMD-V recommended for this OS type. Recommended RAM size in Megabytes. Recommended video RAM size in Megabytes. Recommended hard disk size in Megabytes. Returns recommended network adapter for this OS type. Returns @c true if using PAE is recommended for this OS type. Recommended storage controller type. Recommended firmware type. Returns @c true if using USB Human Interface Devices, such as keyboard and mouse recommended. Returns @c true if using HPET is recommended for this OS type. The IGuest interface represents information about the operating system running inside the virtual machine. Used in . IGuest provides information about the guest operating system, whether Guest Additions are installed and other OS-specific virtual machine properties. Identifier of the Guest OS type as reported by the Guest Additions. You may use to obtain an IGuestOSType object representing details about the given Guest OS type. If Guest Additions are not installed, this value will be the same as . Flag whether the Guest Additions are installed and active in which case their version will be returned by the property. Version of the Guest Additions (3 decimal numbers separated by dots) or empty when the Additions are not installed. The Additions may also report a version but yet not be active as the version might be refused by VirtualBox (incompatible) or other failures occurred. Flag whether seamless guest display rendering (seamless desktop integration) is supported. Flag whether the guest is in graphics mode. If it is not, then seamless rendering will not work, resize hints are not immediately acted on and guest display resizes are probably not initiated by the guest additions. Guest system memory balloon size in megabytes. Interval to update guest statistics in seconds. Store login credentials that can be queried by guest operating systems with Additions installed. The credentials are transient to the session and the guest may also choose to erase them. Note that the caller cannot determine whether the guest operating system has queried or made use of the credentials. VMM device is not available. User name string, can be empty Password string, can be empty Domain name (guest logon scheme specific), can be empty Flag whether the guest should alternatively allow the user to interactively specify different credentials. This flag might not be supported by all versions of the Additions. Query specified guest statistics as reported by the VirtualBox Additions. Virtual CPU id; not relevant for all statistic types Statistic type. Statistics value The IProgress interface is used to track and control asynchronous tasks within VirtualBox. An instance of this is returned every time VirtualBox starts an asynchronous task (in other words, a separate thread) which continues to run after a method call returns. For example, , which saves the state of a running virtual machine, can take a long time to complete. To be able to display a progress bar, a user interface such as the VirtualBox graphical user interface can use the IProgress object returned by that method. Note that IProgress is a "read-only" interface in the sense that only the VirtualBox internals behind the Main API can create and manipulate progress objects, whereas client code can only use the IProgress object to monitor a task's progress and, if is @c true, cancel the task by calling . A task represented by IProgress consists of either one or several sub-operations that run sequentially, one by one (see and ). Every operation is identified by a number (starting from 0) and has a separate description. You can find the individual percentage of completion of the current operation in and the percentage of completion of the task as a whole in . Similarly, you can wait for the completion of a particular operation via or for the completion of the whole task via . ID of the task. Description of the task. Initiator of the task. Whether the task can be interrupted. Current progress value of the task as a whole, in percent. This value depends on how many operations are already complete. Returns 100 if is @c true. Estimated remaining time until the task completes, in seconds. Returns 0 once the task has completed; returns -1 if the remaining time cannot be computed, in particular if the current progress is 0. Even if a value is returned, the estimate will be unreliable for low progress values. It will become more reliable as the task progresses; it is not recommended to display an ETA before at least 20% of a task have completed. Whether the task has been completed. Whether the task has been canceled. Result code of the progress task. Valid only if is @c true. Extended information about the unsuccessful result of the progress operation. May be @c null if no extended information is available. Valid only if is @c true and indicates a failure. Number of sub-operations this task is divided into. Every task consists of at least one suboperation. Number of the sub-operation being currently executed. Description of the sub-operation being currently executed. Progress value of the current sub-operation only, in percent. When non-zero, this specifies the number of milliseconds after which the operation will automatically be canceled. This can only be set on cancelable objects. Internal method, not to be called externally. Internal method, not to be called externally. Waits until the task is done (including all sub-operations) with a given timeout in milliseconds; specify -1 for an indefinite wait. Failed to wait for task completion. Maximum time in milliseconds to wait or -1 to wait indefinitely. Waits until the given operation is done with a given timeout in milliseconds; specify -1 for an indefinite wait. Failed to wait for operation completion. Number of the operation to wait for. Must be less than . Maximum time in milliseconds to wait or -1 to wait indefinitely. Cancels the task. If is @c false, then this method will fail. Operation cannot be canceled. 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 interface which also manage the media associated with the snapshot. The following operations exist:
  • : 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 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. If the machine is running, it will resume execution after the snapshot has been taken.
  • : this goes back to a previous snapshot. This resets the machine's state to that of the 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.
  • : deletes a snapshot without affecting the current machine state. This does not change the machine, but instead frees the resources allocated when the snapshot was taken: the settings and machine state is 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.
Each snapshot contains the settings of the virtual machine (hardware configuration etc.). In addition, if the machine was running when the snapshot was taken ( is ), 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 is saved (), the snapshot receives a copy of the execution state file (). Otherwise, if the machine was not running ( or ), the snapshot is offline; it then contains a so-called "zero execution state", representing a machine that is powered off.

Snapshot branches and the "current" snapshot

Snapshots can be chained, whereby every next snapshot is based on the previous one. This chaining is related to medium branching (see the description) in that every time a new snapshot is created, a new differencing medium is implicitly created for all normal media attached to the machine. Each virtual machine has a "current snapshot", identified by . Presently, this is always set to the last snapshot in the chain. In a future version of VirtualBox, it will be possible to reset a machine's current state to that of an earlier snapshot without discarding the current state so that it will be possible to create alternative snapshot paths in a snapshot tree. In the current implementation, multiple snapshot branches within one virtual machine are not allowed. Every machine has a single branch, and operation adds a new snapshot to the top of that branch.
UUID of the snapshot. Short name of the snapshot. Optional description of the snapshot. Time stamp of the snapshot, in milliseconds since 1970-01-01 UTC. @c true if this snapshot is an online snapshot and @c false otherwise. When this attribute is @c true, the attribute of the object associated with this snapshot will point to the saved state file. Otherwise, it will be an empty string. 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 snapshot (a snapshot this one is based on), or @c null if the snapshot has no parent (i.e. is the first snapshot). Child snapshots (all snapshots having this one as a parent).
Virtual medium state. IMedium Associated medium storage does not exist (either was not created yet or was deleted). Associated storage exists and accessible; this gets set if the accessibility check performed by was successful. Medium is locked for reading (see ), no data modification is possible. Medium is locked for writing (see ), no concurrent data reading or modification is possible. Medium accessiblity check (see ) has not yet been performed, or else, associated medium storage is not accessible. In the first case, is empty, in the second case, it describes the error that occured. Associated medium storage is being created. Associated medium storage is being deleted. Virtual medium type. IMedium Normal medium (attached directly or indirectly, preserved when taking snapshots). Immutable medium (attached indirectly, changes are wiped out the next time the virtual machine is started). Write through medium (attached directly, ignored when taking snapshots). Virtual medium image variant. More than one flag may be set. IMedium No particular variant requested, results in using the backend default. VMDK image split in chunks of less than 2GByte. VMDK streamOptimized image. Special import/export format which is read-only/append-only. VMDK format variant used on ESX products. Fixed image. Only allowed for base images. Fixed image. Only allowed for base images. The IMediumAttachment interface represents the attachment of a storage medium to a virtual machine. Each machine contains an array of its medium attachments in . Each medium attachment specifies a storage controller as well as a port and device number. Fixed media (hard disks) will always also specify an instance of IMedium in , referring to the hard disk medium. For removeable media, the IMedia instance is optional; it can be @c null if no media is mounted (see ). Medium object associated with this attachment; it can be @c null for removable devices. Name of the storage controller of this attachment; this refers to one of the controllers in by name. Port number of this attachment. Device slot number of this attachment. Device type of this attachment. Pass I/O requests through to a device on the host. 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 (see ), 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:
  • contains an array of storage controllers (IDE, SATA, SCSI or a floppy controller; these are instances of ).
  • contains an array of medium attachments (instances of ), 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 attribute.
Existing media are opened using the following methods, depending on the media type:
New hard disk media can be created with the VirtualBox API using the method. CD/DVD and floppy images (ISO and RAW files) are usually created outside VirtualBox, e.g. by storing a copy of the real medium of the corresponding type in a regular file. Only for CD/DVDs and floppies, an IMedium instance can also represent a host drive; in that case the attribute contains the UUID of one of the drives in or .

Known media

When an existing medium is opened for the first time, it is automatically remembered by the given VirtualBox installation or, in other words, becomes a known medium. Known media are stored in the media registry transparently maintained by VirtualBox and stored in settings files so that this registry is preserved when VirtualBox is not running. Newly created virtual media are remembered only when the associated storage unit is actually created. All known media can be enumerated using , and attributes. Individual media can be quickly found by UUID using and similar methods or by location using and similar methods. Only known media can be attached to virtual machines. Removing known media from the media registry is performed when the given medium is closed using the method or when its associated storage unit is deleted.

Accessibility checks

VirtualBox defers media accessibility checks until the 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 attribute is an empty string because no actual accessibility check has been made yet. After calling , a medium is considered accessible if its storage unit can be read. In that case, the 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 attribute.

Medium types

There are three types of medium behavior (see ): "normal", "immutable" and "writethrough", represented by the attribute. The type of the medium defines how the medium is attached to a virtual machine and what happens when a snapshot of the virtual machine with the attached medium is taken. At the moment DVD and floppy media are always of type "writethrough". 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 mediun 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 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 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.

Creating hard disks

New base hard disks are created using . Existing hard disks are opened using . Differencing hard disks are usually implicitly created by VirtualBox when needed but may also be created explicitly using . After the hard disk is successfully created (including the storage unit) or opened, it becomes a known hard disk (remembered in the internal media registry). Known hard disks can be attached to a virtual machine, accessed through and methods or enumerated using the array (only for base hard disks). The following methods, besides , automatically remove the hard disk from the media registry:
If the storage unit of the hard disk is a regular file in the host's file system then the rules stated in the description of the attribute apply when setting its value. In addition, a plain file name without any path may be given, in which case the default hard disk folder will be prepended to it.

Automatic composition of the file name part

Another extension to the 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 state, e.g. before the storage unit is created, and works as follows. You set the value of the 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.

Attaching Hard Disks

Hard disks are attached to virtual machines using the method and detached using the method. Depending on their , 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 performs a direct attachment then the same hard disk will be returned in response to the subsequent call; however if an indirect attachment is performed then will return the implicitly created differencing hard disk, not the original one passed to . 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 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.
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 call until 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 before the settings are saved (committed). Note that if is called after indirectly attaching some hard disks to the machine but before a call to is made, it will implicitly delete all differencing hard disks implicitly created by for these indirect attachments. Such implicitly created hard disks will also be immediately deleted when detached explicitly using the call if it is made before . 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 before the last 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 after they are actually de-associated from this machine by the 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 call and used by 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.
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. 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 is or 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 state. Returns the current medium state, which is the last state set by the accessibility check performed by . If that method has not yet been called on the medium, the state is "Inaccessible"; as opposed to truly inaccessible media, the value of will be an empty string in that case. As of version 3.1, this no longer performs an accessibility check automatically; call for that. 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. Some medium types may support changing the storage unit location by simply changing the value of this property. If this operation is not supported, the implementation will return E_NOTIMPL in attempt to set this attribute's value. When setting a value of the location attribute which is a regular file in the host's file system, the given file name may be either relative to the 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. Name of the storage unit holding medium data. The returned string is a short version of the 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 attribute, the name attribute will not necessary be unique for a list of media of the given type and format. Kind of device (DVD/Floppy/HardDisk) which is applicable to this medium. True if this corresponds to a drive on the host. Physical size of the storage unit used to hold medium data (in bytes). For media whose is , the value of this property is the last known size. For media, the returned value is zero. 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 . 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 .
  • The type of all differencing media is and cannot be changed.
The type of a newly created or opened medium is set to , except for DVD and floppy media, which have a type of .
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 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 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). 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 Immutable media are always read-only while all 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 medium state and not to the read-only state of the storage unit. Logical size of this medium (in megabytes), 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. Reading this property on a differencing medium will return the size of its medium. For media whose state is is , the value of this property is the last known logical size. For media, the returned value is zero. 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 ). See 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. This is not a differencing medium (when changing the attribute value). Text message that represents the result of the last accessibility check performed by . An empty string is returned if the last accessibility check was successful or has not yet been called. As a result, if is "Inaccessible" and this attribute is empty, then 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). 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 for details. If the current medium state (see ) is one of "Created", "Inaccessible" or "LockedRead", then this performs an accessibility check on the medium and sets the value of the 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 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 will indicate a failed accessibility check in this case. Note that not all medium states are applicable to all medium types. New medium state. 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. UUID of the machine to query. Array of snapshot UUIDs of the given machine using this medium. 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 ) 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 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 or . The medium locked for reading must be unlocked using the method. Calls to can be nested and must be followed by the same number of paired calls. This method sets the medium state (see ) 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. Invalid medium state (e.g. not created, locked, inaccessible, creating, deleting). State of the medium after the operation. Cancels the read lock previously set by . For both success and failure, this method returns the current state of the medium after the operation. See for more details. Medium not locked for reading. State of the medium after the operation. Locks this medium for writing. A write lock, as opposed to , 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 or . The medium locked for writing must be unlocked using the method. Write locks cannot be nested. This method sets the medium state (see ) 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. For both, success and failure, this method returns the current state of the medium before the operation. Invalid medium state (e.g. not created, locked, inaccessible, creating, deleting). State of the medium after the operation. Cancels the write lock previously set by . For both success and failure, this method returns the current state of the medium after the operation. See for more details. Medium not locked for writing. State of the medium after the operation. 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 gets removed from the list of remembered media, but its storage unit is not deleted. In particular, this means that this medium can be later opened again using the 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. Invalid medium state (other than not created, created or inaccessible). Medium attached to virtual machine. Settings file not accessible. Could not parse the settings file. 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 . Note that if this method returns an empty string in @a value, the requested property is supported but currently not assigned any value. Requested property does not exist (not supported by the format). @a name is @c null or empty. Name of the property to get. Current property value. 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 . Note that 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. Requested property does not exist (not supported by the format). @a name is @c null or empty. Name of the property to set. Property value to set. 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. Note that 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 . 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 elemend at the given index in the first array corresponds to an element at the same index in the second array. Note that for properties that do not have assigned values, an empty string is returned at the appropriate index in the @a returnValues array. Names of properties to get. Names of returned properties. Values of returned properties. 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 elemend 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 is preferred if you need to set several properties at once since it will result into less IPC calls. The list of all properties supported by the given medium format can be obtained with . Note that 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. Names of properties to set. Values of properties to set. 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 , otherwise the operation will fail. Before the operation starts, the medium is placed in state. If the create operation fails, the medium will be placed back in state. After the returned progress object reports that the operation has successfully completed, the medium state will be set to , the medium will be remembered by this VirtualBox installation and may be attached to virtual machines. The variant of storage creation operation is not supported. See . Maximum logical size of the medium in megabytes. Exact image variant which should be created. Progress object to track the operation completion. 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 . Before the operation starts, the medium is placed in 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 state. After the returned progress object reports that the operation is complete, the medium state will be set to and you will be able to use one of the storage creation methods to create it again. #close() Medium is attached to a virtual machine. Storage deletion is not allowed because neither of storage creation operations are supported. See . If the deletion operation fails, it is not guaranteed that the storage unit still exists. You may check the value to answer this question. Progress object to track the operation completion. 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 state (i.e. must not have an existing storage unit). Upon successful completion, this operation will set the type of the target medium to 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 state for the duration of this operation. Medium not in @c NotCreated state. Target medium. Exact image variant which should be created. Progress object to track the operation completion. 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 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 or state.
This (source) medium and all intermediates will be placed to state and the target medium will be placed to state and for the duration of this operation.
UUID of the target ancestor or descendant medium. Progress object to track the operation completion.
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 state (i.e. must not have an existing storage unit) or in 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 irgument 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 state for the duration of this operation. The specified cloning variant is not supported at the moment. Target medium. Exact image variant which should be created. Parent of the cloned medium. Progress object to track the operation completion. 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 state and all its parent media (if any) will be placed to 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. Medium format does not support compacting (but potentially needs it). Progress object to track the operation completion. 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 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. Medium format does not support resizing. New nominal capacity of the medium in megabytes. Progress object to track the operation completion. 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 attribute is @c true. The medium will be write-locked for the duration of this operation (see ). This is not a differencing medium. Medium is not in or state. Progress object to track the operation completion.
Medium format capability flags. Supports UUIDs as expected by VirtualBox code. Supports creating fixed size images, allocating all space instantly. Supports creating dynamically growing images, allocating space on demand. Supports creating images split in chunks of a bit less than 2 GBytes. Supports being used as a format for differencing media (see ). Supports asynchronous I/O operations for at least some configurations. The format backend operates on files (the attribute of the medium specifies a file used to store medium data; for a list of supported file extensions see ). The format backend uses the property interface to configure the storage location and properties (the method is used to get access to properties supported by the given medium format). 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 attribute. This string is used in calls like to specify the desired format. The list of all supported medium formats can be obtained using . IMedium 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 .
Human readable description of this format. Mainly for use in file open dialogs. Array of strings containing the supported file extensions. The first extension in the array is the extension preferred by the backend. It is recommended to use this extension when specifying a location of the storage unit for a new medium. Note that some backends do not work on files, so this array may be empty. IMediumFormat::capabilities Capabilities of the format as a set of bit flags. For the meaning of individual capability flags see . 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 flag is set. All arguments must be non-@c null. DataType DataFlags Array of property names. Array of property descriptions. Array of property types. Array of property flags. Array of default property values.
The IKeyboard interface represents the virtual machine's keyboard. Used in . Use this interface to send keystrokes or the Ctrl-Alt-Del sequence to the virtual machine. Sends a scancode to the keyboard. Could not send scan code to virtual keyboard. Sends an array of scancodes to the keyboard. Could not send all scan codes to virtual keyboard. Sends the Ctrl-Alt-Del sequence to the keyboard. This function is nothing special, it is just a convenience function calling with the proper scancodes. Could not send all scan codes to virtual keyboard. Mouse button state. The IMouse interface represents the virtual machine's mouse. Used in . Through this interface, the virtual machine's virtual mouse can be controlled. Whether the guest OS supports absolute mouse pointer positioning or not. VirtualBox Guest Tools need to be installed to the guest OS in order to enable absolute mouse positioning support. You can use the callback to be instantly informed about changes of this attribute during virtual machine execution. Initiates a mouse event using relative pointer movements along x and y axis. Console not powered up. Could not send mouse event to virtual mouse. Amount of pixels the mouse should move to the right. Negative values move the mouse to the left. Amount of pixels the mouse should move downwards. Negative values move the mouse upwards. Amount of mouse wheel moves. Positive values describe clockwise wheel rotations, negative values describe counterclockwise rotations. Amount of horizontal mouse wheel moves. Positive values describe a movement to the left, negative values describe a movement to the right. The current state of mouse buttons. Every bit represents a mouse button as follows:
Bit 0 (0x01)left mouse button
Bit 1 (0x02)right mouse button
Bit 2 (0x04)middle mouse button
A value of 1 means the corresponding button is pressed. otherwise it is released.
Positions the mouse pointer using absolute x and y coordinates. These coordinates are expressed in pixels and start from [1,1] which corresponds to the top left corner of the virtual display. Console not powered up. Could not send mouse event to virtual mouse. This method will have effect only if absolute mouse positioning is supported by the guest OS. X coordinate of the pointer in pixels, starting from @c 1. Y coordinate of the pointer in pixels, starting from @c 1. Amount of mouse wheel moves. Positive values describe clockwise wheel rotations, negative values describe counterclockwise rotations. Amount of horizontal mouse wheel moves. Positive values describe a movement to the left, negative values describe a movement to the right. The current state of mouse buttons. Every bit represents a mouse button as follows:
Bit 0 (0x01)left mouse button
Bit 1 (0x02)right mouse button
Bit 2 (0x04)middle mouse button
A value of @c 1 means the corresponding button is pressed. otherwise it is released.
Format of the video memory buffer. Constants represented by this enum can be used to test for particular values of . See also . See also www.fourcc.org for more information about FOURCC pixel formats. Unknown buffer format (the user may not assume any particular format of the buffer). Basic RGB format ( determines the bit layout). Address of the start byte of the frame buffer. Frame buffer width, in pixels. Frame buffer height, in pixels. Color depth, in bits per pixel. When is FOURCC_RGB, valid values are: 8, 15, 16, 24 and 32. Scan line size, in bytes. When is FOURCC_RGB, the size of the scan line must be aligned to 32 bits. Frame buffer pixel format. It's either one of the values defined by or a raw FOURCC code. This attribute must never return -- the format of the buffer points to must be always known. Defines whether this frame buffer uses the virtual video card's memory buffer (guest VRAM) directly or not. See for more information. 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. 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. Platform-dependent identifier of the window where context of this frame buffer is drawn, or zero if there's no such window. Locks the frame buffer. Gets called by the IDisplay object where this frame buffer is bound to. Unlocks the frame buffer. Gets called by the IDisplay object where this frame buffer is bound to. Informs about an update. Gets called by the display object where this buffer is registered. Requests a size and pixel format change. There are two modes of working with the video buffer of the virtual machine. The indirect mode implies that the IFramebuffer implementation allocates a memory buffer for the requested display mode and provides it to the virtual machine. In direct mode, the IFramebuffer implementation uses the memory buffer allocated and owned by the virtual machine. This buffer represents the video memory of the emulated video adapter (so called guest VRAM). The direct mode is usually faster because the implementation gets a raw pointer to the guest VRAM buffer which it can directly use for visualizing the contents of the virtual display, as opposed to the indirect mode where the contents of guest VRAM are copied to the memory buffer provided by the implementation every time a display update occurs. It is important to note that the direct mode is really fast only when the implementation uses the given guest VRAM buffer directly, for example, by blitting it to the window representing the virtual machine's display, which saves at least one copy operation comparing to the indirect mode. However, using the guest VRAM buffer directly is not always possible: the format and the color depth of this buffer may be not supported by the target window, or it may be unknown (opaque) as in case of text or non-linear multi-plane VGA video modes. In this case, the indirect mode (that is always available) should be used as a fallback: when the guest VRAM contents are copied to the implementation-provided memory buffer, color and format conversion is done automatically by the underlying code. The @a pixelFormat parameter defines whether the direct mode is available or not. If @a pixelFormat is then direct access to the guest VRAM buffer is not available -- the @a VRAM, @a bitsPerPixel and @a bytesPerLine parameters must be ignored and the implementation must use the indirect mode (where it provides its own buffer in one of the supported formats). In all other cases, @a pixelFormat together with @a bitsPerPixel and @a bytesPerLine define the format of the video memory buffer pointed to by the @a VRAM parameter and the implementation is free to choose which mode to use. To indicate that this frame buffer uses the direct mode, the implementation of the attribute must return @c true and must return exactly the same address that is passed in the @a VRAM parameter of this method; otherwise it is assumed that the indirect strategy is chosen. The @a width and @a height parameters represent the size of the requested display mode in both modes. In case of indirect mode, the provided memory buffer should be big enough to store data of the given display mode. In case of direct mode, it is guaranteed that the given @a VRAM buffer contains enough space to represent the display mode of the given size. Note that this frame buffer's and attributes must return exactly the same values as passed to this method after the resize is completed (see below). The @a finished output parameter determines if the implementation has finished resizing the frame buffer or not. If, for some reason, the resize cannot be finished immediately during this call, @a finished must be set to @c false, and the implementation must call after it has returned from this method as soon as possible. If @a finished is @c false, the machine will not call any frame buffer methods until is called. Note that if the direct mode is chosen, the , and attributes of this frame buffer must return exactly the same values as specified in the parameters of this method, after the resize is completed. If the indirect mode is chosen, these attributes must return values describing the format of the implementation's own memory buffer points to. Note also that the value must always correlate with . Note that the attribute must never return regardless of the selected mode. This method is called by the IDisplay object under the provided by this IFramebuffer implementation. If this method returns @c false in @a finished, then this lock is not released until is called. Logical screen number. Must be used in the corresponding call to if this call is made. Pixel format of the memory buffer pointed to by @a VRAM. See also . Pointer to the virtual video card's VRAM (may be @c null). Color depth, bits per pixel. Size of one scan line, in bytes. Width of the guest display, in pixels. Height of the guest display, in pixels. Can the VM start using the new frame buffer immediately after this method returns or it should wait for . 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. 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. Pointer to the @c RTRECT array to receive region data. Number of @c RTRECT elements in the @a rectangles array. Number of elements copied to the @a rectangles array. 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. Pointer to the @c RTRECT array. Number of @c RTRECT elements in the @a rectangles array. 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 covnersion, 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. Pointer to VBOXVHWACMD containing the command to execute. 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 position of the overlay, relative to the frame buffer. Y position of the overlay, relative to the frame buffer. Whether the overlay is currently visible. The global alpha value for the overlay. This may or may not be supported by a given front end. Changes the overlay's position relative to the IFramebuffer. The IDisplay interface represents the virtual machine's display. The object implementing this interface is contained in each 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. Current display width. Current display height. Current guest display color depth. Note that this may differ from . Sets the framebuffer for given screen. Queries the framebuffer for given screen. 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. The @a display is not associated with any monitor. Enables or disables seamless guest display rendering (seamless desktop integration) mode. Calling this method has no effect if returns @c false. Takes a screen shot of the requested size and copies it to the 32-bpp buffer allocated by the caller and pointed to by @a address. A pixel consists of 4 bytes in order: B, G, R, 0. This API can be used only by the COM/XPCOM C++ API as it requires pointer support. Use with other language bindings. Feature not implemented. Could not take a screenshot. Takes a guest screen shot of the requested size and returns it as an array of bytes in uncompressed 32-bit RGBA format. A pixel consists of 4 bytes in order: R, G, B, 0xFF. This API is slow, but could be the only option to get guest screenshot for scriptable languages not allowed to manipulate with addresses directly. Feature not implemented. Could not take a screenshot. Desired image width. Desired image height. Array with resulting screen data. Draws a 32-bpp image of the specified size from the given buffer to the given point on the VM display. Feature not implemented. Could not draw to screen. Does a full invalidation of the VM display and instructs the VM to update it. Could not invalidate and update screen. Signals that a framebuffer has completed the resize operation. Operation only valid for external frame buffers. Signals that a framebuffer has completed the update operation. Operation only valid for external frame buffers. Signals that the Video HW Acceleration command has completed. Pointer to VBOXVHWACMD containing the completed command. Network attachment type. Null value, also means "not attached". Network adapter type. Null value (never used by the API). AMD PCNet-PCI II network card (Am79C970A). AMD PCNet-FAST III network card (Am79C973). Intel PRO/1000 MT Desktop network card (82540EM). Intel PRO/1000 T Server network card (82543GC). Intel PRO/1000 MT Server network card (82545EM). Virtio network device. 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 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 enumeration; see the attribute. Type of the virtual network adapter. Depending on this value, VirtualBox will provide a different virtual network hardware to the guest. Slot number this adapter is plugged into. Corresponds to the value you pass to to obtain this instance. 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. Ethernet MAC address of the adapter, 12 hexadecimal characters. When setting it to @c null or an empty string, VirtualBox will generate a unique MAC address. Name of the host network interface the VM is attached to. Name of the internal network the VM is attached to. Name of the NAT network the VM is attached to. Flag whether the adapter reports the cable as connected or not. It can be used to report offline situations to a VM. Line speed reported by custom drivers, in units of 1 kbps. Flag whether network traffic from/to the network card should be traced. Can only be toggled when the VM is turned off. Filename where a network trace will be stored. If not set, VBox-pid.pcap will be used. Attach the network adapter to the Network Address Translation (NAT) interface. Attach the network adapter to a bridged host interface. Attach the network adapter to an internal network. Attach the network adapter to the host-only network. Detach the network adapter The PortMode enumeration represents possible communication modes for the virtual serial port device. Virtual device is not attached to any real host device. Virtual device is attached to a host pipe. Virtual device is attached to a host device. Virtual device is attached to a raw file. 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::getSerialPort Slot number this serial port is plugged into. Corresponds to the value you pass to to obtain this instance. Flag whether the serial port is enabled. If disabled, the serial port will not be reported to the guest OS. Base I/O address of the serial port. IRQ number of the serial port. How is this port connected to the host. Changing this attribute may fail if the conditions for are not met. 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 is PortMode_HostPipe. Path to the serial port's pipe on the host when is PortMode_HostPipe, or the host serial device name when is PortMode_HostDevice. For both cases, setting a @c null or empty string as the attribute's value is an error. Otherwise, the value of this property is ignored. 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::getParallelPort Slot number this parallel port is plugged into. Corresponds to the value you pass to to obtain this instance. Flag whether the parallel port is enabled. If disabled, the parallel port will not be reported to the guest OS. Base I/O address of the parallel port. IRQ number of the parallel port. 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 into an error. Reset VM statistics. The selection pattern. A bit similar to filename globbing. Dumps VM statistics. The selection pattern. A bit similar to filename globbing. Get the VM statistics in a XMLish format. The selection pattern. A bit similar to filename globbing. Whether to include the descriptions. The XML document containing the statistics. Inject an NMI into a running VT-x/AMD-V VM. Switch for enabling singlestepping. Switch for forcing code recompilation for user mode code. Switch for forcing code recompilation for supervisor mode code. Switch for enabling and disabling the PATM component. Switch for enabling and disabling the CSAM component. Switch for enabling and disabling logging. Flag indicating whether the VM is currently making use of CPU hardware virtualization extensions. Flag indicating whether the VM is currently making use of the nested paging CPU hardware virtualization extension. Flag indicating whether the VM is currently making use of the VPID VT-x extension. Flag indicating whether the VM is currently making use of the Physical Address Extension CPU feature. The rate at which the virtual time runs expressed as a percentage. The accepted range is 2% to 20000%. Gets the VM handle. This is only for internal use while we carve the details of this interface. Flag whether the USB controller is present in the guest system. If disabled, the virtual guest hardware will not contain any USB controller. Can only be changed when the VM is powered off. Flag whether the USB EHCI controller is present in the guest system. If disabled, the virtual guest hardware will not contain a USB EHCI controller. Can only be changed when the VM is powered off. 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. 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 (). 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 , , ) 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 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 . The virtual machine is not mutable. #deviceFilters Filter name. See for more info. Created filter object. 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. Virtual machine is not mutable. USB device filter not created within this VirtualBox instance. USB device filter already in list. #deviceFilters Position to insert the filter to. USB device filter to insert. 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. #deviceFilters Virtual machine is not mutable. USB device filter list empty or invalid @a position. Position to remove the filter from. Removed USB device filter. The IUSBDevice interface represents a virtual USB device attached to the virtual machine. A collection of objects implementing this interface is stored in the attribute which lists all USB devices attached to a running virtual machine's USB controller. Unique USB device ID. This ID is built from #vendorId, #productId, #revision and #serialNumber. Vendor ID. Product ID. 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 string. Product string. Serial number string. Host specific address of the device. Host USB port number the device is physically connected to. The major USB version of the device - 1 or 2. The major USB version of the host USB port the device is physically connected to - 1 or 2. For devices not connected to anything this will have the same value as the version attribute. Whether the device is physically connected to a remote VRDP client or to a local host machine. 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 (, , ) are ignored, so they behave as any match no matter what string expression is specified. IUSBController::deviceFilters, IHostUSBDeviceFilter
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. Whether this filter active or has been temporarily disabled. 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 filter. The string representation for the exact matching has the form XXXX, where X is the hex digit (including leading zeroes). 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 filter. Product filter. Serial number filter. Host USB port filter. Remote state filter. This filter makes sense only for machine USB filters, i.e. it is ignored by IHostUSBDeviceFilter objects. 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.
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 () 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 () 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 () 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_vailable are applicable only to the Linux version of the product. This also means that () can only succeed on Win32 if the device state is USBDeviceState_Held. IHostUSBDevice, IHostUSBDeviceFilter Not supported by the VirtualBox server, not available to guests. Being used by the host computer exclusively, not available to guests. Being used by the host computer, potentially available to guests. Not used by the host computer, available to guests (the host computer can also start using the device at any time). Held by the VirtualBox server (ignored by the host computer), available to guests. Captured by one of the guest computers, not available to anybody else. The IHostUSBDevice interface represents a physical USB device attached to the host computer. Besides properties inherited from IUSBDevice, this interface adds the property that holds the current state of the USB device. IHost::USBDevices, IHost::USBDeviceFilters Current state of the device. Actions for host USB device filters. IHostUSBDeviceFilter, USBDeviceState Null value (never used by the API). Ignore the matched USB device. Hold the matched USB device. The IHostUSBDeviceFilter interface represents a global filter for a physical USB device used by the host computer. Used indirectly in . 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 attribute is ignored by this type of filters, because it makes sense only for machine USB filters. IHost::USBDeviceFilters Action performed by the host when an attached USB device matches this filter. Host audio driver type. Null value, also means "dummy audio driver". Windows multimedia (Windows hosts only). Open Sound System (Linux hosts only). Advanced Linux Sound Architecture (Linux hosts only). DirectSound (Windows hosts only). CoreAudio (Mac hosts only). Reserved for historical reasons. PulseAudio (Linux hosts only). Solaris audio (Solaris hosts only). Virtual audio controller type. The IAudioAdapter interface represents the virtual audio adapter of the virtual machine. Used in . 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. The audio hardware we emulate. Audio driver the adapter is connected to. This setting can only be changed when the VM is not running. VRDP authentication type. Null value, also means "no authentication". VRDP server status. VRDP server port numbers. The server will try to bind to one of free ports from the list. This is a string of comma separated TCP port numbers or port number ranges. Example 5000,5010-5012,5015 VRDP server address. VRDP authentication method. Timeout for guest authentication. Milliseconds. Flag whether multiple simultaneous connections to the VM are permitted. Note that this will be replaced by a more powerful mechanism in the future. Flag whether the existing connection must be dropped and a new connection must be established by the VRDP server, when a new client connects in single connection mode. 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 (), shared folders available to all virtual machines.
  • Permanent (), VM-specific shared folders available to the given virtual machine at startup.
  • Transient (), 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):
  1. Transient definitions
  2. Permanent definitions
  3. 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 \\\\VBOXSVR\\C_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.
Logical name of the shared folder. Full path to the shared folder in the host file system. Whether the folder defined by the host path is currently accessible or not. For example, the folder can be unaccessible if it is placed on the network share that is not available by the time this property is read. Whether the folder defined by the host path is writable or not. Text message that represents the result of the last accessibility check. Accessibility checks are performed each time the 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).
PID of the process that has created this Session object. Returns the console object suitable for remote control. Session state prevents operation. Session type prevents operation. 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). Session state prevents operation. Session type prevents operation. Assigns the machine and the (remote) console object associated with this remote-type session. Session state prevents operation. Updates the machine state in the VM process. Must be called only in certain cases (see the method implementation). Session state prevents operation. Session type prevents operation. Uninitializes (closes) this session. Used by VirtualBox to close the corresponding remote session when the direct session dies or gets closed. Session state prevents operation. Triggered when settings of a network adapter of the associated virtual machine have changed. Session state prevents operation. Session type prevents operation. Triggered when settings of a serial port of the associated virtual machine have changed. Session state prevents operation. Session type prevents operation. Triggered when settings of a parallel port of the associated virtual machine have changed. Session state prevents operation. Session type prevents operation. Triggered when settings of a storage controller of the associated virtual machine have changed. Session state prevents operation. Session type prevents operation. Triggered when attached media of the associated virtual machine have changed. Session state prevents operation. Session type prevents operation. Notification when a CPU changes. The CPU which changed Flag whether the CPU was added or removed Triggered when settings of the VRDP server object of the associated virtual machine have changed. Session state prevents operation. Session type prevents operation. Triggered when settings of the USB controller object of the associated virtual machine have changed. Session state prevents operation. Session type prevents operation. 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. Session state prevents operation. Session type prevents operation. Triggered when a request to capture a USB device (as a result of matched USB filters or direct call to ) has completed. A @c null @a error object means success, otherwise it describes a failure. Session state prevents operation. Session type prevents operation. Triggered when a request to release the USB device (as a result of machine termination or direct call to ) has completed. A @c null @a error object means success, otherwise it describes a failure. Session state prevents operation. Session type prevents operation. Called by and by in order to notify console callbacks and . Session type prevents operation. Called by and by in order to read and modify guest properties. Machine session is not open. Session type is not direct. Return a list of the guest properties matching a set of patterns along with their values, time stamps and flags. Machine session is not open. Session type is not direct. The patterns to match the properties against as a comma-separated string. If this is empty, all properties currently set will be returned. The key names of the properties returned. The values of the properties returned. The array entries match the corresponding entries in the @a key array. The time stamps of the properties returned. The array entries match the corresponding entries in the @a key array. The flags of the properties returned. The array entries match the corresponding entries in the @a key array. The ISession interface represents a serialization primitive for virtual machines. With VirtualBox, every time one wishes to manipulate a virtual machine (e.g. change its settings or start execution), a session object is required. Such an object must be passed to one of the session methods that open the given session, which then initiates the machine manipulation. A session serves several purposes: it identifies to the inter-process VirtualBox code which process is currently working with the virtual machine, and it ensures that there are no incompatible requests from several processes for the same virtual machine. Session objects can therefore be thought of as mutex semaphores that lock virtual machines to prevent conflicting accesses from several processes. How sessions objects are used depends on whether you use the Main API via COM or via the webservice:
  • When using the COM API directly, an object of the Session class from the VirtualBox type library needs to be created. In regular COM C++ client code, this can be done by calling createLocalObject(), a standard COM API. This object will then act as a local session object in further calls to open a session.
  • In the webservice, the session manager (IWebsessionManager) instead creates one session object automatically when is called. A managed object reference to that session object can be retrieved by calling . This session object reference can then be used to open sessions.
Sessions are mainly used in two variations:
  • To start a virtual machine in a separate process, one would call , which requires a session object as its first parameter. This session then identifies the caller and lets him control the started machine (for example, pause machine execution or power it down) as well as be notified about machine execution state changes.
  • To alter machine settings, or to start machine execution within the current process, one needs to open a direct session for the machine first by calling . While a direct session is open within one process, no any other process may open another direct session for the same machine. This prevents the machine from being changed by other processes while it is running or while the machine is being configured.
One also can attach to an existing direct session already opened by another process (for example, in order to send a control request to the virtual machine such as the pause or the reset request). This is done by calling . Unless you are trying to write a new VirtualBox front-end that performs direct machine execution (like the VirtualBox or VBoxSDL front-ends), don't call in a direct session opened by and use this session only to change virtual machine settings. If you simply want to start virtual machine execution using one of the existing front-ends (for example the VirtualBox GUI or headless server), simply use ; these front-ends will power up the machine automatically for you.
Current state of this session. Type of this session. The value of this attribute is valid only if the session is currently open (i.e. its #state is SessionType_SessionOpen), otherwise an error will be returned. Machine object associated with this session. Console object associated with this session. Closes a session that was previously opened. It is recommended that every time an "open session" method (such as or ) has been called to manipulate a virtual machine, the caller invoke ISession::close() when it's done doing so. Since sessions are serialization primitives much like ordinary mutexes, they are best used the same way: for each "open" call, there should be a matching "close" call, even when errors occur. Otherwise, if a direct session for a machine opened with is not explicitly closed when the application terminates, the state of the machine will be set to on the server. Generally, it is recommended to close all open sessions explicitly before terminating the application (regardless of the reason for the termination). Do not expect the session state ( to return to "Closed" immediately after you invoke ISession::close(), particularly if you have started a remote session to execute the VM in a new process. The session state will automatically return to "Closed" once the VM is no longer executing, which can of course take a very long time. Session is not open.
The bus type of the storage controller (IDE, SATA, SCSI or Floppy); see . @c null value. Never used by the API. The exact variant of storage controller hardware presented to the guest; see . @c null value. Never used by the API. A SCSI controller of the LsiLogic variant. A SCSI controller of the BusLogic variant. An Intel AHCI SATA controller; this is the only variant for SATA. An IDE controller of the PIIX3 variant. An IDE controller of the PIIX4 variant. An IDE controller of the ICH6 variant. A floppy disk controller; this is the only variant for floppy drives. A variant of the LsiLogic controller using SAS. Represents a storage controller that is attached to a virtual machine (). Just as drives (hard disks, DVDs, FDs) are attached to storage controllers in a real computer, virtual drives (represented by ) 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 four types of such virtual storage controllers: IDE, SCSI, SATA and Floppy (see ). Depending on which of these four is used, certain sub-types may be available and can be selected in . Depending on these settings, the guest operating system might see significantly different virtual hardware. Name of the storage controller, as originally specified with . This then uniquely identifies this controller with other method calls such as and . Maximum number of devices which can be attached to one port. Minimum number of ports that can be set to. Maximum number of ports that can be set to. The instance number of the device in the running VM. The number of currently usable ports on the controller. The minimum and maximum number of ports for one controller are stored in and . The bus type of the storage controller (IDE, SATA, SCSI or Floppy). 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 and floppy controllers, only one variant is available, but for IDE and SCSI, there are several. For SCSI controllers, the default type is LsiLogic. Gets the corresponding port number which is emulated as an IDE device. Works only with SATA controllers. The @a devicePosition is not in the range 0 to 3. The storage controller type is not SATAIntelAhci. Sets the port number which is emulated as an IDE device. Works only with SATA controllers. The @a devicePosition is not in the range 0 to 3 or the @a portNumber is not in the range 0 to 29. The storage controller type is not SATAIntelAhci. Managed object reference. Only within the webservice, a managed object reference (which is really an opaque number) allows a webservice client to address an object that lives in the address space of the webservice server. Behind each managed object reference, there is a COM object that lives in the webservice server's address space. The COM object is not freed until the managed object reference is released, either by an explicit call to or by logging off from the webservice (), which releases all objects created during the webservice session. Whenever a method call of the VirtualBox API returns a COM object, the webservice representation of that method will instead return a managed object reference, which can then be used to invoke methods on that object. Returns the name of the interface that this managed object represents, for example, "IMachine", as a string. Releases this managed object reference and frees the resources that were allocated for it in the webservice server process. After calling this method, the identifier of the reference can no longer be used. Websession manager. This provides essential services to webservice clients. Logs a new client onto the webservice and returns a managed object reference to the IVirtualBox instance, which the client can then use as a basis to further queries, since all calls to the VirtualBox API are based on the IVirtualBox interface, in one way or the other. Returns a managed object reference to the internal ISession object that was created for this web service session when the client logged on. ISession Logs off the client who has previously logged on with and destroys all resources associated with the session (most importantly, all managed objects created in the server while the session was active). The IPerformanceMetric interface represents parameters of the given performance metric. Name of the metric. Object this metric belongs to. Textual description of the metric. Time interval between samples, measured in seconds. 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 of measurement. Minimum possible value of this metric. Maximum possible value of this metric. 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 . Metric data is collected at the specified intervals and is retained internally. The interval and the number of retained samples can be set with . 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 . 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
The general sequence for collecting and retrieving the metrics is:
  • Obtain an instance of IPerformanceCollector with
  • 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 . 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 . 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
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. can be used to get the list of supported metrics for a particular object. 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. Metric name filter. Currently, only a comma-separated list of metrics is supported. Set of objects to return metric parameters for. Array of returned metric parameters. Sets parameters of specified base metrics for a set of objects. Returns an array of 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. Metric name filter. Comma-separated list of metrics with wildcard support. Set of objects to setup metric parameters for. Time interval in seconds between two consecutive samples of performance data. Number of samples to retain in performance data history. Older samples get discarded. Array of metrics that have been modified by the call to this method. Turns on collecting specified base metrics. Returns an array of 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. Metric name filter. Comma-separated list of metrics with wildcard support. Set of objects to enable metrics for. Array of metrics that have been modified by the call to this method. Turns off collecting specified base metrics. Returns an array of 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. Metric name filter. Comma-separated list of metrics with wildcard support. Set of objects to disable metrics for. Array of metrics that have been modified by the call to this method. 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 makes possible 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. Metric name filter. Comma-separated list of metrics with wildcard support. Set of objects to query metrics for. Names of metrics returned in @c returnData. Objects associated with metrics returned in @c returnData. Units of measurement for each returned metric. 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. 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. Indices of the first elements of value sequences of particular metrics returned in @c returnData. Lengths of value sequences of particular metrics. Flattened array of all metric data containing sequences of values for each metric.