VirtualBox Main API
|
Represents a platform-independent appliance in OVF format. More...
Public Member Functions | |
void | read (in wstring file, [retval] out IProgress progress) |
Reads an OVF file into the appliance object. | |
void | interpret () |
Interprets the OVF data that was read when the appliance was constructed. | |
void | importMachines (in ImportOptions[] options, [retval] out IProgress progress) |
Imports the appliance into VirtualBox by creating instances of IMachine and other interfaces that match the information contained in the appliance as closely as possible, as represented by the import instructions in the virtualSystemDescriptions array. | |
void | createVFSExplorer (in wstring URI, [retval] out IVFSExplorer explorer) |
Returns a IVFSExplorer object for the given URI. | |
void | write (in wstring format, in ExportOptions[] options, in wstring path, [retval] out IProgress progress) |
Writes the contents of the appliance exports into a new OVF file. | |
void | getWarnings ([retval] out wstring[] warnings) |
Returns textual warnings which occurred during execution of interpret. | |
void | getPasswordIds ([retval] out wstring[] identifiers) |
Returns a list of password identifiers which must be supplied to import or export encrypted virtual machines. | |
void | getMediumIdsForPasswordId (in wstring passwordId, [retval] out wstringUUID[] identifiers) |
Returns a list of medium identifiers which use the given password identifier. | |
void | addPasswords (in wstring[] identifiers, in wstring[] passwords) |
Adds a list of passwords required to import or export encrypted virtual machines. | |
void | createVirtualSystemDescriptions (in unsigned long requested, [retval] out unsigned long created) |
Creates a number of IVirtualSystemDescription objects and store them in the virtualSystemDescriptions array. | |
Public Attributes | |
readonly attribute wstring | path |
Path to the main file of the OVF appliance, which is either the .ovf or the .ova file passed to read (for import) or write (for export). | |
readonly attribute wstring[] | disks |
Array of virtual disk definitions. | |
readonly attribute IVirtualSystemDescription[] | virtualSystemDescriptions |
Array of virtual system descriptions. | |
readonly attribute wstring[] | machines |
Contains the UUIDs of the machines created from the information in this appliances. | |
readonly attribute ICertificate | certificate |
The X.509 signing certificate, if the imported OVF was signed, null if not signed. | |
Represents a platform-independent appliance in OVF format.
An instance of this is returned by IVirtualBox::createAppliance, which can then be used to import and export virtual machines within an appliance with VirtualBox.
The OVF standard suggests two different physical file formats:
.ovf
file extension. If this descriptor file references other files such as disk images, as OVF appliances typically do, those additional files must be in the same directory as the descriptor file. If the appliance 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 IMachine involves the following sequence of API calls:
Exporting VirtualBox machines into an OVF appliance involves the following steps:
{86A98347-7619-41AA-AECE-B21AC5C1A7E6}
void IAppliance::read | ( | in wstring | file, |
[retval] out IProgress | progress | ||
) |
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 interpret.
file | 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 | Progress object to track the operation completion. |
void IAppliance::interpret | ( | ) |
Interprets the OVF data that was read when the appliance was constructed.
After calling this method, one can inspect the virtualSystemDescriptions array attribute, which will then contain one IVirtualSystemDescription for each virtual machine found in the appliance.
Calling this method is the second step of importing an appliance into VirtualBox; see IAppliance for an overview.
After calling this method, one should call getWarnings to find out if problems were encountered during the processing which might later lead to errors.
void IAppliance::importMachines | ( | in ImportOptions[] | options, |
[retval] out IProgress | progress | ||
) |
Imports the appliance into VirtualBox by creating instances of IMachine and other interfaces that match the information contained in the appliance as closely as possible, as represented by the import instructions in the virtualSystemDescriptions array.
Calling this method is the final step of importing an appliance into VirtualBox; see IAppliance 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.
After the import succeeded, the UUIDs of the IMachine instances created can be retrieved from the machines array attribute.
options | Options for the importing operation. |
progress | Progress object to track the operation completion. |
void IAppliance::createVFSExplorer | ( | in wstring | URI, |
[retval] out IVFSExplorer | explorer | ||
) |
Returns a IVFSExplorer object for the given URI.
URI | The URI describing the file system to use. |
explorer |
void IAppliance::write | ( | in wstring | format, |
in ExportOptions[] | options, | ||
in wstring | path, | ||
[retval] out IProgress | progress | ||
) |
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 IAppliance 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.
format | Output format, as a string. Currently supported formats are "ovf-0.9", "ovf-1.0", "ovf-2.0" and "opc-1.0"; future versions of VirtualBox may support additional formats. The "opc-1.0" format is for creating tarballs for the Oracle Public Cloud. |
options | Options for the exporting operation. |
path | Name of appliance file to create. There are certain restrictions with regard to the file name suffix. If the format parameter is "opc-1.0" a .tar.gz suffix is required. Otherwise the suffix must either be .ovf or .ova , depending on whether the appliance is distributed as a set of files or as a single file, respectively. |
progress | Progress object to track the operation completion. |
void IAppliance::getWarnings | ( | [retval] out wstring[] | warnings | ) |
Returns textual warnings which occurred during execution of interpret.
warnings |
void IAppliance::getPasswordIds | ( | [retval] out wstring[] | identifiers | ) |
Returns a list of password identifiers which must be supplied to import or export encrypted virtual machines.
identifiers | The list of password identifiers required for export on success. |
void IAppliance::getMediumIdsForPasswordId | ( | in wstring | passwordId, |
[retval] out wstringUUID[] | identifiers | ||
) |
Returns a list of medium identifiers which use the given password identifier.
passwordId | The password identifier to get the medium identifiers for. |
identifiers | The list of medium identifiers returned on success. |
void IAppliance::addPasswords | ( | in wstring[] | identifiers, |
in wstring[] | passwords | ||
) |
Adds a list of passwords required to import or export encrypted virtual machines.
identifiers | List of identifiers. |
passwords | List of matching passwords. |
void IAppliance::createVirtualSystemDescriptions | ( | in unsigned long | requested, |
[retval] out unsigned long | created | ||
) |
Creates a number of IVirtualSystemDescription objects and store them in the virtualSystemDescriptions array.
requested | Requested number of new virtual system description objects |
created | Actually created number of virtual system description objects |
readonly attribute wstring IAppliance::path |
readonly attribute wstring [] IAppliance::disks |
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:
readonly attribute IVirtualSystemDescription [] IAppliance::virtualSystemDescriptions |
Array of virtual system descriptions.
One such description is created for each virtual system (machine) found in the OVF. This array is empty until either interpret (for import) or IMachine::exportTo (for export) has been called.
readonly attribute wstring [] IAppliance::machines |
Contains the UUIDs of the machines created from the information in this appliances.
This is only relevant for the import case, and will only contain data after a call to importMachines succeeded.
readonly attribute ICertificate IAppliance::certificate |
The X.509 signing certificate, if the imported OVF was signed, null
if not signed.
This is available after calling read.