Skip to content
Ioannis Charalampidis edited this page Aug 13, 2014 · 3 revisions

This page contains some common information for the javascript interface.

Error codes

Most of the functions return a number. If the value is less than zero, an error has occurred. Here is a short list of the errors that can occur.

Return Value Description
1 Successfuly scheduled (status not known yet)
0 No error
-1 Creation Error
-2 Modification Error
-3 Control Error
-4 Deletion Error
-5 Query Error
-6 I/O Error
-7 External library / server error
-8 Not a valid operation for the current state
-9 Not found
-10 Not allowed
-11 Not supported
-12 Not validated
-13 Not trusted
-20 Password denied
-99 Invalid usage
-100 Function is not implemented

Session state codes

The following table contains the meaning of the value of the session.state property. This property is also passed as a first argument to the statechanged event.

0 SS_MISSING There is no Hypervisor reflection for this session.
1 SS_AVAILABLE (Internal use)
2 SS_POWEROFF The Virtual Machine is powered off.
3 SS_SAVED The Virtual Machine is saved.
4 SS_PAUSED The Virtual Machine is paused.
5 SS_RUNNING The Virtual Machine is running.

Virtual machine creation flags

The following table contains the recognized bit flags for the property flags of the object passed to session.open({ .. });. This property is a bit mask, therefore if you want multiple values you have to or them using the | operator:

{
   flags: 1 | 4 | 8
}
Bit Hex value Name Description
1 0x0001 HVF_SYSTEM_64BIT Create an 64-bit Virtual Machine. If not specified, a 32-bit machine will be created.
2 0x0002 HVF_DEPLOYMENT_HDD Use hard-disk image deployment instead of bootable CD-ROM approach. If this bit is specified, the system expects the user to point to a URL from which to download a bootable, compressed VDI image.
3 0x0004 HVF_GUEST_ADDITIONS If this bit is specified, an additional CD-ROM device will be created, with the VirtualBox guest additions disk mounted.
4 0x0008 HVF_FLOPPY_IO If this bit is specified, the user data passed on the session.start() function will be exposed to the VM using the FloppyIO API instead of the contextualization CD-ROM API.
5 0x0010 HVF_HEAFUL Start the virtual machine in Headful mode (Display VM GUI) instead of headless (default).
6 0x0020 HVF_GUI Enable flags specific to headful/GUI mode (for example Drag-n-drop, Clipboard sharing etc.).
7 0x0040 HVF_DUAL_NIC Use secondary adapter instead of creating a NAT rule on the first one.