VirtualBox Main API
|
The IConsole interface represents an interface to control virtual machine execution. More...
Public Member Functions | |
void | powerUp ([retval] out IProgress progress) |
Starts the virtual machine execution using the current machine state (that is, its current execution state, current settings and current storage devices). | |
void | powerUpPaused ([retval] out IProgress progress) |
Identical to powerUp except that the VM will enter the MachineState_Paused state, instead of MachineState_Running. | |
void | powerDown ([retval] out IProgress progress) |
Initiates the power down procedure to stop the virtual machine execution. | |
void | reset () |
Resets the virtual machine. | |
void | pause () |
Pauses the virtual machine execution. | |
void | resume () |
Resumes the virtual machine execution. | |
void | powerButton () |
Sends the ACPI power button event to the guest. | |
void | sleepButton () |
Sends the ACPI sleep button event to the guest. | |
void | getPowerButtonHandled ([retval] out boolean handled) |
Checks if the last power button event was handled by guest. | |
void | getGuestEnteredACPIMode ([retval] out boolean entered) |
Checks if the guest entered the ACPI mode G0 (working) or G1 (sleeping). | |
void | getDeviceActivity (in DeviceType[] type, [retval] out DeviceActivity[] activity) |
Gets the current activity type of given devices or device groups. | |
void | attachUSBDevice (in wstringUUID id, in wstring captureFilename) |
Attaches a host USB device with the given UUID to the USB controller of the virtual machine. | |
void | detachUSBDevice (in wstringUUID id, [retval] out IUSBDevice device) |
Detaches a USB device with the given UUID from the USB controller of the virtual machine. | |
void | findUSBDeviceByAddress (in wstring name, [retval] out IUSBDevice device) |
Searches for a USB device with the given host address. | |
void | findUSBDeviceById (in wstringUUID id, [retval] out IUSBDevice device) |
Searches for a USB device with the given UUID. | |
void | createSharedFolder (in wstring name, in wstring hostPath, in boolean writable, in boolean automount, in wstring autoMountPoint) |
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. | |
void | removeSharedFolder (in wstring name) |
Removes a transient shared folder with the given name previously created by createSharedFolder from the collection of shared folders and stops sharing it. | |
void | teleport (in wstring hostname, in unsigned long tcpport, in wstring password, in unsigned long maxDowntime, [retval] out IProgress progress) |
Teleport the VM to a different host machine or process. | |
void | addEncryptionPassword (in wstring id, in wstring password, in boolean clearOnSuspend) |
Adds a password used for encryption/decryption. | |
void | addEncryptionPasswords (in wstring[] ids, in wstring[] passwords, in boolean clearOnSuspend) |
Adds a password used for encryption/decryption. | |
void | removeEncryptionPassword (in wstring id) |
Removes a password used for hard disk encryption/decryption from the running VM. | |
void | clearAllEncryptionPasswords () |
Clears all provided supplied encryption passwords. | |
Public Attributes | |
readonly attribute IMachine | machine |
Machine object for this console session. | |
readonly attribute MachineState | state |
Current execution state of the machine. | |
readonly attribute IGuest | guest |
Guest object. | |
readonly attribute IKeyboard | keyboard |
Virtual keyboard object. | |
readonly attribute IMouse | mouse |
Virtual mouse object. | |
readonly attribute IDisplay | display |
Virtual display object. | |
readonly attribute IMachineDebugger | debugger |
Debugging interface. | |
readonly attribute IUSBDevice[] | USBDevices |
Collection of USB devices currently attached to the virtual USB controller. | |
readonly attribute IHostUSBDevice[] | remoteUSBDevices |
List of USB devices currently attached to the remote VRDE client. | |
readonly attribute ISharedFolder[] | sharedFolders |
Collection of shared folders for the current session. | |
readonly attribute IVRDEServerInfo | VRDEServerInfo |
Interface that provides information on Remote Desktop Extension (VRDE) connection. | |
readonly attribute IEventSource | eventSource |
Event source for console events. | |
readonly attribute IPCIDeviceAttachment[] | attachedPCIDevices |
Array of PCI devices attached to this machine. | |
attribute boolean | useHostClipboard |
Whether the guest clipboard should be connected to the host one or whether it should only be allowed access to the VRDE clipboard. | |
readonly attribute IEmulatedUSB | emulatedUSB |
Interface that manages emulated USB devices. | |
The IConsole interface represents an interface to control virtual machine execution.
A console object gets created when a machine has been locked for a particular session (client process) using IMachine::lockMachine or IMachine::launchVMProcess. The console object can then be found in the session's ISession::console attribute.
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.
{6AC83D89-6EE7-4E33-8AE6-B257B2E81BE8}
void IConsole::powerUp | ( | [retval] out IProgress | progress | ) |
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 MachineState_Saved state or the MachineState_AbortedSaved state it will continue its execution from the point where the state was saved.
If the machine IMachine::teleporterEnabled property is enabled on the machine being powered up, the machine will wait for an incoming teleportation in the MachineState_TeleportingIn state. The returned progress object will have at least three operations where the last three are defined as: (1) powering up and starting TCP server, (2) waiting for incoming teleportations, and (3) perform teleportation. These operations will be reflected as the last three operations of the progress objected returned by IMachine::launchVMProcess as well.
progress | Progress object to track the operation completion. |
VBOX_E_INVALID_VM_STATE | Virtual machine already running. |
VBOX_E_HOST_ERROR | Host interface does not exist or name not set. |
VBOX_E_FILE_ERROR | Invalid saved state file. |
void IConsole::powerUpPaused | ( | [retval] out IProgress | progress | ) |
Identical to powerUp except that the VM will enter the MachineState_Paused state, instead of MachineState_Running.
progress | Progress object to track the operation completion. |
VBOX_E_INVALID_VM_STATE | Virtual machine already running. |
VBOX_E_HOST_ERROR | Host interface does not exist or name not set. |
VBOX_E_FILE_ERROR | Invalid saved state file. |
void IConsole::powerDown | ( | [retval] out IProgress | progress | ) |
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.
progress | Progress object to track the operation completion. |
VBOX_E_INVALID_VM_STATE | Virtual machine must be Running, Paused or Stuck to be powered down. |
void IConsole::reset | ( | ) |
Resets the virtual machine.
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
VBOX_E_VM_ERROR | Virtual machine error in reset operation. |
void IConsole::pause | ( | ) |
Pauses the virtual machine execution.
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
VBOX_E_VM_ERROR | Virtual machine error in suspend operation. |
void IConsole::resume | ( | ) |
Resumes the virtual machine execution.
VBOX_E_INVALID_VM_STATE | Virtual machine not in Paused state. |
VBOX_E_VM_ERROR | Virtual machine error in resume operation. |
void IConsole::powerButton | ( | ) |
Sends the ACPI power button event to the guest.
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
VBOX_E_PDM_ERROR | Controlled power off failed. |
void IConsole::sleepButton | ( | ) |
Sends the ACPI sleep button event to the guest.
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
VBOX_E_PDM_ERROR | Sending sleep button event failed. |
void IConsole::getPowerButtonHandled | ( | [retval] out boolean | handled | ) |
Checks if the last power button event was handled by guest.
VBOX_E_PDM_ERROR | Checking if the event was handled by the guest OS failed. |
void IConsole::getGuestEnteredACPIMode | ( | [retval] out boolean | entered | ) |
Checks if the guest entered the ACPI mode G0 (working) or G1 (sleeping).
If this method returns false
, the guest will most likely not respond to external ACPI events.
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
void IConsole::getDeviceActivity | ( | in DeviceType[] | type, |
[retval] out DeviceActivity[] | activity | ||
) |
Gets the current activity type of given devices or device groups.
E_INVALIDARG | Invalid device type. |
void IConsole::attachUSBDevice | ( | in wstringUUID | id, |
in wstring | captureFilename | ||
) |
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: USBDeviceState_Busy, USBDeviceState_Available or USBDeviceState_Held, 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.
id | UUID of the host USB device to attach. |
captureFilename | Filename to capture the USB traffic to. |
VBOX_E_INVALID_VM_STATE | Virtual machine state neither Running nor Paused. |
VBOX_E_PDM_ERROR | Virtual machine does not have a USB controller. |
void IConsole::detachUSBDevice | ( | in wstringUUID | id, |
[retval] out IUSBDevice | device | ||
) |
Detaches a 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.
id | UUID of the USB device to detach. |
device | Detached USB device. |
VBOX_E_PDM_ERROR | Virtual machine does not have a USB controller. |
E_INVALIDARG | USB device not attached to this virtual machine. |
void IConsole::findUSBDeviceByAddress | ( | in wstring | name, |
[retval] out IUSBDevice | device | ||
) |
Searches for a USB device with the given host address.
name | Address of the USB device (as assigned by the host) to search for. |
device | Found USB device object. |
VBOX_E_OBJECT_NOT_FOUND | Given name does not correspond to any USB device. |
void IConsole::findUSBDeviceById | ( | in wstringUUID | id, |
[retval] out IUSBDevice | device | ||
) |
Searches for a USB device with the given UUID.
id | UUID of the USB device to search for. |
device | Found USB device object. |
VBOX_E_OBJECT_NOT_FOUND | Given id does not correspond to any USB device. |
void IConsole::createSharedFolder | ( | in wstring | name, |
in wstring | hostPath, | ||
in boolean | writable, | ||
in boolean | automount, | ||
in wstring | autoMountPoint | ||
) |
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 ISharedFolder to read more about logical names.
name | Unique logical name of the shared folder. |
hostPath | Full path to the shared folder in the host file system. |
writable | Whether the share is writable or readonly |
automount | Whether the share gets automatically mounted by the guest or not. |
autoMountPoint | Where the guest should automatically mount the folder, if possible. For Windows and OS/2 guests this should be a drive letter, while other guests it should be a absolute directory. |
VBOX_E_INVALID_VM_STATE | Virtual machine is in the Saved or AbortedSaved state or currently changing state. |
VBOX_E_FILE_ERROR | Shared folder already exists or not accessible. |
void IConsole::removeSharedFolder | ( | in wstring | name | ) |
Removes a transient shared folder with the given name previously created by createSharedFolder from the collection of shared folders and stops sharing it.
name | Logical name of the shared folder to remove. |
VBOX_E_INVALID_VM_STATE | Virtual machine is in the Saved or AbortedSaved state or currently changing state. |
VBOX_E_FILE_ERROR | Shared folder does not exists. |
void IConsole::teleport | ( | in wstring | hostname, |
in unsigned long | tcpport, | ||
in wstring | password, | ||
in unsigned long | maxDowntime, | ||
[retval] out IProgress | progress | ||
) |
Teleport the VM to a different host machine or process.
hostname | The name or IP of the host to teleport to. |
tcpport | The TCP port to connect to (1..65535). |
password | The password. |
maxDowntime | 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.
progress | Progress object to track the operation completion. |
VBOX_E_INVALID_VM_STATE | Virtual machine not running or paused. |
void IConsole::addEncryptionPassword | ( | in wstring | id, |
in wstring | password, | ||
in boolean | clearOnSuspend | ||
) |
Adds a password used for encryption/decryption.
id | The identifier used for the password. Must match the identifier used when the encrypted medium was created. |
password | The password. |
clearOnSuspend | Flag whether to clear the password on VM suspend (due to a suspending host for example). The password must be supplied again before the VM can resume. |
VBOX_E_PASSWORD_INCORRECT | The password provided wasn't correct for at least one disk using the provided ID. |
void IConsole::addEncryptionPasswords | ( | in wstring[] | ids, |
in wstring[] | passwords, | ||
in boolean | clearOnSuspend | ||
) |
Adds a password used for encryption/decryption.
ids | List of identifiers for the passwords. Must match the identifier used when the encrypted medium was created. |
passwords | List of passwords. |
clearOnSuspend | Flag whether to clear the given passwords on VM suspend (due to a suspending host for example). The passwords must be supplied again before the VM can resume. |
VBOX_E_PASSWORD_INCORRECT | The password provided wasn't correct for at least one disk using the provided ID. |
void IConsole::removeEncryptionPassword | ( | in wstring | id | ) |
Removes a password used for hard disk encryption/decryption from the running VM.
As soon as the medium requiring this password is accessed the VM is paused with an error and the password must be provided again.
id | The identifier used for the password. Must match the identifier used when the encrypted medium was created. |
void IConsole::clearAllEncryptionPasswords | ( | ) |
Clears all provided supplied encryption passwords.
readonly attribute IMachine IConsole::machine |
Machine object for this console session.
readonly attribute MachineState IConsole::state |
Current execution state of the machine.
readonly attribute IGuest IConsole::guest |
Guest object.
readonly attribute IKeyboard IConsole::keyboard |
Virtual keyboard object.
readonly attribute IMouse IConsole::mouse |
Virtual mouse object.
readonly attribute IDisplay IConsole::display |
Virtual display object.
readonly attribute IMachineDebugger IConsole::debugger |
Debugging interface.
readonly attribute IUSBDevice [] IConsole::USBDevices |
Collection of USB devices currently attached to the virtual USB controller.
readonly attribute IHostUSBDevice [] IConsole::remoteUSBDevices |
List of USB devices currently attached to the remote VRDE client.
Once a new device is physically attached to the remote host computer, it appears in this list and remains there until detached.
readonly attribute ISharedFolder [] IConsole::sharedFolders |
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 IMachine::sharedFolders 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 createSharedFolder. Existing shared folders can be removed using removeSharedFolder.
readonly attribute IVRDEServerInfo IConsole::VRDEServerInfo |
Interface that provides information on Remote Desktop Extension (VRDE) connection.
readonly attribute IEventSource IConsole::eventSource |
Event source for console events.
readonly attribute IPCIDeviceAttachment [] IConsole::attachedPCIDevices |
Array of PCI devices attached to this machine.
attribute boolean IConsole::useHostClipboard |
Whether the guest clipboard should be connected to the host one or whether it should only be allowed access to the VRDE clipboard.
This setting may not affect existing guest clipboard connections which are already connected to the host clipboard.
readonly attribute IEmulatedUSB IConsole::emulatedUSB |
Interface that manages emulated USB devices.